Skip to content

x86: fix user address masking non-canonical

Jimmy Tran stable 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest posting 2/27 patches 3 repliesIn review
  2. v2 posting 1/27 patches 1 replySuperseded
  3. v16 patches 2 repliesSuperseded

Changes in v2 from the cover letter

==============
- Incorporated the commit 91309a708: x86: use cmov for user address as suggested by David Laight. This commit is now included as the first patch in the series.

Patches in v2 posting 2/2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7vfs: dcache: move hashlen_hash() from callers into d_hash()fs/dcache.c+4 -40 replies
2/7runtime constants: add default dummy infrastructurefs/dcache.c include/asm-generic/Kbuild include/asm-generic/runtime-const.h +1 more+34 -11 reply
3/7runtime constants: add x86 architecture supportarch/x86/include/asm/runtime-const.h arch/x86/kernel/vmlinux.lds.S+64 -01 reply
4/7arm64: add 'runtime constant' supportarch/arm64/include/asm/runtime-const.h arch/arm64/kernel/vmlinux.lds.S+95 -00 replies
5/7x86: fix user address masking non-canonical speculation issuearch/x86/include/asm/uaccess_64.h arch/x86/kernel/cpu/common.c arch/x86/kernel/vmlinux.lds.S +1 more+47 -180 replies
6/7x86: fix off-by-one in access_ok()arch/x86/kernel/cpu/common.c+2 -20 replies
7/7x86: use cmov for user address maskingarch/x86/include/asm/uaccess_64.h arch/x86/lib/getuser.S+8 -100 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH 6.6 v2 0/7] x86: fix user address masking non-canonical

Hi everyone,

This is v2 of my series to backport the critical security fix, identified as CVE-2020-12965 ("Transient Execution of Non-Canonical Accesses"), to the 6.6.y stable kernel tree.

Linus Torvalds's second proposed solution offers a more targeted and smaller backport for CVE-2020-12965 compared to backporting the entire patch series.

This alternative would focus solely on the user address masking logic that addresses the AMD speculation issue with non-canonical addresses.

Instead of introducing the extensive "runtime-constant" infrastructure seen in the larger patch series, this solution would:

- Introduce a single new variable for the USER_PTR_MAX
value.
- Use an actual memory load to access this USER_PTR_MAX value, rather than leveraging the runtime_const mechanism.

While this approach would result in a noticeably smaller and more localized patch, it would differ from what's currently in the mainline kernel. This divergence would necessitate significant additional testing to ensure its stability.

I am ready to implement the second proposed solution if the maintainers wish to move forward in that direction, understanding the testing implications. Please let me know your preference.

Changes in v2:
==============
- Incorporated the commit 91309a708: x86: use cmov for user address as suggested by David Laight. This commit is now included as the first patch in the series.

This series addresses the CVE-2020-12965 vulnerability by introducing the necessary x86 infrastructure and the specific fix for user address masking non-canonical speculation issues.

v1:
==============
This patch series backports a critical security fix, identified as CVE-2020-12965 ("Transient Execution of Non-Canonical Accesses"), to the 6.6.y stable kernel tree.

David Laight (1):
x86: fix off-by-one in access_ok()

Linus Torvalds (6):
vfs: dcache: move hashlen_hash() from callers into d_hash() runtime constants: add default dummy infrastructure runtime constants: add x86 architecture support
arm64: add 'runtime constant' support
x86: fix user address masking non-canonical speculation issue
x86: use cmov for user address masking

 arch/arm64/include/asm/runtime-const.h | 92 ++++++++++++++++++++++++++
 arch/arm64/kernel/vmlinux.lds.S        |  3 +
 arch/x86/include/asm/runtime-const.h   | 61 +++++++++++++++++
 arch/x86/include/asm/uaccess_64.h      | 44 +++++++-----
 arch/x86/kernel/cpu/common.c           | 10 +++
 arch/x86/kernel/vmlinux.lds.S          |  4 ++
 arch/x86/lib/getuser.S                 | 10 ++-
 fs/dcache.c                            | 17 +++--
 include/asm-generic/Kbuild             |  1 +
 include/asm-generic/runtime-const.h    | 15 +++++
 include/asm-generic/vmlinux.lds.h      |  8 +++
 11 files changed, 242 insertions(+), 23 deletions(-)
 create mode 100644 arch/arm64/include/asm/runtime-const.h
 create mode 100644 arch/x86/include/asm/runtime-const.h
 create mode 100644 include/asm-generic/runtime-const.h
Signature · 1 line
2.50.1.470.g6ba607880d-goog