openrisc: remove CONFIG_SET_FS
Stafford Horne
maintainerPATCH 1/1 openrisc: remove CONFIG_SET_FS
Remove the address space override API set_fs() used for User Mode Linux. User address space is now limited to TASK_SIZE.
To support this we implement and wire in __get_kernel_nofault and __set_kernel_nofault.
The function user_addr_max is removed as there is a default definition provided when CONFIG_SET_FS is not used.
--- arch/openrisc/Kconfig | 1 - arch/openrisc/include/asm/thread_info.h | 7 ---- arch/openrisc/include/asm/uaccess.h | 48 +++++++++++-------------- 3 files changed, 20 insertions(+), 36 deletions(-)
arch/openrisc/Kconfig +0 -1
@@ -36,7 +36,6 @@ config OPENRISC select ARCH_WANT_FRAME_POINTERS select GENERIC_IRQ_MULTI_HANDLER select MMU_GATHER_NO_RANGE if MMU - select SET_FS select TRACE_IRQFLAGS_SUPPORT config CPU_BIG_ENDIAN
arch/openrisc/include/asm/thread_info.h +0 -7
@@ -40,18 +40,12 @@*/ #ifndef __ASSEMBLY__ -typedef unsigned long mm_segment_t; - struct thread_info { struct task_struct *task; /* main task structure */ unsigned long flags; /* low level flags */ __u32 cpu; /* current CPU */ __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ - mm_segment_t addr_limit; /* thread address space: - 0-0x7FFFFFFF for user-thead - 0-0xFFFFFFFF for kernel-thread - */ __u8 supervisor_stack[0]; /* saved context data */
@@ -71,7 +65,6 @@ struct thread_info { .flags = 0, \ .cpu = 0, \ .preempt_count = INIT_PREEMPT_COUNT, \ - .addr_limit = KERNEL_DS, \ .ksp = 0, \ }
arch/openrisc/include/asm/uaccess.h +20 -28
71 lines not on this page · raw message
Signature · 1 line
2.31.1
Hi Stafford,
Thanks for your patch!
Quoted 1 line · Stafford Horne
Remove the address space override API
set_fs()used for User Mode Linux.
Note: this doesn't have anything to do with UML...
Quoted 9 lines
User address space is now limited to
TASK_SIZE.To support this we implement and wire in
__get_kernel_nofaultand__set_kernel_nofault.The function
user_addr_maxis removed as there is a default definition provided whenCONFIG_SET_FSis not used.Signed-off-by Stafford Horne <[email protected]>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Stafford Horne
maintainerH Geert,
Thanks for looking after it.
Quoted 8 lines · Geert Uytterhoeven
Hi Stafford,
Thanks for your patch!
Quoted 1 line · Stafford Horne
Remove the address space override API
set_fs()used for User Mode Linux.Note: this doesn't have anything to do with UML...
Yes, I agree for UML, I was actually following the text from Christoph's patch here:
https://lore.kernel.org/lkml/20211215165612.554426-1-hch at lst.de/T/#m439e32b3ecc8404424d2d8115d49fbf27c6393e9
The wording 'User Mode Linux' was perculiar. Maybe I should remove the misleading text and just say:
Remove the address space override API set_fs().
-Stafford
Quoted 9 lines
Quoted 9 lines
User address space is now limited to
TASK_SIZE.To support this we implement and wire in
__get_kernel_nofaultand__set_kernel_nofault.The function
user_addr_maxis removed as there is a default definition provided whenCONFIG_SET_FSis not used.Signed-off-by Stafford Horne <[email protected]>
Quoted 1 line · Stafford Horne
Remove the address space override API
set_fs()used for User Mode Linux.
This ain't UML :)
arch/openrisc/include/asm/uaccess.h line 31
Quoted 1 line
arch/openrisc/include/asm/uaccess.h +1
-0+return size <=TASK_SIZE && addr <= (TASK_SIZE - size);
No need for the inner braces.
Stafford Horne
maintainerQuoted 4 lines · Christoph Hellwig
Quoted 1 line · Stafford Horne
Remove the address space override API
set_fs()used for User Mode Linux.This ain't UML :)
Yes, Geert also brought that up. As I mentioned there I took the text from your commit message in commit 8bb227ac34c0 ("um: remove set_fs").
I didn't realize arch/um is for User Model Linux, I always thought um was just some other processor! Next, I thought your comment 'used for User Mode Linux' was just referring to userpsace.
Now I get it!
I will fix this up in v2.
Quoted 3 lines
arch/openrisc/include/asm/uaccess.h line 31
Quoted 1 line
arch/openrisc/include/asm/uaccess.h +1
-0+return size <=TASK_SIZE && addr <= (TASK_SIZE - size);No need for the inner braces.
You mean to just write as:
return size <= TASK_SIZE && addr <= TASK_SIZE - size;
I prefer keeping the braces around (TASK_SIZE - size).
-Stafford
From: Christoph Hellwig
Quoted 10 lines
Sent: 07 February 2022 06:45
Quoted 1 line · Stafford Horne
Remove the address space override API
set_fs()used for User Mode Linux.This ain't UML :)
arch/openrisc/include/asm/uaccess.h line 31
Quoted 1 line
arch/openrisc/include/asm/uaccess.h +1
-0+return size <=TASK_SIZE && addr <= (TASK_SIZE - size);No need for the inner braces.
Since TASK_SIZE is actually an address wouldn't be better to swap the condition around (in every architecture).
return addr <= TASK_SIZE && size <= TASK_SIZE - addr; David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Stafford Horne
maintainerQuoted 8 lines · David Laight
From: Christoph Hellwig
Quoted 7 lines
Sent: 07 February 2022 06:45
Quoted 1 line · Stafford Horne
Remove the address space override API
set_fs()used for User Mode Linux.This ain't UML :)
Quoted 8 lines
Quoted 3 lines
arch/openrisc/include/asm/uaccess.h line 31
Quoted 1 line
arch/openrisc/include/asm/uaccess.h +1
-0+return size <=TASK_SIZE && addr <= (TASK_SIZE - size);No need for the inner braces.
Since
TASK_SIZEis actually an address wouldn't be better to swap the condition around (in every architecture).return addr <= TASK_SIZE && size <= TASK_SIZE - addr;
Hi David,
I like that, it is more clear, I will update to that in v3.
-Stafford