Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1675859
| From | Daniel Micay <danielmicay@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2] binfmt_elf: Use ELF_ET_DYN_BASE only for PIE |
| Date | 2017-06-27 17:00 +0200 |
| Message-ID | <tX089-1VG-3@gated-at.bofh.it> (permalink) |
| References | <tURLI-Mh-11@gated-at.bofh.it> <tX089-1VG-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, 2017-06-27 at 16:49 +0200, Michal Hocko wrote: > On Wed 21-06-17 10:32:01, Kees Cook wrote: > > The ELF_ET_DYN_BASE position was originally intended to keep loaders > > away from ET_EXEC binaries. (For example, running "/lib/ld- > > linux.so.2 > > /bin/cat" might cause the subsequent load of /bin/cat into where the > > loader had been loaded.) With the advent of PIE (ET_DYN binaries > > with > > an INTERP Program Header), ELF_ET_DYN_BASE continued to be used > > since > > the kernel was only looking at ET_DYN. However, since > > ELF_ET_DYN_BASE > > is traditionally set at the top 1/3rd of the TASK_SIZE, a > > substantial > > portion of the address space is unused. > > > > For 32-bit tasks when RLIMIT_STACK is set to RLIM_INFINITY, programs > > are loaded below the mmap region. This means they can be made to > > collide > > (CVE-2017-1000370) or nearly collide (CVE-2017-1000371) with > > pathological > > stack regions. Lowering ELF_ET_DYN_BASE solves both by moving > > programs > > above the mmap region in all cases, and will now additionally avoid > > programs falling back to the mmap region by enforcing MAP_FIXED for > > program loads (i.e. if it would have collided with the stack, now it > > will fail to load instead of falling back to the mmap region). > > I do not understand this part. MAP_FIXED will simply unmap whatever > was under the requested range, how it could help failing anything? So > what would happen if something was mapped in that region, or is this > impossible? Moreover MAP_FIXED close to stack will inhibit the stack > gap > protection. I don't think there's a reason to use MAP_FIXED. PaX likely ignores the address hint with RANDMMAP in that code, which would explain it there.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2] binfmt_elf: Use ELF_ET_DYN_BASE only for PIE Kees Cook <keescook@chromium.org> - 2017-06-21 19:40 +0200
Re: [PATCH v2] binfmt_elf: Use ELF_ET_DYN_BASE only for PIE Rik van Riel <riel@redhat.com> - 2017-06-21 20:30 +0200
Re: [PATCH v2] binfmt_elf: Use ELF_ET_DYN_BASE only for PIE Daniel Micay <danielmicay@gmail.com> - 2017-06-27 17:00 +0200
Re: [PATCH v2] binfmt_elf: Use ELF_ET_DYN_BASE only for PIE Michal Hocko <mhocko@kernel.org> - 2017-06-27 17:00 +0200
Re: [PATCH v2] binfmt_elf: Use ELF_ET_DYN_BASE only for PIE Kees Cook <keescook@chromium.org> - 2017-06-27 22:10 +0200
csiph-web