[PATCH 1/5] um: Make local functions and variables static

2024-01-23 Thread Tiwei Bie
This will also fix the warnings like: warning: no previous prototype for ‘fork_handler’ [-Wmissing-prototypes] 140 | void fork_handler(void) | ^~~~ Signed-off-by: Tiwei Bie --- arch/um/drivers/pcap_kern.c | 4 ++-- arch/um/drivers/ubd_user.c | 2

[PATCH 2/5] um: Fix the declaration of vfree

2024-01-23 Thread Tiwei Bie
The definition of vfree has changed since commit b3bdda02aa54 ("vmalloc: add const to void* parameters"). Update the declaration of vfree in um_malloc.h to match the latest definition. Signed-off-by: Tiwei Bie --- arch/um/include/shared/um_malloc.h | 2 +- 1 file changed, 1 inser

[PATCH 3/5] um: Remove unused functions

2024-01-23 Thread Tiwei Bie
‘copy_to_user_proc’ [-Wmissing-prototypes] arch/um/kernel/process.c:263:5: warning: no previous prototype for ‘clear_user_proc’ [-Wmissing-prototypes] arch/um/kernel/tlb.c:579:6: warning: no previous prototype for ‘flush_tlb_mm_range’ [-Wmissing-prototypes] Signed-off-by: Tiwei Bie --- arch/um/kernel

[PATCH 4/5] um: Fix the return type of __switch_to

2024-01-23 Thread Tiwei Bie
Make it match the declaration in asm-generic/switch_to.h. And also include the header to allow the compiler to check it. Signed-off-by: Tiwei Bie --- arch/um/kernel/process.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/um/kernel/process.c b/arch/um/kernel

[PATCH 0/5] um: Minor fixes and cleanups

2024-01-23 Thread Tiwei Bie
A series of minor fixes and cleanups for UML. Tiwei Bie (5): um: Make local functions and variables static um: Fix the declaration of vfree um: Remove unused functions um: Fix the return type of __switch_to um: Add missing headers arch/um/drivers/pcap_kern.c | 4

[PATCH 5/5] um: Add missing headers

2024-01-23 Thread Tiwei Bie
for ‘arch_fixup’ [-Wmissing-prototypes] arch/x86/um/os-Linux/mcontext.c:7:6: warning: no previous prototype for ‘get_regs_from_mc’ [-Wmissing-prototypes] Signed-off-by: Tiwei Bie --- arch/um/kernel/mem.c| 2 ++ arch/um/kernel/process.c| 2 ++ arch/um/kernel/reboot.c

[PATCH v2 2/6] um: Fix the declaration of vfree

2024-02-05 Thread Tiwei Bie
The definition of vfree has changed since commit b3bdda02aa54 ("vmalloc: add const to void* parameters"). Update the declaration of vfree in um_malloc.h to match the latest definition. Signed-off-by: Tiwei Bie --- arch/um/include/shared/um_malloc.h | 2 +- 1 file changed, 1 inser

[PATCH v2 3/6] um: Remove unused functions

2024-02-05 Thread Tiwei Bie
‘copy_to_user_proc’ [-Wmissing-prototypes] arch/um/kernel/process.c:263:5: warning: no previous prototype for ‘clear_user_proc’ [-Wmissing-prototypes] arch/um/kernel/tlb.c:579:6: warning: no previous prototype for ‘flush_tlb_mm_range’ [-Wmissing-prototypes] Signed-off-by: Tiwei Bie --- arch/um/kernel

[PATCH v2 0/6] um: Minor fixes and cleanups

2024-02-05 Thread Tiwei Bie
A series of minor fixes and cleanups for UML. Changes since v1: https://lore.kernel.org/lkml/20240123110347.1274217-1-tiwei@antgroup.com/ - Add "um: Stop tracking host PID in cpu_tasks"; - Add missing headers for i386; Tiwei Bie (6): um: Make local functions and variables static

[PATCH v2 6/6] um: Stop tracking host PID in cpu_tasks

2024-02-05 Thread Tiwei Bie
The host PID tracked in 'cpu_tasks' is no longer used. Stopping tracking it will also save some cycles. Signed-off-by: Tiwei Bie --- arch/um/include/shared/as-layout.h | 1 - arch/um/kernel/process.c | 12 ++-- arch/um/kernel/skas/process.c | 4 3 files

[PATCH v2 4/6] um: Fix the return type of __switch_to

2024-02-05 Thread Tiwei Bie
Make it match the declaration in asm-generic/switch_to.h. And also include the header to allow the compiler to check it. Signed-off-by: Tiwei Bie --- arch/um/kernel/process.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/um/kernel/process.c b/arch/um/kernel

[PATCH v2 1/6] um: Make local functions and variables static

2024-02-05 Thread Tiwei Bie
This will also fix the warnings like: warning: no previous prototype for ‘fork_handler’ [-Wmissing-prototypes] 140 | void fork_handler(void) | ^~~~ Signed-off-by: Tiwei Bie --- arch/um/drivers/pcap_kern.c | 4 ++-- arch/um/drivers/ubd_user.c | 2

[PATCH v2 5/6] um: Add missing headers

2024-02-05 Thread Tiwei Bie
‘check_host_supports_tls’ [-Wmissing-prototypes] Signed-off-by: Tiwei Bie --- arch/um/kernel/mem.c| 2 ++ arch/um/kernel/process.c| 2 ++ arch/um/kernel/reboot.c | 1 + arch/um/kernel/skas/mmu.c | 1 + arch/um/kernel/skas/process.c | 1 + arch/um/kernel/tlb.c

Re: -Wmissing-prototypes warnings in user-mode linux

2024-03-05 Thread Tiwei Bie
On 3/5/24 6:49 PM, Jani Nikula wrote: > On Tue, 05 Mar 2024, Johannes Berg wrote: >> On Tue, 2024-03-05 at 12:34 +0200, Jani Nikula wrote: >>> We're seeing a lot of -Wmissing-prototypes warnings when building >>> user-mode Linux. For example, our CI hits things like [1], and it's just >>> extra no

Re: -Wmissing-prototypes warnings in user-mode linux

2024-03-05 Thread Tiwei Bie
On 3/5/24 9:45 PM, Jani Nikula wrote: > On Tue, 05 Mar 2024, Tiwei Bie wrote: >> Thanks for raising this topic! >> >> Indeed. To make it easier to review, the current series only addre

[PATCH v3 5/9] um: Add missing headers

2024-03-06 Thread Tiwei Bie
‘get_regs_from_mc’ [-Wmissing-prototypes] arch/x86/um/os-Linux/tls.c:22:6: warning: no previous prototype for ‘check_host_supports_tls’ [-Wmissing-prototypes] Signed-off-by: Tiwei Bie --- arch/um/kernel/mem.c| 2 ++ arch/um/kernel/process.c| 2 ++ arch/um/kernel/reboot.c

[PATCH v3 0/9] um: Minor fixes and cleanups

2024-03-06 Thread Tiwei Bie
ypes warnings for __warp_* and foo"; - Make do_set_thread_area() static; - Add the missing header for calibrate_delay_is_known; Tiwei Bie (9): um: Make local functions and variables static um: Fix the declaration of vfree um: Remove unused functions um: Fix the return type of __switch_to

[PATCH v3 7/9] um: Move declarations to proper headers

2024-03-06 Thread Tiwei Bie
/um/syscalls_64.c:48:6: warning: no previous prototype for ‘arch_switch_to’ [-Wmissing-prototypes] arch/x86/um/tls_32.c:184:5: warning: no previous prototype for ‘arch_switch_tls’ [-Wmissing-prototypes] Signed-off-by: Tiwei Bie --- arch/um/include/asm/ptrace-generic.h | 3 +++ arch/um/include

[PATCH v3 3/9] um: Remove unused functions

2024-03-06 Thread Tiwei Bie
‘copy_to_user_proc’ [-Wmissing-prototypes] arch/um/kernel/process.c:263:5: warning: no previous prototype for ‘clear_user_proc’ [-Wmissing-prototypes] arch/um/kernel/tlb.c:579:6: warning: no previous prototype for ‘flush_tlb_mm_range’ [-Wmissing-prototypes] Signed-off-by: Tiwei Bie --- arch/um/kernel

[PATCH v3 4/9] um: Fix the return type of __switch_to

2024-03-06 Thread Tiwei Bie
Make it match the declaration in asm-generic/switch_to.h. And also include the header to allow the compiler to check it. Signed-off-by: Tiwei Bie --- arch/um/kernel/process.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/um/kernel/process.c b/arch/um/kernel

[PATCH v3 1/9] um: Make local functions and variables static

2024-03-06 Thread Tiwei Bie
This will also fix the warnings like: warning: no previous prototype for ‘fork_handler’ [-Wmissing-prototypes] 140 | void fork_handler(void) | ^~~~ Signed-off-by: Tiwei Bie --- arch/um/drivers/pcap_kern.c | 4 ++-- arch/um/drivers/ubd_user.c | 2

[PATCH v3 9/9] um: Fix -Wmissing-prototypes warnings for __warp_* and foo

2024-03-06 Thread Tiwei Bie
c:222:6: warning: no previous prototype for ‘__wrap_free’ [-Wmissing-prototypes] arch/x86/um/user-offsets.c:17:6: warning: no previous prototype for ‘foo’ [-Wmissing-prototypes] Signed-off-by: Tiwei Bie --- arch/um/os-Linux/main.c| 5 + arch/x86/um/shared/sysdep/k

[PATCH v3 2/9] um: Fix the declaration of vfree

2024-03-06 Thread Tiwei Bie
The definition of vfree has changed since commit b3bdda02aa54 ("vmalloc: add const to void* parameters"). Update the declaration of vfree in um_malloc.h to match the latest definition. Signed-off-by: Tiwei Bie --- arch/um/include/shared/um_malloc.h | 2 +- 1 file changed, 1 inser

[PATCH v3 6/9] um: Stop tracking host PID in cpu_tasks

2024-03-06 Thread Tiwei Bie
The host PID tracked in 'cpu_tasks' is no longer used. Stopping tracking it will also save some cycles. Signed-off-by: Tiwei Bie --- arch/um/include/shared/as-layout.h | 1 - arch/um/kernel/process.c | 12 ++-- arch/um/kernel/skas/process.c | 4 3 files

[PATCH v3 8/9] um: Fix -Wmissing-prototypes warnings for text_poke*

2024-03-06 Thread Tiwei Bie
totype for ‘text_poke’ [-Wmissing-prototypes] arch/um/kernel/um_arch.c:473:6: warning: no previous prototype for ‘text_poke_sync’ [-Wmissing-prototypes] Signed-off-by: Tiwei Bie --- arch/um/kernel/um_arch.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/um/kernel/um_arch.c b/arch

Re: [PATCH v3 0/9] um: Minor fixes and cleanups

2024-03-26 Thread Tiwei Bie
lly. There is also a CI test report from patchw...@emeril.freedesktop.org: https://lore.kernel.org/all/87bk7rzj70@intel.com/ Thanks, Tiwei On 3/6/24 6:19 PM, Tiwei Bie wrote: > A series of minor fixes and cleanups for UML. > > Most changes in this series are very straightforwa

Re: [PATCH v3 8/9] um: Fix -Wmissing-prototypes warnings for text_poke*

2024-03-26 Thread Tiwei Bie
On 3/26/24 10:13 PM, Lucas De Marchi wrote: > On Wed, Mar 06, 2024 at 06:19:24PM +0800, Tiwei Bie wrote: >> The prototypes for text_poke* are declared in asm/text-patching.h >> under arch/x86/include/. It's safe to include this header, as it's >> UML-aware (by che

Re: [PATCH v3 0/9] um: Minor fixes and cleanups

2024-03-26 Thread Tiwei Bie
On 3/26/24 10:16 PM, Lucas De Marchi wrote: > On Tue, Mar 26, 2024 at 08:27:25PM +0800, Tiwei Bie wrote: >> Hi, >> >> Gentle ping.. Please take a look at this series if possible. The changes >> in this series are very straightforward, so it shouldn't require mu

Re: [PATCH 1/5] um: signal: move pid variable where needed

2024-03-28 Thread Tiwei Bie
> > - pid = userspace_pid[current_thread_info()->cpu]; > - > #ifdef CONFIG_X86_32 > if (have_fpx_regs) { > + int pid = userspace_pid[current_thread_info()->cpu]; > struct user_fxsr_struct fpx; > > err = save_fpx_registers(pid, (unsigned long *) &fpx); For the series, feel free to add my Reviewed-by: Tiwei Bie Regards, Tiwei

Re: [PATCH v8] um: Enable preemption in UML

2024-04-01 Thread Tiwei Bie
On 3/29/24 3:50 AM, anton.iva...@cambridgegreys.com wrote: [...] > + > +void kernel_fpu_begin(void) > +{ > + preempt_disable(); > + > + WARN_ON(this_cpu_read(in_kernel_fpu)); > + > + this_cpu_write(in_kernel_fpu, true); > + > +#ifdef CONFIG_64BIT > + if (likely(cpu_has(&boot_cpu_dat

Re: [PATCH] um: tlb: Remove unused flush_tlb_mm_range function

2024-04-14 Thread Tiwei Bie
On 4/15/24 5:19 AM, Ivan Orlov wrote: > GCC 11.4.0 produces the following warning when compiling the kernel for > UML architecture (with UML defconfig): > > arch/um/kernel/tlb.c:579:6: warning: no previous prototype for > ‘flush_tlb_mm_range’ [-Wmissing-prototypes] > 579 | void flush_tlb_mm_ran

Re: [PATCH 00/12] Rework stub syscall and page table handling

2024-04-21 Thread Tiwei Bie
Hello Benjamin, On 4/18/24 5:23 PM, benja...@sipsolutions.net wrote: > From: Benjamin Berg > > This patchset reworks the stub syscall handling and also redos how page > table updates are tracked and synchronized. Some of this originated in > the SECCOMP patchset, but it became clear that these r

Re: [PATCH 12/12] um: refactor TLB update handling

2024-04-21 Thread Tiwei Bie
On 4/18/24 5:23 PM, benja...@sipsolutions.net wrote: > diff --git a/arch/um/include/asm/mmu.h b/arch/um/include/asm/mmu.h > index 37eb6e89e79a..bf8da736609c 100644 > --- a/arch/um/include/asm/mmu.h > +++ b/arch/um/include/asm/mmu.h > @@ -10,6 +10,10 @@ > > typedef struct mm_context { > str

Re: [PATCH 00/12] Rework stub syscall and page table handling

2024-04-22 Thread Tiwei Bie
On 4/22/24 3:41 PM, Benjamin Berg wrote: > On Mon, 2024-04-22 at 10:35 +0800, Tiwei Bie wrote: >> On 4/18/24 5:23 PM, benja...@sipsolutions.net wrote: >>> From: Benjamin Berg >>> >>> This patchset reworks the stub syscall handling and also redos how pa

Re: -Wmissing-prototypes warnings in user-mode linux

2024-04-22 Thread Tiwei Bie
;>> >>> https://patchwork.ozlabs.org/project/linux-um/list/?series=393619 >>> >>> But I haven't checked myself yet. >> >> Oh, nice, it certainly helps! >> >> But after applying that in my branch, I do still get a bunch of >> warnings.

[PATCH 1/7] um: Fix -Wmissing-prototypes warnings for (rt_)sigreturn

2024-04-23 Thread Tiwei Bie
-prototypes] Signed-off-by: Tiwei Bie --- 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

[PATCH 0/7] um: A follow-up series of -Wmissing-prototypes fixes

2024-04-23 Thread Tiwei Bie
This is a follow-up series built on top of below series: https://lore.kernel.org/linux-um/20240306101925.1088870-1-tiwei@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

[PATCH 7/7] um: Remove unused do_get_thread_area function

2024-04-23 Thread Tiwei Bie
totypes] 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 --- arch/x86/um/tls_32.c | 17

[PATCH 2/7] um: Fix the -Wmissing-prototypes warning for __switch_mm

2024-04-23 Thread 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 --- arch/um/include/asm/mmu.h |

[PATCH 3/7] um: Fix the -Wmissing-prototypes warning for get_thread_reg

2024-04-23 Thread 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 --- arch/um/include/asm/processor-gen

[PATCH 5/7] um: Add an internal header shared among the user code

2024-04-23 Thread Tiwei Bie
’ [-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 --- arch/um/os-Linux/internal.h| 20 arch/um/os-Linux/main.c| 2 -- arch/um/os-Linux/skas/mem.c| 2

[PATCH 6/7] um: Fix -Wmissing-prototypes warnings for __vdso_*

2024-04-23 Thread Tiwei Bie
: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 --- arch/x86/um/vdso/um_vdso.c | 10 -- 1 file ch

[PATCH 4/7] um: Fix the declaration of kasan_map_memory

2024-04-23 Thread 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

Re: [PATCH 5/7] um: Add an internal header shared among the user code

2024-04-23 Thread Tiwei Bie
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_$(bas

Re: [PATCH 2/7] um: Fix the -Wmissing-prototypes warning for __switch_mm

2024-04-23 Thread Tiwei Bie
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; >> }; >&g

Re: [PATCH 5/7] um: Add an internal header shared among the user code

2024-04-23 Thread Tiwei Bie
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=.%): \ >>>> -

[PATCH v2 7/7] um: Remove unused do_get_thread_area function

2024-04-23 Thread Tiwei Bie
totypes] 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 --- arch/x86/um/tls_32.c | 17

[PATCH v2 0/7] um: A follow-up series of -Wmissing-prototypes fixes

2024-04-23 Thread Tiwei Bie
- drop the "extern" (Johannes); 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 in

[PATCH v2 1/7] um: Fix -Wmissing-prototypes warnings for (rt_)sigreturn

2024-04-23 Thread Tiwei Bie
-prototypes] Signed-off-by: Tiwei Bie --- 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

[PATCH v2 3/7] um: Fix the -Wmissing-prototypes warning for get_thread_reg

2024-04-23 Thread 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 --- arch/um/include/asm/processor-gen

[PATCH v2 6/7] um: Fix -Wmissing-prototypes warnings for __vdso_*

2024-04-23 Thread Tiwei Bie
:57:1: warning: no previous prototype for ‘__vdso_getcpu’ [-Wmissing-prototypes] While at it, also fix the "WARNING: Prefer 'unsigned int *' to bare use of 'unsigned *'" checkpatch warning. Signed-off-by: Tiwei Bie --- arch/x86/um/vdso/um_vdso.c | 10 -- 1 file ch

[PATCH v2 2/7] um: Fix the -Wmissing-prototypes warning for __switch_mm

2024-04-23 Thread 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 --- arch/um/include/asm/mmu.h |

[PATCH v2 5/7] um: Add an internal header shared among the user code

2024-04-23 Thread Tiwei Bie
’ [-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 --- arch/um/os-Linux/elf_aux.c | 1 + arch/um/os-Linux/internal.h | 20 arch/um/os-Linux/main.c | 3

[PATCH v2 4/7] um: Fix the declaration of kasan_map_memory

2024-04-23 Thread 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

[PATCH 0/2] um: Remove some dead code

2024-05-27 Thread Tiwei Bie
Tiwei Bie (2): um: Remove unused ncpus variable um: Remove /proc/sysemu support code arch/um/include/shared/kern_util.h | 1 - arch/um/kernel/process.c | 67 -- arch/um/kernel/um_arch.c | 3 -- 3 files changed, 71 deletions(-) -- 2.34.1

[PATCH 2/2] um: Remove /proc/sysemu support code

2024-05-27 Thread Tiwei Bie
Currently /proc/sysemu will never be registered, as sysemu_supported is initialized to zero implicitly and no code updates it. And there is also nothing to configure via sysemu in UML anymore. Signed-off-by: Tiwei Bie --- arch/um/kernel/process.c | 67 1

[PATCH 1/2] um: Remove unused ncpus variable

2024-05-27 Thread Tiwei Bie
It's no longer used. And uml_ncpus_setup doesn't exist anymore. Signed-off-by: Tiwei Bie --- arch/um/include/shared/kern_util.h | 1 - arch/um/kernel/um_arch.c | 3 --- 2 files changed, 4 deletions(-) diff --git a/arch/um/include/shared/kern_util.h b/arch/um/incl

Re: [PATCH 3/5] um: Do a double clone to disable rseq

2024-05-28 Thread Tiwei Bie
On 5/28/24 4:54 PM, benja...@sipsolutions.net wrote: > From: Benjamin Berg > > Newer glibc versions are enabling rseq support by default. This remains > enabled in the cloned child process, potentially causing the host kernel > to write/read memory in the child. > > It appears that this was pure

Re: [PATCH 3/5] um: Do a double clone to disable rseq

2024-05-28 Thread Tiwei Bie
Hi Benjamin, On 5/28/24 6:30 PM, Benjamin Berg wrote: > On Tue, 2024-05-28 at 18:16 +0800, Tiwei Bie wrote: >> On 5/28/24 4:54 PM, benja...@sipsolutions.net wrote: >>> From: Benjamin Berg >>> >>> Newer glibc versions are enabling rseq support by default. Th

Re: [PATCH 3/5] um: Do a double clone to disable rseq

2024-05-28 Thread Tiwei Bie
On 5/28/24 7:57 PM, Johannes Berg wrote: > On Tue, 2024-05-28 at 18:16 +0800, Tiwei Bie wrote: >> On 5/28/24 4:54 PM, benja...@sipsolutions.net wrote: >>> From: Benjamin Berg >>> >>> Newer glibc versions are enabling rseq support by default. This remains >

Re: [PATCH 3/5] um: Do a double clone to disable rseq

2024-05-29 Thread Tiwei Bie
On 5/28/24 10:13 PM, Tiwei Bie wrote: > On 5/28/24 7:57 PM, Johannes Berg wrote: >> On Tue, 2024-05-28 at 18:16 +0800, Tiwei Bie wrote: >>> On 5/28/24 4:54 PM, benja...@sipsolutions.net wrote: >>>> From: Benjamin Berg >>>> >>>> Newer gli

Re: [PATCH 5/5] um: Add 4 level page table support

2024-05-29 Thread Tiwei Bie
On 5/28/24 4:54 PM, benja...@sipsolutions.net wrote: [...] > diff --git a/arch/um/Kconfig b/arch/um/Kconfig > index 93a5a8999b07..5d111fc8ccb7 100644 > --- a/arch/um/Kconfig > +++ b/arch/um/Kconfig > @@ -208,6 +208,7 @@ config MMAPPER > > config PGTABLE_LEVELS > int > + default 4 if 4_

Re: [PATCH 3/5] um: Do a double clone to disable rseq

2024-05-30 Thread Tiwei Bie
On 5/30/24 4:54 PM, Benjamin Berg wrote: > Hi, > > On Thu, 2024-05-30 at 10:54 +0800, Tiwei Bie wrote: >> On 5/28/24 10:13 PM, Tiwei Bie wrote: >>> On 5/28/24 7:57 PM, Johannes Berg wrote: >>>> On Tue, 2024-05-28 at 18:16 +0800, Tiwei Bie wrote: >>>>

Re: [PATCH v5 3/7] um: use execveat on memfd to create userspace MMs

2024-06-20 Thread Tiwei Bie
On 6/19/24 11:34 PM, Benjamin Berg wrote: > From: Benjamin Berg > > Using clone will not undo features that have been enabled by libc. An > example of this already happening is rseq, which could cause the kernel > to read/write memory of the userspace process. In the future the > standard library

[PATCH 3/6] um: Remove unused fields from thread_struct

2024-08-15 Thread Tiwei Bie
These fields are no longer used since the removal of tt mode. Signed-off-by: Tiwei Bie --- arch/um/include/asm/processor-generic.h | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h

[PATCH 2/6] um: Remove the redundant newpage check in update_pte_range

2024-08-15 Thread Tiwei Bie
The two checks have been identical since commit ef714f15027c ("um: remove force_flush_all from fork_handler"). And the inner one isn't necessary anymore. Signed-off-by: Tiwei Bie --- arch/um/kernel/tlb.c | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) di

[PATCH 4/6] um: Remove unused mm_fd field from mm_id

2024-08-15 Thread Tiwei Bie
It's no longer used since the removal of the SKAS3/4 support. Signed-off-by: Tiwei Bie --- arch/um/include/shared/skas/mm_id.h | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/um/include/shared/skas/mm_id.h b/arch/um/include/shared/skas/mm_id.h index 1e76ba40feba..b3571a8afec9 1

[PATCH 5/6] um: Remove the call to SUBARCH_EXECVE1 macro

2024-08-15 Thread Tiwei Bie
This macro isn't defined by any supported sub-architectures in tree since it was introduced by commit 1d3468a6643a ("[PATCH uml: move _kern.c files"). Signed-off-by: Tiwei Bie --- arch/um/kernel/exec.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/um/kernel/exec.c b

[PATCH 1/6] um: Remove unused kpte_clear_flush macro

2024-08-15 Thread Tiwei Bie
This macro has no users, and __flush_tlb_one doesn't exist either. Signed-off-by: Tiwei Bie --- arch/um/include/asm/pgtable.h | 7 --- 1 file changed, 7 deletions(-) diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h index 5bb397b65efb..83373c9963e7 100644

[PATCH 0/6] Some minor cleanups for UML

2024-08-15 Thread Tiwei Bie
Tiwei Bie (6): um: Remove unused kpte_clear_flush macro um: Remove the redundant newpage check in update_pte_range um: Remove unused fields from thread_struct um: Remove unused mm_fd field from mm_id um: Remove the call to SUBARCH_EXECVE1 macro um: Remove declarations of undefined

[PATCH 6/6] um: Remove declarations of undefined functions

2024-08-15 Thread Tiwei Bie
The definitions of these functions do not exist anymore. Signed-off-by: Tiwei Bie --- arch/um/include/shared/skas/skas.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/um/include/shared/skas/skas.h b/arch/um/include/shared/skas/skas.h index ebaa116de30b..85c50122ab98 100644 --- a

Re: [PATCH 4/6] um: Remove unused mm_fd field from mm_id

2024-08-16 Thread Tiwei Bie
Hi Benjamin, On 2024/8/16 13:59, Benjamin Berg wrote: > Hi Tiwei, > > On Fri, 2024-08-16 at 09:54 +0800, Tiwei Bie wrote: >> It's no longer used since the removal of the SKAS3/4 support. >> >> Signed-off-by: Tiwei Bie >> --- >>  arch/um/include/sha

[PATCH v2 1/6] um: Remove unused kpte_clear_flush macro

2024-08-16 Thread Tiwei Bie
This macro has no users, and __flush_tlb_one doesn't exist either. Signed-off-by: Tiwei Bie --- arch/um/include/asm/pgtable.h | 7 --- 1 file changed, 7 deletions(-) diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h index 5bb397b65efb..83373c9963e7 100644

[PATCH v2 0/6] Some minor cleanups for UML

2024-08-16 Thread Tiwei Bie
Changes in v2: - Remove the pointless union (suggested by Benjamin Berg); - Minor tweaks on coding style; v1: https://lore.kernel.org/linux-um/20240816015447.320394-1-tiwei@antgroup.com/ Tiwei Bie (6): um: Remove unused kpte_clear_flush macro um: Remove the redundant newpage check in

[PATCH v2 3/6] um: Remove unused fields from thread_struct

2024-08-16 Thread Tiwei Bie
These fields are no longer used since the removal of tt mode. Signed-off-by: Tiwei Bie --- arch/um/include/asm/processor-generic.h | 20 +--- arch/um/kernel/process.c| 8 arch/um/kernel/skas/process.c | 4 ++-- 3 files changed, 11 insertions

[PATCH v2 2/6] um: Remove the redundant newpage check in update_pte_range

2024-08-16 Thread Tiwei Bie
The two checks have been identical since commit ef714f15027c ("um: remove force_flush_all from fork_handler"). And the inner one isn't necessary anymore. Signed-off-by: Tiwei Bie --- arch/um/kernel/tlb.c | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) di

[PATCH v2 5/6] um: Remove the call to SUBARCH_EXECVE1 macro

2024-08-16 Thread Tiwei Bie
This macro isn't defined by any supported sub-architectures in tree since it was introduced by commit 1d3468a6643a ("[PATCH uml: move _kern.c files"). Signed-off-by: Tiwei Bie --- arch/um/kernel/exec.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/um/kernel/exec.c b

[PATCH v2 6/6] um: Remove declarations of undefined functions

2024-08-16 Thread Tiwei Bie
The definitions of these functions do not exist anymore. Signed-off-by: Tiwei Bie --- arch/um/include/shared/skas/skas.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/um/include/shared/skas/skas.h b/arch/um/include/shared/skas/skas.h index ebaa116de30b..85c50122ab98 100644 --- a

[PATCH v2 4/6] um: Remove unused mm_fd field from mm_id

2024-08-16 Thread Tiwei Bie
It's no longer used since the removal of the SKAS3/4 support. Signed-off-by: Tiwei Bie --- arch/um/include/shared/skas/mm_id.h | 5 + arch/um/kernel/reboot.c | 2 +- arch/um/kernel/skas/mmu.c | 12 ++-- arch/um/kernel/time.c | 2 +- arch/

[PATCH v3 2/7] um: Remove the redundant newpage check in update_pte_range

2024-08-26 Thread Tiwei Bie
The two checks have been identical since commit ef714f15027c ("um: remove force_flush_all from fork_handler"). And the inner one isn't necessary anymore. Signed-off-by: Tiwei Bie --- arch/um/kernel/tlb.c | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) di

[PATCH v3 7/7] um: Remove outdated asm/sysrq.h header

2024-08-26 Thread Tiwei Bie
This header no longer serves a purpose after show_trace was removed by commit 9d1ee8ce92e1 ("um: Rewrite show_stack()"). Signed-off-by: Tiwei Bie --- arch/um/include/asm/sysrq.h | 8 arch/um/kernel/sysrq.c | 1 - arch/x86/um/sysrq_32.c | 1 - arch/x86/um/sysrq_64.

[PATCH v3 5/7] um: Remove the call to SUBARCH_EXECVE1 macro

2024-08-26 Thread Tiwei Bie
This macro has never been defined by any supported sub-architectures in tree since it was introduced by commit 1d3468a6643a ("[PATCH uml: move _kern.c files"). Signed-off-by: Tiwei Bie --- arch/um/kernel/exec.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/um/kernel/exe

[PATCH v3 6/7] um: Remove the declaration of user_thread function

2024-08-26 Thread Tiwei Bie
This function has never been defined since its declaration was introduced by commit 1da177e4c3f4 ("Linux-2.6.12-rc2"). Signed-off-by: Tiwei Bie --- arch/um/include/shared/skas/skas.h | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/um/include/shared/skas/skas.h b/arch/um/incl

[PATCH v3 0/7] Some minor cleanups for UML

2024-08-26 Thread Tiwei Bie
/20240816095953.638401-1-tiwei@antgroup.com/): - Remove the pointless union (suggested by Benjamin Berg); - Minor tweaks on coding style; v1: https://lore.kernel.org/linux-um/20240816015447.320394-1-tiwei@antgroup.com/ Tiwei Bie (7): um: Remove unused kpte_clear_flush macro um: Remove

[PATCH v3 3/7] um: Remove unused fields from thread_struct

2024-08-26 Thread Tiwei Bie
These fields are no longer used since the removal of tt mode. Signed-off-by: Tiwei Bie --- arch/um/include/asm/processor-generic.h | 20 +--- arch/um/kernel/process.c| 8 arch/um/kernel/skas/process.c | 4 ++-- 3 files changed, 11 insertions

[PATCH v3 4/7] um: Remove unused mm_fd field from mm_id

2024-08-26 Thread Tiwei Bie
It's no longer used since the removal of the SKAS3/4 support. Signed-off-by: Tiwei Bie --- arch/um/include/shared/skas/mm_id.h | 5 + arch/um/kernel/reboot.c | 2 +- arch/um/kernel/skas/mmu.c | 12 ++-- arch/um/kernel/time.c | 2 +- arch/

[PATCH v3 1/7] um: Remove unused kpte_clear_flush macro

2024-08-26 Thread Tiwei Bie
This macro has no users, and __flush_tlb_one doesn't exist either. Signed-off-by: Tiwei Bie --- arch/um/include/asm/pgtable.h | 7 --- 1 file changed, 7 deletions(-) diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h index 5bb397b65efb..83373c9963e7 100644

[PATCH] um: Fix the return value of elf_core_copy_task_fpregs

2024-08-28 Thread Tiwei Bie
This function is expected to return a boolean value, which should be true on success and false on failure. Fixes: d1254b12c93e ("uml: fix x86_64 core dump crash") Signed-off-by: Tiwei Bie --- arch/um/kernel/process.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

Re: [PATCH] um: Fix the return value of elf_core_copy_task_fpregs

2024-09-12 Thread Tiwei Bie
On 2024/9/13 02:51, Richard Weinberger wrote: > - Ursprüngliche Mail - >> Von: "Tiwei Bie" >> An: "richard" , "anton ivanov" >> , "Johannes Berg" >> >> CC: "linux-um" , "linux-kernel" >>

[PATCH v2] um: Fix the return value of elf_core_copy_task_fpregs

2024-09-12 Thread Tiwei Bie
This function is expected to return a boolean value, which should be true on success and false on failure. Fixes: d1254b12c93e ("uml: fix x86_64 core dump crash") Signed-off-by: Tiwei Bie --- v2: - Drop the unnecessary new variable (suggested by Richard Weinberger); arch/um/kernel

Re: [PATCH] um: always use the internal copy of the FP registers

2024-09-13 Thread Tiwei Bie
On 2024/9/13 16:22, Benjamin Berg wrote: > From: Benjamin Berg > > When switching from userspace to the kernel, all registers including the > FP registers are copied into the kernel and restored later on. As such, > the true source for the FP register state is actually already in the > kernel and

[PATCH 3/3] um: Fix the definition for physmem_size

2024-09-13 Thread Tiwei Bie
Currently physmem_size is defined as long long but declared locally as unsigned long long before using it in separate .c files. Make them match by defining physmem_size as unsigned long long and also move the declaration to a common header to allow the compiler to check it. Signed-off-by: Tiwei

[PATCH 2/3] um: Remove highmem leftovers

2024-09-13 Thread Tiwei Bie
Highmem was only supported on UML/i386. And the support has been removed by commit a98a6d864d3b ("um: Remove broken highmem support"). Remove the leftovers and stop UML from trying to setup highmem when the sum of physmem_size and iomem_size exceeds max_physmem. Signed-off-by:

[PATCH 0/3] Minor physmem cleanups/fixes

2024-09-13 Thread Tiwei Bie
Tiwei Bie (3): um: Remove the redundant declaration of high_physmem um: Remove highmem leftovers um: Fix the definition for physmem_size arch/um/drivers/virtio_uml.c | 9 - arch/um/include/shared/as-layout.h | 3 ++- arch/um/include/shared/mem_user.h | 5 ++--- arch/um

[PATCH 1/3] um: Remove the redundant declaration of high_physmem

2024-09-13 Thread Tiwei Bie
high_physmem has already been declared in as-layout.h, so there is no need to declare it explicitly in the .c file again. While at it, group the declarations of __real_malloc and __real_free together to make the code slightly more readable. Signed-off-by: Tiwei Bie --- arch/um/os-Linux/main.c

Re: [PATCH 2/3] um: Remove highmem leftovers

2024-09-15 Thread Tiwei Bie
o too. Regards, Tiwei > > When I took a look at it for the 4-level page table support on 64 bit I > got a bit confused. But I had not realized that highmem support had > been removed. > > Benjamin > > On Fri, 2024-09-13 at 22:21 +0800, Tiwei Bie wrote: >> Highmem wa

[PATCH v2 3/4] um: Remove highmem leftovers

2024-09-15 Thread Tiwei Bie
Highmem was only supported on UML/i386. And the support has been removed by commit a98a6d864d3b ("um: Remove broken highmem support"). Remove the leftovers and stop UML from trying to setup highmem when the sum of physmem_size and iomem_size exceeds max_physmem. Signed-off-by:

[PATCH v2 4/4] um: Fix the definition for physmem_size

2024-09-15 Thread Tiwei Bie
Currently physmem_size is defined as long long but declared locally as unsigned long long before using it in separate .c files. Make them match by defining physmem_size as unsigned long long and also move the declaration to a common header to allow the compiler to check it. Signed-off-by: Tiwei

[PATCH v2 2/4] um: Fix potential integer overflow during physmem setup

2024-09-15 Thread Tiwei Bie
This issue happens when the real map size is greater than LONG_MAX, which can be easily triggered on UML/i386. Fixes: fe205bdd1321 ("um: Print minimum physical memory requirement") Signed-off-by: Tiwei Bie --- arch/um/kernel/physmem.c | 6 +++--- 1 file changed, 3 insertions(+), 3

[PATCH v2 1/4] um: Remove the redundant declaration of high_physmem

2024-09-15 Thread Tiwei Bie
high_physmem has already been declared in as-layout.h, so there is no need to declare it explicitly in the .c file again. While at it, group the declarations of __real_malloc and __real_free together to make the code slightly more readable. Signed-off-by: Tiwei Bie --- arch/um/os-Linux/main.c

  1   2   3   >