Skip to contentSkip to conversation

openrisc: remove CONFIG_SET_FS

PATCH Superseded Stafford Horne 4 participants 7 messages Feb 6, 2022 – Feb 8, 2022 Openrisc architecture

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Stafford Horne

author maintainer
#0 lore raw

PATCH 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
index bf047dca7ec6..ceda77fb8bc8 100644
@@ -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
index 659834ab87fa..4af3049c34c2 100644
@@ -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
#1 lore raw

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_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.

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

author maintainer
#2 lore raw

H 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_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.

#3 lore raw
In reply to Stafford Horne
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.

author maintainer
#4 lore raw
Quoted 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

#5 lore raw
In reply to Christoph Hellwig

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)

author maintainer
#6 lore raw
Quoted 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_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;

Hi David,

I like that, it is more clear, I will update to that in v3.

-Stafford