Skip to content

clean up asm/uaccess.h, kill set_fs for good

Arnd Bergmann linux-alpha linux-api linux-arch linux-csky linux-hexagon linux-ia64 linux-m68k linux-mips linux-mm linux-parisc linux-riscv linux-s390 linux-sh linux-snps-arc linux-um linuxppc-dev lkml openrisc sparclinux stable 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest18 patches 57 repliesIn review
  2. v114 patches 46 repliesSuperseded

Changes in v2 from the cover letter

- add fixes for more nios2 and microblaze bugs found in the process
- do final cleanup in a single patch
- fix sparc64 regression
- introduce CONFIG_ALTERNATE_USER_ADDRESS_SPACE
- fix access_ok() in lib/test_lockup.c

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/18uaccess: fix integer overflow on access_ok()arch/csky/include/asm/uaccess.h arch/hexagon/include/asm/uaccess.h arch/microblaze/include/asm/uaccess.h+16 -280 replies
2/18uaccess: fix nios2 and microblaze get_user_8()arch/microblaze/include/asm/uaccess.h arch/nios2/include/asm/uaccess.h+25 -193 replies
3/18nds32: fix access_ok() checks in get/put_userarch/nds32/include/asm/uaccess.h+17 -51 reply
4/18sparc64: add __{get,put}_kernel_nocheck()arch/sparc/include/asm/uaccess_64.h+78 -00 replies
5/18x86: remove __range_not_ok()arch/x86/events/core.c arch/x86/include/asm/uaccess.h arch/x86/kernel/dumpstack.c +2 more+10 -83 replies
6/18x86: use more conventional access_ok() definitionarch/x86/include/asm/uaccess.h+3 -221 reply
7/18nios2: drop access_ok() check from __put_user()arch/nios2/include/asm/uaccess.h+33 -233 replies
8/18uaccess: add generic __{get,put}_kernel_nofaultarch/arm/include/asm/uaccess.h arch/arm64/include/asm/uaccess.h arch/m68k/include/asm/uaccess.h +11 more+19 -1312 replies
9/18mips: use simpler access_ok()arch/mips/include/asm/uaccess.h+4 -187 replies
10/18m68k: fix access_ok for coldfirearch/m68k/include/asm/uaccess.h+9 -23 replies
11/18arm64: simplify access_ok()arch/arm64/include/asm/uaccess.h+10 -240 replies
12/18uaccess: fix type mismatch warnings from access_ok()arch/arc/kernel/process.c arch/arm/kernel/swp_emulate.c arch/arm/kernel/traps.c +7 more+24 -222 replies
13/18uaccess: generalize access_ok()arch/Kconfig arch/alpha/include/asm/uaccess.h arch/arc/include/asm/uaccess.h +29 more+109 -36611 replies
14/18lib/test_lockup: fix kernel pointer check for separate address spaceslib/test_lockup.c+8 -32 replies
15/18sparc64: remove CONFIG_SET_FS supportarch/sparc/include/asm/processor_64.h arch/sparc/include/asm/switch_to_64.h arch/sparc/include/asm/thread_info_64.h +5 more+8 -483 replies
16/18sh: remove CONFIG_SET_FS supportarch/sh/Kconfig arch/sh/include/asm/processor.h arch/sh/include/asm/segment.h +5 more+21 -611 reply
17/18ia64: remove CONFIG_SET_FS supportarch/ia64/Kconfig arch/ia64/include/asm/processor.h arch/ia64/include/asm/thread_info.h +2 more+45 -430 replies
18/18uaccess: drop maining CONFIG_SET_FS usersarch/Kconfig arch/alpha/Kconfig arch/alpha/include/asm/processor.h +69 more+10 -5228 replies

Reviews trailers per patch

12 of 18 patches have a Reviewed-by or Acked-by.

PatchChristoph HellwigRobin MurphyMark RutlandSam RavnborgEric W. BiedermanGeert UytterhoevenSergey MatyukevichDinh NguyenStafford Horne
1/18R-b
2/18R-b A-b
3/18R-b
4/18
5/18
6/18R-b
7/18R-b A-b
8/18R-b R-b A-b
9/18
10/18R-b
11/18A-b A-b
12/18R-b A-b
13/18R-b A-b A-b A-b A-b
14/18
15/18
16/18R-b
17/18
18/18A-b A-b T-b A-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 9 reviewers.

Read the v2 thread

Cover letter [PATCH v2 00/18] clean up asm/uaccess.h, kill set_fs for good

From: Arnd Bergmann <[email protected]>

Christoph Hellwig and a few others spent a huge effort on removing set_fs() from most of the important architectures, but about half the other architectures were never completed even though most of them don't actually use set_fs() at all.

I did a patch for microblaze at some point, which turned out to be fairly generic, and now ported it to most other architectures, using new generic implementations of access_ok() and __{get,put}_kernel_nocheck().

Three architectures (sparc64, ia64, and sh) needed some extra work, which I also completed.

The final series contains extra cleanup changes that touch all architectures. Please review and test these, so we can merge them for v5.18.

The series is available at
https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=set_fs-2
for testing.

Changes in v2:
- add fixes for more nios2 and microblaze bugs found in the process
- do final cleanup in a single patch
- fix sparc64 regression
- introduce CONFIG_ALTERNATE_USER_ADDRESS_SPACE
- fix access_ok() in lib/test_lockup.c

Arnd Bergmann (18):
uaccess: fix integer overflow on access_ok()
uaccess: fix nios2 and microblaze get_user_8()
nds32: fix access_ok() checks in get/put_user
sparc64: add __{get,put}_kernel_nocheck()
x86: remove __range_not_ok()
x86: use more conventional access_ok() definition
nios2: drop access_ok() check from __put_user()
uaccess: add generic __{get,put}_kernel_nofault
mips: use simpler access_ok()
m68k: fix access_ok for coldfire
arm64: simplify access_ok()
uaccess: fix type mismatch warnings from access_ok()
uaccess: generalize access_ok()
lib/test_lockup: fix kernel pointer check for separate address spaces
sparc64: remove CONFIG_SET_FS support
sh: remove CONFIG_SET_FS support
ia64: remove CONFIG_SET_FS support
uaccess: drop maining CONFIG_SET_FS users

 arch/Kconfig                              |  10 +-
 arch/alpha/Kconfig                        |   1 -
 arch/alpha/include/asm/processor.h        |   4 -
 arch/alpha/include/asm/thread_info.h      |   2 -
 arch/alpha/include/asm/uaccess.h          |  53 +---------
 arch/arc/Kconfig                          |   1 -
 arch/arc/include/asm/segment.h            |  20 ----
 arch/arc/include/asm/thread_info.h        |   3 -
 arch/arc/include/asm/uaccess.h            |  30 ------
 arch/arc/kernel/process.c                 |   2 +-
 arch/arm/include/asm/uaccess.h            |  22 +---
 arch/arm/kernel/swp_emulate.c             |   2 +-
 arch/arm/kernel/traps.c                   |   2 +-
 arch/arm/lib/uaccess_with_memcpy.c        |  10 --
 arch/arm64/include/asm/uaccess.h          |  29 +-----
 arch/csky/Kconfig                         |   1 -
 arch/csky/include/asm/processor.h         |   2 -
 arch/csky/include/asm/segment.h           |  10 --
 arch/csky/include/asm/thread_info.h       |   2 -
 arch/csky/include/asm/uaccess.h           |  12 ---
 arch/csky/kernel/asm-offsets.c            |   1 -
 arch/csky/kernel/signal.c                 |   2 +-
 arch/h8300/Kconfig                        |   1 -
 arch/h8300/include/asm/processor.h        |   1 -
 arch/h8300/include/asm/segment.h          |  40 --------
 arch/h8300/include/asm/thread_info.h      |   3 -
 arch/h8300/kernel/entry.S                 |   1 -
 arch/h8300/kernel/head_ram.S              |   1 -
 arch/h8300/mm/init.c                      |   6 --
 arch/h8300/mm/memory.c                    |   1 -
 arch/hexagon/Kconfig                      |   1 -
 arch/hexagon/include/asm/thread_info.h    |   6 --
 arch/hexagon/include/asm/uaccess.h        |  25 -----
 arch/hexagon/kernel/process.c             |   1 -
 arch/ia64/Kconfig                         |   1 -
 arch/ia64/include/asm/processor.h         |   4 -
 arch/ia64/include/asm/thread_info.h       |   2 -
 arch/ia64/include/asm/uaccess.h           |  26 ++---
 arch/ia64/kernel/unaligned.c              |  60 +++++++----
 arch/m68k/Kconfig.cpu                     |   1 +
 arch/m68k/include/asm/uaccess.h           |  14 +--
 arch/microblaze/Kconfig                   |   1 -
 arch/microblaze/include/asm/thread_info.h |   6 --
 arch/microblaze/include/asm/uaccess.h     |  61 ++---------
 arch/microblaze/kernel/asm-offsets.c      |   1 -
 arch/microblaze/kernel/process.c          |   1 -
 arch/mips/include/asm/uaccess.h           |  49 +--------
 arch/mips/sibyte/common/sb_tbprof.c       |   6 +-
 arch/nds32/Kconfig                        |   1 -
 arch/nds32/include/asm/thread_info.h      |   4 -
 arch/nds32/include/asm/uaccess.h          |  40 ++++----
 arch/nds32/kernel/process.c               |   5 +-
 arch/nds32/mm/alignment.c                 |   3 -
 arch/nios2/Kconfig                        |   1 -
 arch/nios2/include/asm/thread_info.h      |   9 --
 arch/nios2/include/asm/uaccess.h          | 105 +++++++++----------
 arch/nios2/kernel/signal.c                |  20 ++--
 arch/openrisc/Kconfig                     |   1 -
 arch/openrisc/include/asm/thread_info.h   |   7 --
 arch/openrisc/include/asm/uaccess.h       |  42 +-------
 arch/parisc/Kconfig                       |   1 +
 arch/parisc/include/asm/futex.h           |   6 --
 arch/parisc/include/asm/uaccess.h         |  13 +--
 arch/parisc/lib/memcpy.c                  |   2 +-
 arch/powerpc/include/asm/uaccess.h        |  13 +--
 arch/powerpc/lib/sstep.c                  |   4 +-
 arch/riscv/include/asm/uaccess.h          |  33 +-----
 arch/riscv/kernel/perf_callchain.c        |   2 +-
 arch/s390/Kconfig                         |   1 +
 arch/s390/include/asm/uaccess.h           |  16 +--
 arch/sh/Kconfig                           |   1 -
 arch/sh/include/asm/processor.h           |   1 -
 arch/sh/include/asm/segment.h             |  33 ------
 arch/sh/include/asm/thread_info.h         |   2 -
 arch/sh/include/asm/uaccess.h             |  24 +----
 arch/sh/kernel/io_trapped.c               |   9 +-
 arch/sh/kernel/process_32.c               |   2 -
 arch/sh/kernel/traps_32.c                 |  30 ++++--
 arch/sparc/Kconfig                        |   3 +-
 arch/sparc/include/asm/processor_32.h     |   6 --
 arch/sparc/include/asm/processor_64.h     |   4 -
 arch/sparc/include/asm/switch_to_64.h     |   4 +-
 arch/sparc/include/asm/thread_info_64.h   |   4 +-
 arch/sparc/include/asm/uaccess.h          |   3 -
 arch/sparc/include/asm/uaccess_32.h       |  31 +-----
 arch/sparc/include/asm/uaccess_64.h       | 113 +++++++++++++-------
 arch/sparc/kernel/process_32.c            |   2 -
 arch/sparc/kernel/process_64.c            |  12 ---
 arch/sparc/kernel/signal_32.c             |   2 +-
 arch/sparc/kernel/traps_64.c              |   2 -
 arch/sparc/lib/NGmemcpy.S                 |   3 +-
 arch/sparc/mm/init_64.c                   |   7 +-
 arch/um/include/asm/uaccess.h             |   7 +-
 arch/x86/events/core.c                    |   2 +-
 arch/x86/include/asm/uaccess.h            |  35 +------
 arch/x86/kernel/dumpstack.c               |   2 +-
 arch/x86/kernel/stacktrace.c              |   2 +-
 arch/x86/lib/usercopy.c                   |   2 +-
 arch/xtensa/Kconfig                       |   1 -
 arch/xtensa/include/asm/asm-uaccess.h     |  71 -------------
 arch/xtensa/include/asm/processor.h       |   7 --
 arch/xtensa/include/asm/thread_info.h     |   3 -
 arch/xtensa/include/asm/uaccess.h         |  26 +----
 arch/xtensa/kernel/asm-offsets.c          |   3 -
 drivers/hid/uhid.c                        |   2 +-
 drivers/scsi/sg.c                         |   5 -
 fs/exec.c                                 |   6 --
 include/asm-generic/access_ok.h           |  51 ++++++++++
 include/asm-generic/uaccess.h             |  46 +--------
 include/linux/syscalls.h                  |   4 -
 include/linux/uaccess.h                   |  59 ++++-------
 include/rdma/ib.h                         |   2 +-
 kernel/events/callchain.c                 |   4 -
 kernel/events/core.c                      |   3 -
 kernel/exit.c                             |  14 ---
 kernel/kthread.c                          |   5 -
 kernel/stacktrace.c                       |   3 -
 kernel/trace/bpf_trace.c                  |   4 -
 lib/test_lockup.c                         |  11 +-
 mm/maccess.c                              | 119 ----------------------
 mm/memory.c                               |   8 --
 net/bpfilter/bpfilter_kern.c              |   2 +-
 122 files changed, 387 insertions(+), 1290 deletions(-)
 delete mode 100644 arch/arc/include/asm/segment.h
 delete mode 100644 arch/csky/include/asm/segment.h
 delete mode 100644 arch/h8300/include/asm/segment.h
 delete mode 100644 arch/sh/include/asm/segment.h
 create mode 100644 include/asm-generic/access_ok.h
Signature · 47 lines
2.29.2

Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]