2021-04-01 18:48:14

by Thomas Bogendoerfer

[permalink] [raw]
Subject: [PATCH v3 0/4] MIPS: Remove get_fs/set_fs

This series replaces get_fs/set_fs and removes it from MIPS arch code.

Changes in v3:
- use get_user/get_kernel_nofault for helper functions

Changes in v2:
- added copy_from_kernel_nofault_allowed() for !EVA to restrict
access of __get/__put_kernel_nofault
- replaced __get_data macro by helper functions
- removed leftover set_fs calls in ftrace.c
- further cleanup uaccess.h

Thomas Bogendoerfer (4):
MIPS: kernel: Remove not needed set_fs calls
MIPS: uaccess: Added __get/__put_kernel_nofault
MIPS: uaccess: Remove get_fs/set_fs call sites
MIPS: Remove get_fs/set_fs

arch/mips/Kconfig | 1 -
arch/mips/include/asm/processor.h | 4 -
arch/mips/include/asm/thread_info.h | 6 -
arch/mips/include/asm/uaccess.h | 436 +++++++++++-----------------
arch/mips/kernel/access-helper.h | 18 ++
arch/mips/kernel/asm-offsets.c | 1 -
arch/mips/kernel/ftrace.c | 8 -
arch/mips/kernel/process.c | 2 -
arch/mips/kernel/scall32-o32.S | 4 +-
arch/mips/kernel/traps.c | 105 +++----
arch/mips/kernel/unaligned.c | 199 +++++--------
arch/mips/lib/memcpy.S | 28 +-
arch/mips/lib/memset.S | 3 -
arch/mips/lib/strncpy_user.S | 48 +--
arch/mips/lib/strnlen_user.S | 44 +--
arch/mips/mm/Makefile | 4 +
arch/mips/mm/maccess.c | 10 +
17 files changed, 357 insertions(+), 564 deletions(-)
create mode 100644 arch/mips/kernel/access-helper.h
create mode 100644 arch/mips/mm/maccess.c

--
2.29.2


2021-04-06 16:40:37

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] MIPS: Remove get_fs/set_fs

Btw, there is a bunch of cleanups that would fit in nicely on top of
this:

- remove the unused __invoke_copy_from function
- fold __get_user_check into get_user as it is the only caller
- fold __get_user_nocheck into __get_user as it is the only caller
- fold __put_user_check into put_user as it is the only caller
- fold __put_user_nocheck into __put_user as it is the only caller
- implement get_user in terms of __get_user to document the difference
better and to remove __get_user_common
- implement put_user in terms of __put_user to document the difference
better and to remove __get_user_common
- remove __put_user_unknown/__get_user_unknown and replace them with
BUILD_BUG_ON()


On Thu, Apr 01, 2021 at 02:56:33PM +0200, Thomas Bogendoerfer wrote:
> This series replaces get_fs/set_fs and removes it from MIPS arch code.
>
> Changes in v3:
> - use get_user/get_kernel_nofault for helper functions
>
> Changes in v2:
> - added copy_from_kernel_nofault_allowed() for !EVA to restrict
> access of __get/__put_kernel_nofault
> - replaced __get_data macro by helper functions
> - removed leftover set_fs calls in ftrace.c
> - further cleanup uaccess.h
>
> Thomas Bogendoerfer (4):
> MIPS: kernel: Remove not needed set_fs calls
> MIPS: uaccess: Added __get/__put_kernel_nofault
> MIPS: uaccess: Remove get_fs/set_fs call sites
> MIPS: Remove get_fs/set_fs
>
> arch/mips/Kconfig | 1 -
> arch/mips/include/asm/processor.h | 4 -
> arch/mips/include/asm/thread_info.h | 6 -
> arch/mips/include/asm/uaccess.h | 436 +++++++++++-----------------
> arch/mips/kernel/access-helper.h | 18 ++
> arch/mips/kernel/asm-offsets.c | 1 -
> arch/mips/kernel/ftrace.c | 8 -
> arch/mips/kernel/process.c | 2 -
> arch/mips/kernel/scall32-o32.S | 4 +-
> arch/mips/kernel/traps.c | 105 +++----
> arch/mips/kernel/unaligned.c | 199 +++++--------
> arch/mips/lib/memcpy.S | 28 +-
> arch/mips/lib/memset.S | 3 -
> arch/mips/lib/strncpy_user.S | 48 +--
> arch/mips/lib/strnlen_user.S | 44 +--
> arch/mips/mm/Makefile | 4 +
> arch/mips/mm/maccess.c | 10 +
> 17 files changed, 357 insertions(+), 564 deletions(-)
> create mode 100644 arch/mips/kernel/access-helper.h
> create mode 100644 arch/mips/mm/maccess.c
>
> --
> 2.29.2
---end quoted text---

2021-04-07 03:04:23

by Thomas Bogendoerfer

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] MIPS: Remove get_fs/set_fs

On Tue, Apr 06, 2021 at 09:24:43AM +0200, Christoph Hellwig wrote:
> Btw, there is a bunch of cleanups that would fit in nicely on top of
> this:
>
> - remove the unused __invoke_copy_from function

I've removed in the last patch before applying to mips-next.

> - fold __get_user_check into get_user as it is the only caller
> - fold __get_user_nocheck into __get_user as it is the only caller
> - fold __put_user_check into put_user as it is the only caller
> - fold __put_user_nocheck into __put_user as it is the only caller
> - implement get_user in terms of __get_user to document the difference
> better and to remove __get_user_common
> - implement put_user in terms of __put_user to document the difference
> better and to remove __get_user_common
> - remove __put_user_unknown/__get_user_unknown and replace them with
> BUILD_BUG_ON()

I'll prepare a follow-up patch. Thank you for your cleanup hints.

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]

2021-04-07 03:04:24

by Thomas Bogendoerfer

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] MIPS: Remove get_fs/set_fs

On Thu, Apr 01, 2021 at 02:56:33PM +0200, Thomas Bogendoerfer wrote:
> This series replaces get_fs/set_fs and removes it from MIPS arch code.
>
> Changes in v3:
> - use get_user/get_kernel_nofault for helper functions
>
> Changes in v2:
> - added copy_from_kernel_nofault_allowed() for !EVA to restrict
> access of __get/__put_kernel_nofault
> - replaced __get_data macro by helper functions
> - removed leftover set_fs calls in ftrace.c
> - further cleanup uaccess.h
>
> Thomas Bogendoerfer (4):
> MIPS: kernel: Remove not needed set_fs calls
> MIPS: uaccess: Added __get/__put_kernel_nofault
> MIPS: uaccess: Remove get_fs/set_fs call sites
> MIPS: Remove get_fs/set_fs
>
> arch/mips/Kconfig | 1 -
> arch/mips/include/asm/processor.h | 4 -
> arch/mips/include/asm/thread_info.h | 6 -
> arch/mips/include/asm/uaccess.h | 436 +++++++++++-----------------
> arch/mips/kernel/access-helper.h | 18 ++
> arch/mips/kernel/asm-offsets.c | 1 -
> arch/mips/kernel/ftrace.c | 8 -
> arch/mips/kernel/process.c | 2 -
> arch/mips/kernel/scall32-o32.S | 4 +-
> arch/mips/kernel/traps.c | 105 +++----
> arch/mips/kernel/unaligned.c | 199 +++++--------
> arch/mips/lib/memcpy.S | 28 +-
> arch/mips/lib/memset.S | 3 -
> arch/mips/lib/strncpy_user.S | 48 +--
> arch/mips/lib/strnlen_user.S | 44 +--
> arch/mips/mm/Makefile | 4 +
> arch/mips/mm/maccess.c | 10 +
> 17 files changed, 357 insertions(+), 564 deletions(-)
> create mode 100644 arch/mips/kernel/access-helper.h
> create mode 100644 arch/mips/mm/maccess.c

series applied to mips-next.

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]