Skip to contentSkip to conversation

usercopy fixes for v4.8-rc6

GIT PULL Kees Cook 2 participants 3 messages Sep 6, 2016 – Sep 7, 2016

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

Hi,

Please pull these usercopy fixes for v4.8-rc6.

Thanks!

-Kees

The following changes since commit 46738ab31fe668ea1d4413dd459af2632f6fef8d:

Merge branch 'mailbox-devel' of git://git.linaro.org/landing-teams/working/fujitsu/integration (2016-09-06 11:15:07 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git tags/usercopy-v4.8-rc6

for you to fetch changes up to 3c17648c2816f6d28bd2be9293032a2901994a36:

lkdtm: adjust usercopy tests to bypass const checks (2016-09-06 12:17:30 -0700)

----------------------------------------------------------------
- Inlines copy_*_user() for correct use of __builtin_const_p() for hardened usercopy and the recent compile-time checks.
- Switches hardened usercopy to only check non-const size arguments to avoid meaningless checks on likely-sane const values.
- Updates lkdtm usercopy tests to compenstate for the const checking.

----------------------------------------------------------------
Kees Cook (3):
x86/uaccess: force copy_*_user() to be inlined
usercopy: fold builtin_const check into inline function
lkdtm: adjust usercopy tests to bypass const checks

 arch/ia64/include/asm/uaccess.h     | 12 ++++--------
 arch/powerpc/include/asm/uaccess.h  | 19 +++++++------------
 arch/sparc/include/asm/uaccess_32.h |  9 +++------
 arch/sparc/include/asm/uaccess_64.h |  7 +++----
 arch/x86/include/asm/uaccess.h      |  4 ++--
 drivers/misc/lkdtm_usercopy.c       | 25 +++++++++++++++++--------
 include/linux/thread_info.h         |  3 ++-
 7 files changed, 38 insertions(+), 41 deletions(-)
Signature · 2 lines
Kees Cook
Nexus Security
#1 lore raw

Pulled, but:

Quoted 3 lines · Kees Cook

Kees Cook (3):
usercopy: fold builtin_const check into inline function

Hmm. So with this, check_object_size() seems sane, but it's only marked "inline".

And we've had the issue that without the __always_inline, gcc will randomly not inline things. In fact, this very pull added that to the copy_xyz_user() functions exactly because of this issue.

Now, it may be that check_object_size() is so simple that it really always *will* be inlined regardless, but it looks a bit dodgy.

Linus

author
#2 lore raw
Quoted 4 lines · Linus Torvalds

Pulled, but:

Quoted 1 line · Kees Cook
Quoted 8 lines
Quoted 2 lines

Kees Cook (3):
usercopy: fold builtin_const check into inline function

Hmm. So with this, check_object_size() seems sane, but it's only marked "inline".

And we've had the issue that without the __always_inline, gcc will randomly not inline things. In fact, this very pull added that to the

Yeah, reading the thread from 2009 made my head spin. :(

Quoted 4 lines

copy_xyz_user() functions exactly because of this issue.

Now, it may be that check_object_size() is so simple that it really always *will* be inlined regardless, but it looks a bit dodgy.

True, yes. I will send another update with that added.

(And a heads-up: another part of the update will be the disabling hardened usercopy's page-spanning checker too -- we've had another false positive hit on that, so it's time to drop it.)

Thanks!

-Kees

Signature · 2 lines
Kees Cook
Nexus Security