Closed
Bug 1470701
Opened 6 years ago
Closed 6 years ago
Possible crash in elfhack bootstrap code when run-time page size doesn't match alignment of executable PT_LOADs
Categories
(Firefox Build System :: General, defect)
Firefox Build System
General
Tracking
(firefox63 fixed)
RESOLVED
FIXED
mozilla63
Tracking | Status | |
---|---|---|
firefox63 | --- | fixed |
People
(Reporter: glandium, Assigned: glandium)
References
Details
Attachments
(1 file)
No description provided.
Comment hidden (mozreview-request) |
Comment 2•6 years ago
|
||
mozreview-review |
Comment on attachment 8987304 [details]
Bug 1470701 - Use run-time page size when changing mapping permissions in elfhack injected code.
https://reviewboard.mozilla.org/r/252546/#review259314
::: build/unix/elfhack/inject.c:67
(Diff revision 1)
> static inline __attribute__((always_inline))
> -void relro_pre()
> +void do_relocations_with_relro(void)
> {
> + long page_size = sysconf_cb(_SC_PAGESIZE);
> + uintptr_t aligned_relro_start = ((uintptr_t) relro_start) & ~(page_size - 1);
> + uintptr_t aligned_relro_end = ((uintptr_t) relro_end) & ~(page_size - 1);
Am I missing something, or should this be rounding up and not down?
Assignee | ||
Comment 3•6 years ago
|
||
(In reply to Jed Davis [:jld] (⏰UTC-6) from comment #2)
> Comment on attachment 8987304 [details]
> Bug 1470701 - Use run-time page size when changing mapping permissions in
> elfhack injected code.
>
> https://reviewboard.mozilla.org/r/252546/#review259314
>
> ::: build/unix/elfhack/inject.c:67
> (Diff revision 1)
> > static inline __attribute__((always_inline))
> > -void relro_pre()
> > +void do_relocations_with_relro(void)
> > {
> > + long page_size = sysconf_cb(_SC_PAGESIZE);
> > + uintptr_t aligned_relro_start = ((uintptr_t) relro_start) & ~(page_size - 1);
> > + uintptr_t aligned_relro_end = ((uintptr_t) relro_end) & ~(page_size - 1);
>
> Am I missing something, or should this be rounding up and not down?
No, the rounding is down because if the end of the segment is not page aligned, that last page can't be made read-only, since it will contain bits that are read-write.
Comment 4•6 years ago
|
||
mozreview-review |
Comment on attachment 8987304 [details]
Bug 1470701 - Use run-time page size when changing mapping permissions in elfhack injected code.
https://reviewboard.mozilla.org/r/252546/#review259726
::: build/unix/elfhack/inject.c:65
(Diff revision 1)
> + long page_size = sysconf_cb(_SC_PAGESIZE);
> + uintptr_t aligned_relro_start = ((uintptr_t) relro_start) & ~(page_size - 1);
> + uintptr_t aligned_relro_end = ((uintptr_t) relro_end) & ~(page_size - 1);
jld's concern about `aligned_relro_end` probably merits a comment about what is going on here.
Attachment #8987304 -
Flags: review?(nfroyd) → review+
Comment hidden (mozreview-request) |
Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/ded856841553
Use run-time page size when changing mapping permissions in elfhack injected code. r=froydnj
Comment 7•6 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 6 years ago
status-firefox63:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in
before you can comment on or make changes to this bug.
Description
•