Bug 29639 - Bumping common page size to 16 KiB on ARM64?
Summary: Bumping common page size to 16 KiB on ARM64?
Status: RESOLVED DUPLICATE of bug 28824
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-30 03:41 UTC by Rui Ueyama
Modified: 2022-10-01 10:57 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rui Ueyama 2022-09-30 03:41:42 UTC
Currently, the default value of `-z max-page-size` and `-z common-page-size` are 65536 and 4096 on ARM64, respectively. That means an executable created by GNU ld with the default settings works on any system whose page size is equal to or smaller than 65536, but the RELRO segment may not be protected on systems with >4096 byte pages.

RELRO works on page granularity. When GNU ld creates a PT_GNU_RELRO segment, it uses the common page size as a page size. At runtime, both the start and the end address of a PT_GNU_RELRO segment are _rounded down_ to the actual system's page size. So, if the common page size is smaller than the max page size, it is not guaranteed that an entire RELRO segment becomes read-only after process initialization.

I think this can cause a security issue. Asahi Linux uses 16 KiB pages, so the above situation is I think becoming real. Maybe we should bump the common page size to 16 KiB on ARM64?
Comment 1 Alan Modra 2022-09-30 07:09:33 UTC
(In reply to Rui Ueyama from comment #0)
> So, if the common page size is smaller than the max page
> size, it is not guaranteed that an entire RELRO segment becomes read-only
> after process initialization.

That used to be the case, but with current mainline the RELRO segment ought to be max page size aligned.  See pr28824
Comment 2 Rui Ueyama 2022-10-01 10:57:00 UTC
Oh, I didn't know that that change has been made. Thank you for your quick response! I'm closing this issue as a duplicate.

*** This bug has been marked as a duplicate of bug 28824 ***
Comment 3 Rui Ueyama 2022-10-01 10:57:12 UTC
Oh, I didn't know that that change has been made. Thank you for your quick response! I'm closing this issue as a duplicate.