Details
Diff Detail
Event Timeline
compiler-rt/lib/scudo/standalone/mem_map_fuchsia.cpp | ||
---|---|---|
23 | nit: Suggest moving static functions (here and below) outside scudo namespace. | |
68–70 | nit:single statement | |
93–95 | nit:single statement | |
117–119 | nit:single statement | |
168–170 | nit:single statement | |
179 | Do you want to handle MAP_ALLOWNOMEM here? | |
188–190 | nit: omit curly brackets if it's single statement | |
194–196 | nit: single statement | |
217–219 | nit: single statement |
compiler-rt/lib/scudo/standalone/mem_map_fuchsia.cpp | ||
---|---|---|
23 | What goal do you have in mind? I can do that, but I'm not sure it's more readable as I'll have to add the scudo:: prefix to all the references to other Scudo functions and types, e.g. static void NORETURN dieOnError(zx_status_t Status, const char *FnName, scudo::uptr Size) { char Error[128]; scudo::formatString(Error, sizeof(Error), "SCUDO ERROR: %s failed with size %zuKB (%s)", FnName, Size >> 10, _zx_status_get_string(Status)); scudo::outputRaw(Error); scudo::die(); } | |
179 | Nice catch! The zx_vmar_map documentation says that userspace has no way to handle ZX_ERR_NO_MEMORY in a good way, and that it will become impossible to get this error in the future. Anyway, I guess that an extra check within an already-UNLIKELY block doesn't hurt, so I've added it. For completeness, dispatch could also result in the same error (because of the zx_vmo_create call). In theory, I think we should make dispatch similarly fallible and with an option to pass MAP_ALLOWNOMEM. In practice, I think that it's OK to just die if dispatch fails, given who the current users are. |
compiler-rt/lib/scudo/standalone/mem_map_fuchsia.cpp | ||
---|---|---|
162 | I recall the Size passed to decommit must be page aligned for the op to succeed - want to make sure, is that always the case here? |
compiler-rt/lib/scudo/standalone/mem_map_fuchsia.cpp | ||
---|---|---|
162 | Good point! Actually, all the addresses, sizes and capacities must be page aligned. @Chia-hungDuan I'd say that this and similar checks should be DCHECKs in mem_map_base.h, so that they are checked on Linux too. I think think we even discussed it, but there was some caveat that I don't remember about Trusty. I saw that Trusty's impl has changed since then. Would you see any issue in enforcing page alignment there too? |
compiler-rt/lib/scudo/standalone/mem_map_fuchsia.cpp | ||
---|---|---|
23 | This is just a coding convention that I usually have in some llvm projects. Using anonymous namespace and static to manage the code that has the scope only in a compilation unit. In general, we put local class declaration in anonymous namespace only. Other stuff will be done with static in global namespace. In the case here, it makes the scudo namespace clear. Not a strong opinion. feel free to stick on your preference. | |
162 | On Linux, it only requires the Size to be greater than 0. It does the round up stuff in the kernel. Luke said he would like to do the same thing in Fuchsia. I think it's fine to add this constraint at one level above platform specific layer. I need to review the rationale of enforcing that (include Trusty's stuff) |
nit: Suggest moving static functions (here and below) outside scudo namespace.