Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1446726
| From | Christian Borntraeger <borntraeger@de.ibm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v3 02/11] mm: Hardened usercopy |
| Date | 2016-07-19 22:50 +0200 |
| Message-ID | <rWK7L-kN-3@gated-at.bofh.it> (permalink) |
| References | (1 earlier) <rVj9E-3EM-15@gated-at.bofh.it> <rWzvH-2e4-19@gated-at.bofh.it> <rWJ22-86v-11@gated-at.bofh.it> <rWJEJ-8P-1@gated-at.bofh.it> <rWJY5-fG-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 07/19/2016 10:34 PM, Kees Cook wrote: [...] >> >> So what about for the CONFIG text: >> >> An architecture should select this if the kernel mapping has a secondary >> linear mapping of the kernel text - in other words more than one virtual >> kernel address that points to the kernel image. This is used to verify >> that kernel text exposures are not visible under CONFIG_HARDENED_USERCOPY. > > Sounds good, I've adjusted it for now. > >>> I wonder if I can avoid the CONFIG entirely if I just did a >>> __va(__pa(_stext)) != _stext test... would that break anyone? >> >> Can this be resolved on all platforms at compile time? > > Well, I think it still needs a runtime check (compile-time may not be > able to tell about kaslr, or who knows what else). I would really like > to avoid the CONFIG if possible, though. Would this do the right thing > on s390? This appears to work where I'm able to test it (32/64 x86, > 32/64 arm): > > unsigned long textlow = (unsigned long)_stext; > unsigned long texthigh = (unsigned long)_etext; > unsigned long textlow_linear = (unsigned long)__va(__pa(textlow); > unsigned long texthigh_linear = (unsigned long)__va(__pa(texthigh); > as we have #define PAGE_OFFSET 0x0UL #define __pa(x) (unsigned long)(x) #define __va(x) (void *)(unsigned long)(x) both should be identical on s390 as of today, so it should work fine and only do the check once > if (overlaps(ptr, n, textlow, texthigh)) > return "<kernel text>"; > > /* Check against possible secondary linear mapping as well. */ > if (textlow != textlow_linear && > overlaps(ptr, n, textlow_linear, texthigh_linear)) > return "<linear kernel text>"; > > return NULL; > > > -Kees > PS: Not sure how useful and flexible this offers is but you can get some temporary free access to an s390 on https://developer.ibm.com/linuxone/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3 02/11] mm: Hardened usercopy Kees Cook <keescook@chromium.org> - 2016-07-15 23:50 +0200
Re: [PATCH v3 02/11] mm: Hardened usercopy Laura Abbott <labbott@redhat.com> - 2016-07-19 03:10 +0200
Re: [PATCH v3 02/11] mm: Hardened usercopy Kees Cook <keescook@chromium.org> - 2016-07-19 20:50 +0200
[PATCH] mm: Add is_migrate_cma_page Laura Abbott <labbott@redhat.com> - 2016-07-20 00:10 +0200
Re: [PATCH] mm: Add is_migrate_cma_page Kees Cook <keescook@chromium.org> - 2016-07-20 00:50 +0200
Re: [PATCH v3 02/11] mm: Hardened usercopy Balbir Singh <bsingharora@gmail.com> - 2016-07-20 12:30 +0200
Re: [PATCH v3 02/11] mm: Hardened usercopy Laura Abbott <labbott@redhat.com> - 2016-07-20 17:40 +0200
Re: [PATCH v3 02/11] mm: Hardened usercopy Laura Abbott <labbott@redhat.com> - 2016-07-19 04:00 +0200
Re: [PATCH v3 02/11] mm: Hardened usercopy Kees Cook <keescook@chromium.org> - 2016-07-19 21:20 +0200
Re: [PATCH v3 02/11] mm: Hardened usercopy Kees Cook <keescook@chromium.org> - 2016-07-20 01:00 +0200
Re: [PATCH v3 02/11] mm: Hardened usercopy Christian Borntraeger <borntraeger@de.ibm.com> - 2016-07-19 11:30 +0200
Re: [PATCH v3 02/11] mm: Hardened usercopy Kees Cook <keescook@chromium.org> - 2016-07-19 21:40 +0200
Re: [PATCH v3 02/11] mm: Hardened usercopy Christian Borntraeger <borntraeger@de.ibm.com> - 2016-07-19 22:20 +0200
Re: [PATCH v3 02/11] mm: Hardened usercopy Kees Cook <keescook@chromium.org> - 2016-07-19 22:40 +0200
Re: [PATCH v3 02/11] mm: Hardened usercopy Christian Borntraeger <borntraeger@de.ibm.com> - 2016-07-19 22:50 +0200
Re: [PATCH v3 02/11] mm: Hardened usercopy Kees Cook <keescook@chromium.org> - 2016-07-21 20:40 +0200
Re: [PATCH v3 02/11] mm: Hardened usercopy Josh Poimboeuf <jpoimboe@redhat.com> - 2016-07-22 19:50 +0200
RE: [PATCH v3 02/11] mm: Hardened usercopy David Laight <David.Laight@ACULAB.COM> - 2016-07-25 11:30 +0200
csiph-web