Hi all, I'm wondering if there's a reason why _dl_protect_relro aligns the end address down, and whether it wouldn't be a pure improvement to align it up? I've copied the relevant part of it below for reference (at 569cfcc6bf35c28112ca8d7112e9eb4a22bed5b8), but the effect of it is: - when start and end are on the same page, nothing is protected. - if end is not on a page boundary, parts of the region intended for protection is left unprotected. Notably this behavior is entirely silent, making it easy to believe that you have hardened your executable when in fact you have not. This seems very brittle. I have no real world issue. I was writing a linker for fun, and was putting my relro segment at the start of a page, it seemed the straightforward thing to do. GNU ld 2.39.0 instead puts the relro segment at the end of a page (I'm not familiar enough to know whether this is a cause, effect, or unrelated). I did however do some looking around and found https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/1412553, so it seems like this has caused problems for projects with users. Since mprotect will protect entire pages anyway, wouldn't it make a lot more sense here to say `end = ALIGN_UP(...)`? Apart from feeling more intuitive, it also seems like it would avoid page size inconsistencies between runtime and link editing like the one above. I couldn't really find any documentation about this that spelled out the "align at end" requirement, but I'm happy to be proven wrong. Happy to provide more examples if desired. Thanks, Joel ``` void _dl_protect_relro (struct link_map *l) { ElfW(Addr) start = ALIGN_DOWN((l->l_addr + l->l_relro_addr), GLRO(dl_pagesize)); ElfW(Addr) end = ALIGN_DOWN((l->l_addr + l->l_relro_addr + l->l_relro_size), GLRO(dl_pagesize)); if (start != end && __mprotect ((void *) start, end - start, PROT_READ) < 0) { ... ```