Skip to content

x86: oops on uaccess faults outside of user addresses

Andy Lutomirski kvm linuxppc-dev lkml netdev trinity 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 13 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5x86: Split "utter crap" pnpbios fixup out of fixup_exceptionarch/x86/include/asm/traps.h arch/x86/kernel/traps.c arch/x86/mm/extable.c +1 more+27 -140 replies
2/5x86: Clean up extable entry format (and free up a bit)arch/x86/include/asm/asm.h arch/x86/mm/extable.c+60 -320 replies
3/5x86: Annotate _ASM_EXTABLE users to distinguish uaccess from everything elsearch/x86/ia32/ia32entry.S arch/x86/include/asm/asm.h arch/x86/include/asm/fpu-internal.h +27 more+236 -2310 replies
4/5x86: Don't fixup uaccess faults to kernel or non-canonical addressesarch/x86/include/asm/uaccess.h arch/x86/kernel/kprobes/core.c arch/x86/kernel/traps.c +2 more+26 -140 replies
5/5net: Block MSG_CMSG_COMPAT in send(m)msg and recv(m)msgnet/socket.c+31 -213 replies

Reviews trailers per patch

None of the 5 patches has a Reviewed-by or Acked-by.

PatchEric Dumazet
1/5
2/5
3/5
4/5
5/5T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/5] x86: oops on uaccess faults outside of user addresses

Currently, __get_user can't trigger an OOPS -- any exception will be caught and return -EFAULT. This means that, if an access_ok check is missing somewhere, then an attacker can freely use it to probe for valid kernel mappings.

This series annotates all of the exception fixups as "catch anything" or "catch valid uaccess faults", and skips the fixup (and hence oopses) if an instruction of the latter type faults for any reason other than a page fault to a user address.

I know of only one bug of this type; it's fixed in patch 5.

Perhaps surprisingly, this seems to survive Trinity fairly well.

Andy Lutomirski (5):
x86: Split "utter crap" pnpbios fixup out of fixup_exception
x86: Clean up extable entry format (and free up a bit)
x86: Annotate _ASM_EXTABLE users to distinguish uaccess from
everything else
x86: Don't fixup uaccess faults to kernel or non-canonical addresses
net: Block MSG_CMSG_COMPAT in send(m)msg and recv(m)msg

 arch/x86/ia32/ia32entry.S             |   4 +-
 arch/x86/include/asm/asm.h            |  75 ++++++++----
 arch/x86/include/asm/fpu-internal.h   |   6 +-
 arch/x86/include/asm/futex.h          |   8 +-
 arch/x86/include/asm/kvm_host.h       |   2 +-
 arch/x86/include/asm/msr.h            |   4 +-
 arch/x86/include/asm/segment.h        |   2 +-
 arch/x86/include/asm/special_insns.h  |   2 +-
 arch/x86/include/asm/traps.h          |   6 +
 arch/x86/include/asm/uaccess.h        |  10 +-
 arch/x86/include/asm/word-at-a-time.h |   2 +-
 arch/x86/include/asm/xsave.h          |   6 +-
 arch/x86/kernel/entry_32.S            |  26 ++---
 arch/x86/kernel/entry_64.S            |   6 +-
 arch/x86/kernel/ftrace.c              |   4 +-
 arch/x86/kernel/kprobes/core.c        |   4 +-
 arch/x86/kernel/test_nx.c             |   2 +-
 arch/x86/kernel/test_rodata.c         |   2 +-
 arch/x86/kernel/traps.c               |  12 +-
 arch/x86/kvm/emulate.c                |   4 +-
 arch/x86/lib/checksum_32.S            |   4 +-
 arch/x86/lib/copy_user_64.S           |  50 ++++----
 arch/x86/lib/copy_user_nocache_64.S   |  44 +++----
 arch/x86/lib/csum-copy_64.S           |   6 +-
 arch/x86/lib/getuser.S                |  12 +-
 arch/x86/lib/mmx_32.c                 |  12 +-
 arch/x86/lib/msr-reg.S                |   4 +-
 arch/x86/lib/putuser.S                |  10 +-
 arch/x86/lib/usercopy_32.c            | 212 +++++++++++++++++-----------------
 arch/x86/lib/usercopy_64.c            |   4 +-
 arch/x86/mm/extable.c                 |  41 +++----
 arch/x86/mm/fault.c                   |  36 ++++--
 arch/x86/mm/init_32.c                 |   2 +-
 arch/x86/um/checksum_32.S             |   4 +-
 arch/x86/xen/xen-asm_32.S             |   2 +-
 net/socket.c                          |  33 +++++-
 36 files changed, 375 insertions(+), 288 deletions(-)
Signature · 1 line
1.8.1.4