linux-um archives
 help / color / mirror / Atom feed
* [PATCH 0/7] um: A follow-up series of -Wmissing-prototypes fixes
@ 2024-04-23 11:24 Tiwei Bie
  2024-04-23 11:24 ` [PATCH 1/7] um: Fix -Wmissing-prototypes warnings for (rt_)sigreturn Tiwei Bie
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Tiwei Bie @ 2024-04-23 11:24 UTC (permalink / raw)
  To: richard, anton.ivanov, johannes; +Cc: linux-um, linux-kernel, Tiwei Bie

This is a follow-up series built on top of below series:
https://lore.kernel.org/linux-um/20240306101925.1088870-1-tiwei.btw@antgroup.com/

Tiwei Bie (7):
  um: Fix -Wmissing-prototypes warnings for (rt_)sigreturn
  um: Fix the -Wmissing-prototypes warning for __switch_mm
  um: Fix the -Wmissing-prototypes warning for get_thread_reg
  um: Fix the declaration of kasan_map_memory
  um: Add an internal header shared among the user code
  um: Fix -Wmissing-prototypes warnings for __vdso_*
  um: Remove unused do_get_thread_area function

 arch/um/include/asm/kasan.h             |  1 -
 arch/um/include/asm/mmu.h               |  2 --
 arch/um/include/asm/processor-generic.h |  1 -
 arch/um/include/shared/kern_util.h      |  2 ++
 arch/um/include/shared/skas/mm_id.h     |  2 ++
 arch/um/os-Linux/internal.h             | 20 ++++++++++++++++++++
 arch/um/os-Linux/main.c                 |  2 --
 arch/um/os-Linux/mem.c                  |  1 +
 arch/um/os-Linux/skas/mem.c             |  2 --
 arch/um/os-Linux/start_up.c             |  2 --
 arch/um/scripts/Makefile.rules          |  3 ++-
 arch/x86/um/shared/sysdep/archsetjmp.h  |  7 +++++++
 arch/x86/um/signal.c                    |  5 +++--
 arch/x86/um/tls_32.c                    | 17 -----------------
 arch/x86/um/vdso/um_vdso.c              | 10 ++++++++--
 15 files changed, 45 insertions(+), 32 deletions(-)
 create mode 100644 arch/um/os-Linux/internal.h

-- 
2.34.1



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/7] um: Fix -Wmissing-prototypes warnings for (rt_)sigreturn
  2024-04-23 11:24 [PATCH 0/7] um: A follow-up series of -Wmissing-prototypes fixes Tiwei Bie
@ 2024-04-23 11:24 ` Tiwei Bie
  2024-04-23 11:24 ` [PATCH 2/7] um: Fix the -Wmissing-prototypes warning for __switch_mm Tiwei Bie
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Tiwei Bie @ 2024-04-23 11:24 UTC (permalink / raw)
  To: richard, anton.ivanov, johannes; +Cc: linux-um, linux-kernel, Tiwei Bie

Use SYSCALL_DEFINE0 to define (rt_)sigreturn. This will address
below -Wmissing-prototypes warnings:

arch/x86/um/signal.c:453:6: warning: no previous prototype for ‘sys_sigreturn’ [-Wmissing-prototypes]
arch/x86/um/signal.c:560:6: warning: no previous prototype for ‘sys_rt_sigreturn’ [-Wmissing-prototypes]

Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
---
 arch/x86/um/signal.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/um/signal.c b/arch/x86/um/signal.c
index 263e1d08f216..48e87b45adba 100644
--- a/arch/x86/um/signal.c
+++ b/arch/x86/um/signal.c
@@ -8,6 +8,7 @@
 #include <linux/personality.h>
 #include <linux/ptrace.h>
 #include <linux/kernel.h>
+#include <linux/syscalls.h>
 #include <asm/unistd.h>
 #include <linux/uaccess.h>
 #include <asm/ucontext.h>
@@ -450,7 +451,7 @@ int setup_signal_stack_si(unsigned long stack_top, struct ksignal *ksig,
 	return 0;
 }
 
-long sys_sigreturn(void)
+SYSCALL_DEFINE0(sigreturn)
 {
 	unsigned long sp = PT_REGS_SP(&current->thread.regs);
 	struct sigframe __user *frame = (struct sigframe __user *)(sp - 8);
@@ -557,7 +558,7 @@ int setup_signal_stack_si(unsigned long stack_top, struct ksignal *ksig,
 }
 #endif
 
-long sys_rt_sigreturn(void)
+SYSCALL_DEFINE0(rt_sigreturn)
 {
 	unsigned long sp = PT_REGS_SP(&current->thread.regs);
 	struct rt_sigframe __user *frame =
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 2/7] um: Fix the -Wmissing-prototypes warning for __switch_mm
  2024-04-23 11:24 [PATCH 0/7] um: A follow-up series of -Wmissing-prototypes fixes Tiwei Bie
  2024-04-23 11:24 ` [PATCH 1/7] um: Fix -Wmissing-prototypes warnings for (rt_)sigreturn Tiwei Bie
@ 2024-04-23 11:24 ` Tiwei Bie
  2024-04-23 11:29   ` Johannes Berg
  2024-04-23 11:24 ` [PATCH 3/7] um: Fix the -Wmissing-prototypes warning for get_thread_reg Tiwei Bie
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Tiwei Bie @ 2024-04-23 11:24 UTC (permalink / raw)
  To: richard, anton.ivanov, johannes; +Cc: linux-um, linux-kernel, Tiwei Bie

The __switch_mm function is defined in the user code, and is called
by the kernel code. It should be declared in a shared header.

Fixes: 4dc706c2f292 ("um: take um_mmu.h to asm/mmu.h, clean asm/mmu_context.h a bit")
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
---
 arch/um/include/asm/mmu.h           | 2 --
 arch/um/include/shared/skas/mm_id.h | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/um/include/asm/mmu.h b/arch/um/include/asm/mmu.h
index a7555e43ed14..f2923c767bb9 100644
--- a/arch/um/include/asm/mmu.h
+++ b/arch/um/include/asm/mmu.h
@@ -14,8 +14,6 @@ typedef struct mm_context {
 	struct uml_arch_mm_context arch;
 } mm_context_t;
 
-extern void __switch_mm(struct mm_id * mm_idp);
-
 /* Avoid tangled inclusion with asm/ldt.h */
 extern long init_new_ldt(struct mm_context *to_mm, struct mm_context *from_mm);
 extern void free_ldt(struct mm_context *mm);
diff --git a/arch/um/include/shared/skas/mm_id.h b/arch/um/include/shared/skas/mm_id.h
index e82e203f5f41..bdfab67174ff 100644
--- a/arch/um/include/shared/skas/mm_id.h
+++ b/arch/um/include/shared/skas/mm_id.h
@@ -15,4 +15,6 @@ struct mm_id {
 	int kill;
 };
 
+extern void __switch_mm(struct mm_id *mm_idp);
+
 #endif
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 3/7] um: Fix the -Wmissing-prototypes warning for get_thread_reg
  2024-04-23 11:24 [PATCH 0/7] um: A follow-up series of -Wmissing-prototypes fixes Tiwei Bie
  2024-04-23 11:24 ` [PATCH 1/7] um: Fix -Wmissing-prototypes warnings for (rt_)sigreturn Tiwei Bie
  2024-04-23 11:24 ` [PATCH 2/7] um: Fix the -Wmissing-prototypes warning for __switch_mm Tiwei Bie
@ 2024-04-23 11:24 ` Tiwei Bie
  2024-04-23 11:30   ` Johannes Berg
  2024-04-23 11:24 ` [PATCH 4/7] um: Fix the declaration of kasan_map_memory Tiwei Bie
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Tiwei Bie @ 2024-04-23 11:24 UTC (permalink / raw)
  To: richard, anton.ivanov, johannes; +Cc: linux-um, linux-kernel, Tiwei Bie

The get_thread_reg function is defined in the user code, and is
called by the kernel code. It should be declared in a shared header.

Fixes: dbba7f704aa0 ("um: stop polluting the namespace with registers.h contents")
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
---
 arch/um/include/asm/processor-generic.h | 1 -
 arch/x86/um/shared/sysdep/archsetjmp.h  | 7 +++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h
index 6c3779541845..5a7c05275aa7 100644
--- a/arch/um/include/asm/processor-generic.h
+++ b/arch/um/include/asm/processor-generic.h
@@ -94,7 +94,6 @@ extern struct cpuinfo_um boot_cpu_data;
 #define current_cpu_data boot_cpu_data
 #define cache_line_size()	(boot_cpu_data.cache_alignment)
 
-extern unsigned long get_thread_reg(int reg, jmp_buf *buf);
 #define KSTK_REG(tsk, reg) get_thread_reg(reg, &tsk->thread.switch_buf)
 extern unsigned long __get_wchan(struct task_struct *p);
 
diff --git a/arch/x86/um/shared/sysdep/archsetjmp.h b/arch/x86/um/shared/sysdep/archsetjmp.h
index 166cedbab926..15a75e01ce30 100644
--- a/arch/x86/um/shared/sysdep/archsetjmp.h
+++ b/arch/x86/um/shared/sysdep/archsetjmp.h
@@ -1,6 +1,13 @@
 /* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __X86_UM_SYSDEP_ARCHSETJMP_H
+#define __X86_UM_SYSDEP_ARCHSETJMP_H
+
 #ifdef __i386__
 #include "archsetjmp_32.h"
 #else
 #include "archsetjmp_64.h"
 #endif
+
+extern unsigned long get_thread_reg(int reg, jmp_buf *buf);
+
+#endif /* __X86_UM_SYSDEP_ARCHSETJMP_H */
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 4/7] um: Fix the declaration of kasan_map_memory
  2024-04-23 11:24 [PATCH 0/7] um: A follow-up series of -Wmissing-prototypes fixes Tiwei Bie
                   ` (2 preceding siblings ...)
  2024-04-23 11:24 ` [PATCH 3/7] um: Fix the -Wmissing-prototypes warning for get_thread_reg Tiwei Bie
@ 2024-04-23 11:24 ` Tiwei Bie
  2024-04-23 11:24 ` [PATCH 5/7] um: Add an internal header shared among the user code Tiwei Bie
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Tiwei Bie @ 2024-04-23 11:24 UTC (permalink / raw)
  To: richard, anton.ivanov, johannes; +Cc: linux-um, linux-kernel, Tiwei Bie

Make it match its definition (size_t vs unsigned long). And declare
it in a shared header to fix the -Wmissing-prototypes warning, as it
is defined in the user code and called in the kernel code.

Fixes: 5b301409e8bc ("UML: add support for KASAN under x86_64")
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
---
 arch/um/include/asm/kasan.h        | 1 -
 arch/um/include/shared/kern_util.h | 2 ++
 arch/um/os-Linux/mem.c             | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/um/include/asm/kasan.h b/arch/um/include/asm/kasan.h
index 0d6547f4ec85..f97bb1f7b851 100644
--- a/arch/um/include/asm/kasan.h
+++ b/arch/um/include/asm/kasan.h
@@ -24,7 +24,6 @@
 
 #ifdef CONFIG_KASAN
 void kasan_init(void);
-void kasan_map_memory(void *start, unsigned long len);
 extern int kasan_um_is_ready;
 
 #ifdef CONFIG_STATIC_LINK
diff --git a/arch/um/include/shared/kern_util.h b/arch/um/include/shared/kern_util.h
index 81bc38a2e3fc..1fa03499e1dc 100644
--- a/arch/um/include/shared/kern_util.h
+++ b/arch/um/include/shared/kern_util.h
@@ -37,6 +37,8 @@ extern void initial_thread_cb(void (*proc)(void *), void *arg);
 
 extern void timer_handler(int sig, struct siginfo *unused_si, struct uml_pt_regs *regs);
 
+extern void kasan_map_memory(void *start, size_t len);
+
 extern void uml_pm_wake(void);
 
 extern int start_uml(void);
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c
index 8530b2e08604..c6c9495b1432 100644
--- a/arch/um/os-Linux/mem.c
+++ b/arch/um/os-Linux/mem.c
@@ -15,6 +15,7 @@
 #include <sys/vfs.h>
 #include <linux/magic.h>
 #include <init.h>
+#include <kern_util.h>
 #include <os.h>
 
 /*
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 5/7] um: Add an internal header shared among the user code
  2024-04-23 11:24 [PATCH 0/7] um: A follow-up series of -Wmissing-prototypes fixes Tiwei Bie
                   ` (3 preceding siblings ...)
  2024-04-23 11:24 ` [PATCH 4/7] um: Fix the declaration of kasan_map_memory Tiwei Bie
@ 2024-04-23 11:24 ` Tiwei Bie
  2024-04-23 11:30   ` Johannes Berg
  2024-04-23 11:24 ` [PATCH 6/7] um: Fix -Wmissing-prototypes warnings for __vdso_* Tiwei Bie
  2024-04-23 11:24 ` [PATCH 7/7] um: Remove unused do_get_thread_area function Tiwei Bie
  6 siblings, 1 reply; 15+ messages in thread
From: Tiwei Bie @ 2024-04-23 11:24 UTC (permalink / raw)
  To: richard, anton.ivanov, johannes; +Cc: linux-um, linux-kernel, Tiwei Bie

Move relevant declarations to this header. This will address
below -Wmissing-prototypes warnings:

arch/um/os-Linux/elf_aux.c:26:13: warning: no previous prototype for ‘scan_elf_aux’ [-Wmissing-prototypes]
arch/um/os-Linux/mem.c:213:13: warning: no previous prototype for ‘check_tmpexec’ [-Wmissing-prototypes]
arch/um/os-Linux/skas/process.c:107:6: warning: no previous prototype for ‘wait_stub_done’ [-Wmissing-prototypes]

Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
---
 arch/um/os-Linux/internal.h    | 20 ++++++++++++++++++++
 arch/um/os-Linux/main.c        |  2 --
 arch/um/os-Linux/skas/mem.c    |  2 --
 arch/um/os-Linux/start_up.c    |  2 --
 arch/um/scripts/Makefile.rules |  3 ++-
 5 files changed, 22 insertions(+), 7 deletions(-)
 create mode 100644 arch/um/os-Linux/internal.h

diff --git a/arch/um/os-Linux/internal.h b/arch/um/os-Linux/internal.h
new file mode 100644
index 000000000000..2a0ea7853658
--- /dev/null
+++ b/arch/um/os-Linux/internal.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __UM_OS_LINUX_INTERNAL_H
+#define __UM_OS_LINUX_INTERNAL_H
+
+/*
+ * elf_aux.c
+ */
+extern void scan_elf_aux(char **envp);
+
+/*
+ * mem.c
+ */
+extern void check_tmpexec(void);
+
+/*
+ * skas/process.c
+ */
+extern void wait_stub_done(int pid);
+
+#endif /* __UM_OS_LINUX_INTERNAL_H */
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
index e82164f90288..9880cfcb9b8a 100644
--- a/arch/um/os-Linux/main.c
+++ b/arch/um/os-Linux/main.c
@@ -102,8 +102,6 @@ static void setup_env_path(void)
 	}
 }
 
-extern void scan_elf_aux( char **envp);
-
 int __init main(int argc, char **argv, char **envp)
 {
 	char **new_argv;
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c
index 953fb10f3f93..1b0502fb5c75 100644
--- a/arch/um/os-Linux/skas/mem.c
+++ b/arch/um/os-Linux/skas/mem.c
@@ -20,8 +20,6 @@
 
 extern char batch_syscall_stub[], __syscall_stub_start[];
 
-extern void wait_stub_done(int pid);
-
 static inline unsigned long *check_init_stack(struct mm_id * mm_idp,
 					      unsigned long *stack)
 {
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index 6b21061c431c..f920c837428e 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -222,8 +222,6 @@ static void __init check_ptrace(void)
 	check_sysemu();
 }
 
-extern void check_tmpexec(void);
-
 static void __init check_coredump_limit(void)
 {
 	struct rlimit lim;
diff --git a/arch/um/scripts/Makefile.rules b/arch/um/scripts/Makefile.rules
index a8b7d9dab0a6..b8ea5f3bb1fb 100644
--- a/arch/um/scripts/Makefile.rules
+++ b/arch/um/scripts/Makefile.rules
@@ -9,7 +9,8 @@ USER_OBJS += $(filter %_user.o,$(obj-y) $(USER_SINGLE_OBJS))
 USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))
 
 $(USER_OBJS:.o=.%): \
-	c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) -include $(srctree)/include/linux/kern_levels.h -include user.h $(CFLAGS_$(basetarget).o)
+	c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) -include $(srctree)/include/linux/kern_levels.h \
+		-include user.h -include $(srctree)/arch/um/os-Linux/internal.h $(CFLAGS_$(basetarget).o)
 
 # These are like USER_OBJS but filter USER_CFLAGS through unprofile instead of
 # using it directly.
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 6/7] um: Fix -Wmissing-prototypes warnings for __vdso_*
  2024-04-23 11:24 [PATCH 0/7] um: A follow-up series of -Wmissing-prototypes fixes Tiwei Bie
                   ` (4 preceding siblings ...)
  2024-04-23 11:24 ` [PATCH 5/7] um: Add an internal header shared among the user code Tiwei Bie
@ 2024-04-23 11:24 ` Tiwei Bie
  2024-04-23 11:24 ` [PATCH 7/7] um: Remove unused do_get_thread_area function Tiwei Bie
  6 siblings, 0 replies; 15+ messages in thread
From: Tiwei Bie @ 2024-04-23 11:24 UTC (permalink / raw)
  To: richard, anton.ivanov, johannes; +Cc: linux-um, linux-kernel, Tiwei Bie

The VDSO functions are defined as globals and intended to be called
from userspace. Let's just workaround the -Wmissing-prototypes warnings
by declaring them locally.

This will address below -Wmissing-prototypes warnings:

arch/x86/um/vdso/um_vdso.c:16:5: warning: no previous prototype for ‘__vdso_clock_gettime’ [-Wmissing-prototypes]
arch/x86/um/vdso/um_vdso.c:30:5: warning: no previous prototype for ‘__vdso_gettimeofday’ [-Wmissing-prototypes]
arch/x86/um/vdso/um_vdso.c:44:21: warning: no previous prototype for ‘__vdso_time’ [-Wmissing-prototypes]
arch/x86/um/vdso/um_vdso.c:57:1: warning: no previous prototype for ‘__vdso_getcpu’ [-Wmissing-prototypes]

Meanwhile, also fix the "WARNING: Prefer 'unsigned int *' to bare use
of 'unsigned *'" checkpatch warning.

Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
---
 arch/x86/um/vdso/um_vdso.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/x86/um/vdso/um_vdso.c b/arch/x86/um/vdso/um_vdso.c
index ff0f3b4b6c45..cbae2584124f 100644
--- a/arch/x86/um/vdso/um_vdso.c
+++ b/arch/x86/um/vdso/um_vdso.c
@@ -13,6 +13,12 @@
 #include <linux/getcpu.h>
 #include <asm/unistd.h>
 
+/* workaround for -Wmissing-prototypes warnings */
+int __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts);
+int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz);
+__kernel_old_time_t __vdso_time(__kernel_old_time_t *t);
+long __vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *unused);
+
 int __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts)
 {
 	long ret;
@@ -54,7 +60,7 @@ __kernel_old_time_t __vdso_time(__kernel_old_time_t *t)
 __kernel_old_time_t time(__kernel_old_time_t *t) __attribute__((weak, alias("__vdso_time")));
 
 long
-__vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
+__vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *unused)
 {
 	/*
 	 * UML does not support SMP, we can cheat here. :)
@@ -68,5 +74,5 @@ __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
 	return 0;
 }
 
-long getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
+long getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *tcache)
 	__attribute__((weak, alias("__vdso_getcpu")));
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 7/7] um: Remove unused do_get_thread_area function
  2024-04-23 11:24 [PATCH 0/7] um: A follow-up series of -Wmissing-prototypes fixes Tiwei Bie
                   ` (5 preceding siblings ...)
  2024-04-23 11:24 ` [PATCH 6/7] um: Fix -Wmissing-prototypes warnings for __vdso_* Tiwei Bie
@ 2024-04-23 11:24 ` Tiwei Bie
  6 siblings, 0 replies; 15+ messages in thread
From: Tiwei Bie @ 2024-04-23 11:24 UTC (permalink / raw)
  To: richard, anton.ivanov, johannes; +Cc: linux-um, linux-kernel, Tiwei Bie

It's not used since it was introduced by commit aa6758d4867c ("[PATCH]
uml: implement {get,set}_thread_area for i386"). Now, it's causing a
-Wmissing-prototypes warning:

arch/x86/um/tls_32.c:39:5: warning: no previous prototype for ‘do_get_thread_area’ [-Wmissing-prototypes]
   39 | int do_get_thread_area(struct user_desc *info)
      |     ^~~~~~~~~~~~~~~~~~

The original author also had doubts about whether it should be used.
Considering that 18 years have passed, let's just remove it.

Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
---
 arch/x86/um/tls_32.c | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/arch/x86/um/tls_32.c b/arch/x86/um/tls_32.c
index ba40b1b8e179..d301deee041f 100644
--- a/arch/x86/um/tls_32.c
+++ b/arch/x86/um/tls_32.c
@@ -36,22 +36,6 @@ static int do_set_thread_area(struct user_desc *info)
 	return ret;
 }
 
-int do_get_thread_area(struct user_desc *info)
-{
-	int ret;
-	u32 cpu;
-
-	cpu = get_cpu();
-	ret = os_get_thread_area(info, userspace_pid[cpu]);
-	put_cpu();
-
-	if (ret)
-		printk(KERN_ERR "PTRACE_GET_THREAD_AREA failed, err = %d, "
-		       "index = %d\n", ret, info->entry_number);
-
-	return ret;
-}
-
 /*
  * sys_get_thread_area: get a yet unused TLS descriptor index.
  * XXX: Consider leaving one free slot for glibc usage at first place. This must
@@ -231,7 +215,6 @@ int arch_set_tls(struct task_struct *new, unsigned long tls)
 	return ret;
 }
 
-/* XXX: use do_get_thread_area to read the host value? I'm not at all sure! */
 static int get_tls_entry(struct task_struct *task, struct user_desc *info,
 			 int idx)
 {
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/7] um: Fix the -Wmissing-prototypes warning for __switch_mm
  2024-04-23 11:24 ` [PATCH 2/7] um: Fix the -Wmissing-prototypes warning for __switch_mm Tiwei Bie
@ 2024-04-23 11:29   ` Johannes Berg
  2024-04-23 12:11     ` Tiwei Bie
  0 siblings, 1 reply; 15+ messages in thread
From: Johannes Berg @ 2024-04-23 11:29 UTC (permalink / raw)
  To: Tiwei Bie, richard, anton.ivanov; +Cc: linux-um, linux-kernel

On Tue, 2024-04-23 at 19:24 +0800, Tiwei Bie wrote:
> 
> --- a/arch/um/include/shared/skas/mm_id.h
> +++ b/arch/um/include/shared/skas/mm_id.h
> @@ -15,4 +15,6 @@ struct mm_id {
>  	int kill;
>  };
>  
> +extern void __switch_mm(struct mm_id *mm_idp);
> 

Maybe drop the extern while at it?

johannes


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/7] um: Fix the -Wmissing-prototypes warning for get_thread_reg
  2024-04-23 11:24 ` [PATCH 3/7] um: Fix the -Wmissing-prototypes warning for get_thread_reg Tiwei Bie
@ 2024-04-23 11:30   ` Johannes Berg
  0 siblings, 0 replies; 15+ messages in thread
From: Johannes Berg @ 2024-04-23 11:30 UTC (permalink / raw)
  To: Tiwei Bie, richard, anton.ivanov; +Cc: linux-um, linux-kernel

On Tue, 2024-04-23 at 19:24 +0800, Tiwei Bie wrote:
> 
> +extern unsigned long get_thread_reg(int reg, jmp_buf *buf);
> 

Like, in general :)

johannes


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 5/7] um: Add an internal header shared among the user code
  2024-04-23 11:24 ` [PATCH 5/7] um: Add an internal header shared among the user code Tiwei Bie
@ 2024-04-23 11:30   ` Johannes Berg
  2024-04-23 12:09     ` Tiwei Bie
  0 siblings, 1 reply; 15+ messages in thread
From: Johannes Berg @ 2024-04-23 11:30 UTC (permalink / raw)
  To: Tiwei Bie, richard, anton.ivanov; +Cc: linux-um, linux-kernel

On Tue, 2024-04-23 at 19:24 +0800, Tiwei Bie wrote:
> 
>  $(USER_OBJS:.o=.%): \
> -	c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) -include $(srctree)/include/linux/kern_levels.h -include user.h $(CFLAGS_$(basetarget).o)
> +	c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) -include $(srctree)/include/linux/kern_levels.h \
> +		-include user.h -include $(srctree)/arch/um/os-Linux/internal.h $(CFLAGS_$(basetarget).o)
> 

Why not just include it explicitly? We do have the warnings?

johannes


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 5/7] um: Add an internal header shared among the user code
  2024-04-23 11:30   ` Johannes Berg
@ 2024-04-23 12:09     ` Tiwei Bie
  2024-04-23 12:22       ` Johannes Berg
  0 siblings, 1 reply; 15+ messages in thread
From: Tiwei Bie @ 2024-04-23 12:09 UTC (permalink / raw)
  To: Johannes Berg, richard, anton.ivanov; +Cc: linux-um, linux-kernel

On 4/23/24 7:30 PM, Johannes Berg wrote:
> On Tue, 2024-04-23 at 19:24 +0800, Tiwei Bie wrote:
>>
>>  $(USER_OBJS:.o=.%): \
>> -	c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) -include $(srctree)/include/linux/kern_levels.h -include user.h $(CFLAGS_$(basetarget).o)
>> +	c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) -include $(srctree)/include/linux/kern_levels.h \
>> +		-include user.h -include $(srctree)/arch/um/os-Linux/internal.h $(CFLAGS_$(basetarget).o)
>>
> 
> Why not just include it explicitly?

I think it might be more convenient if we include it implicitly,
especially since there are two levels of directories under os-Linux/.
But I don't have a strong opinion on this. I'm also willing to
include it explicitly.

> We do have the warnings?

Yeah. Without this patch, I can get below warnings with `make ARCH=um defconfig && make ARCH=um`:

arch/um/os-Linux/skas/process.c:107:6: warning: no previous prototype for ‘wait_stub_done’ [-Wmissing-prototypes]
  107 | void wait_stub_done(int pid)
      |      ^~~~~~~~~~~~~~
arch/um/os-Linux/mem.c:213:13: warning: no previous prototype for ‘check_tmpexec’ [-Wmissing-prototypes]
  213 | void __init check_tmpexec(void)
      |             ^~~~~~~~~~~~~

And below warnings with `make ARCH=um SUBARCH=i386 defconfig && make ARCH=um SUBARCH=i386`:

arch/um/os-Linux/elf_aux.c:26:13: warning: no previous prototype for ‘scan_elf_aux’ [-Wmissing-prototypes]
   26 | __init void scan_elf_aux( char **envp)
      |             ^~~~~~~~~~~~
arch/um/os-Linux/skas/process.c:107:6: warning: no previous prototype for ‘wait_stub_done’ [-Wmissing-prototypes]
  107 | void wait_stub_done(int pid)
      |      ^~~~~~~~~~~~~~
arch/um/os-Linux/mem.c:213:13: warning: no previous prototype for ‘check_tmpexec’ [-Wmissing-prototypes]
  213 | void __init check_tmpexec(void)
      |             ^~~~~~~~~~~~~

The compiler I'm using is: gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

Regards,
Tiwei


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/7] um: Fix the -Wmissing-prototypes warning for __switch_mm
  2024-04-23 11:29   ` Johannes Berg
@ 2024-04-23 12:11     ` Tiwei Bie
  0 siblings, 0 replies; 15+ messages in thread
From: Tiwei Bie @ 2024-04-23 12:11 UTC (permalink / raw)
  To: Johannes Berg, richard, anton.ivanov; +Cc: linux-um, linux-kernel

On 4/23/24 7:29 PM, Johannes Berg wrote:
> On Tue, 2024-04-23 at 19:24 +0800, Tiwei Bie wrote:
>>
>> --- a/arch/um/include/shared/skas/mm_id.h
>> +++ b/arch/um/include/shared/skas/mm_id.h
>> @@ -15,4 +15,6 @@ struct mm_id {
>>  	int kill;
>>  };
>>  
>> +extern void __switch_mm(struct mm_id *mm_idp);
>>
> 
> Maybe drop the extern while at it?

Sure, will do. I also prefer to drop the extern.
Thanks for the review! :)

Regards,
Tiwei


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 5/7] um: Add an internal header shared among the user code
  2024-04-23 12:09     ` Tiwei Bie
@ 2024-04-23 12:22       ` Johannes Berg
  2024-04-23 12:29         ` Tiwei Bie
  0 siblings, 1 reply; 15+ messages in thread
From: Johannes Berg @ 2024-04-23 12:22 UTC (permalink / raw)
  To: Tiwei Bie, richard, anton.ivanov; +Cc: linux-um, linux-kernel

On Tue, 2024-04-23 at 20:09 +0800, Tiwei Bie wrote:
> On 4/23/24 7:30 PM, Johannes Berg wrote:
> > On Tue, 2024-04-23 at 19:24 +0800, Tiwei Bie wrote:
> > > 
> > >  $(USER_OBJS:.o=.%): \
> > > -	c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) -include $(srctree)/include/linux/kern_levels.h -include user.h $(CFLAGS_$(basetarget).o)
> > > +	c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) -include $(srctree)/include/linux/kern_levels.h \
> > > +		-include user.h -include $(srctree)/arch/um/os-Linux/internal.h $(CFLAGS_$(basetarget).o)
> > > 
> > 
> > Why not just include it explicitly?
> 
> I think it might be more convenient if we include it implicitly,
> especially since there are two levels of directories under os-Linux/.
> But I don't have a strong opinion on this. I'm also willing to
> include it explicitly.

Yeah, ok, dunno.

> > We do have the warnings?
> 
> Yeah. Without this patch, I can get below warnings with `make ARCH=um defconfig && make ARCH=um`:
> 

Sure. I meant, we don't need to hide the include, if we need to add it
to some other file, we'll have the warnings as a reminder. :)

I don't think anyone today would write the code as it is now ...

johannes


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 5/7] um: Add an internal header shared among the user code
  2024-04-23 12:22       ` Johannes Berg
@ 2024-04-23 12:29         ` Tiwei Bie
  0 siblings, 0 replies; 15+ messages in thread
From: Tiwei Bie @ 2024-04-23 12:29 UTC (permalink / raw)
  To: Johannes Berg, richard, anton.ivanov; +Cc: linux-um, linux-kernel

On 4/23/24 8:22 PM, Johannes Berg wrote:
> On Tue, 2024-04-23 at 20:09 +0800, Tiwei Bie wrote:
>> On 4/23/24 7:30 PM, Johannes Berg wrote:
>>> On Tue, 2024-04-23 at 19:24 +0800, Tiwei Bie wrote:
>>>>
>>>>  $(USER_OBJS:.o=.%): \
>>>> -	c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) -include $(srctree)/include/linux/kern_levels.h -include user.h $(CFLAGS_$(basetarget).o)
>>>> +	c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) -include $(srctree)/include/linux/kern_levels.h \
>>>> +		-include user.h -include $(srctree)/arch/um/os-Linux/internal.h $(CFLAGS_$(basetarget).o)
>>>>
>>>
>>> Why not just include it explicitly?
>>
>> I think it might be more convenient if we include it implicitly,
>> especially since there are two levels of directories under os-Linux/.
>> But I don't have a strong opinion on this. I'm also willing to
>> include it explicitly.
> 
> Yeah, ok, dunno.
> 
>>> We do have the warnings?
>>
>> Yeah. Without this patch, I can get below warnings with `make ARCH=um defconfig && make ARCH=um`:
>>
> 
> Sure. I meant, we don't need to hide the include, if we need to add it
> to some other file, we'll have the warnings as a reminder. :)
> 
> I don't think anyone today would write the code as it is now ...

Makes sense. Will include it explicitly. Thanks!

Regards,
Tiwei


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-04-23 12:30 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-23 11:24 [PATCH 0/7] um: A follow-up series of -Wmissing-prototypes fixes Tiwei Bie
2024-04-23 11:24 ` [PATCH 1/7] um: Fix -Wmissing-prototypes warnings for (rt_)sigreturn Tiwei Bie
2024-04-23 11:24 ` [PATCH 2/7] um: Fix the -Wmissing-prototypes warning for __switch_mm Tiwei Bie
2024-04-23 11:29   ` Johannes Berg
2024-04-23 12:11     ` Tiwei Bie
2024-04-23 11:24 ` [PATCH 3/7] um: Fix the -Wmissing-prototypes warning for get_thread_reg Tiwei Bie
2024-04-23 11:30   ` Johannes Berg
2024-04-23 11:24 ` [PATCH 4/7] um: Fix the declaration of kasan_map_memory Tiwei Bie
2024-04-23 11:24 ` [PATCH 5/7] um: Add an internal header shared among the user code Tiwei Bie
2024-04-23 11:30   ` Johannes Berg
2024-04-23 12:09     ` Tiwei Bie
2024-04-23 12:22       ` Johannes Berg
2024-04-23 12:29         ` Tiwei Bie
2024-04-23 11:24 ` [PATCH 6/7] um: Fix -Wmissing-prototypes warnings for __vdso_* Tiwei Bie
2024-04-23 11:24 ` [PATCH 7/7] um: Remove unused do_get_thread_area function Tiwei Bie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox