Minor cleanups for UML
Subsystems (2)
v2 cover Minor cleanups for UML
From: Benjamin Berg <[email protected]>
This removes a set of unused functions and also selects HAVE_EFFICIENT_UNALIGNED_ACCESS on x86 to avoid UBSAN spewing warnings by default.
v2: Add Signed-off-by to all patches
Benjamin Berg (5):
um: Remove unused os_process_pc
um: Remove unused os_process_parent
um: Remove unused os_stop_process
um: Remove unused os_getpgrp function
um: Set HAVE_EFFICIENT_UNALIGNED_ACCESS for x86
arch/um/include/shared/os.h | 4 -- arch/um/os-Linux/process.c | 82 ------------------------------------- arch/x86/um/Kconfig | 1 + 3 files changed, 1 insertion(+), 86 deletions(-)
Signature · 1 line
2.46.0
PATCH v2 1/5 um: Remove unused os_process_pc
From: Benjamin Berg <[email protected]>
The function is not used anywhere in the codebase.
--- arch/um/include/shared/os.h | 1 - arch/um/os-Linux/process.c | 33 --------------------------------- 2 files changed, 34 deletions(-)
arch/um/include/shared/os.h +0 -1
@@ -199,7 +199,6 @@ extern int create_mem_file(unsigned long long len);extern void report_enomem (void );/* process.c */ -extern unsigned long os_process_pc (int pid);extern int os_process_parent (int pid);extern void os_alarm_process (int pid);extern void os_stop_process (int pid);
arch/um/os-Linux/process.c +0 -33
@@ -18,44 +18,11 @@#include <longjmp.h> #include <os.h> -#define ARBITRARY_ADDR -1#define FAILURE_PID -1#define STAT_PATH_LEN sizeof("/proc/#######/stat\0")#define COMM_SCANF "%*[^)])" -unsigned long os_process_pc (int pid) -{ -char proc_stat[STAT_PATH_LEN ], buf[256 ]; -unsigned long pc =ARBITRARY_ADDR ; -int fd, err; - -sprintf (proc_stat,"/proc/%d/stat" , pid); - fd =open (proc_stat,O_RDONLY ,0 ); -if (fd <0 ) { -printk (UM_KERN_ERR "os_process_pc - couldn't open '%s', " -"errno = %d\n" , proc_stat, errno); - goto out; - } -CATCH_EINTR (err =read (fd, buf,sizeof (buf))); -if (err <0 ) { -printk (UM_KERN_ERR "os_process_pc - couldn't read '%s', " -"err = %d\n" , proc_stat, errno); - goto out_close; - } -os_close_file (fd); - pc =ARBITRARY_ADDR ; -if (sscanf (buf,"%*d " COMM_SCANF " %*c %*d %*d %*d %*d %*d %*d %*d " -"%*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d " -"%*d %*d %*d %*d %*d %lu" , &pc) !=1 ) -printk (UM_KERN_ERR "os_process_pc - couldn't find pc in '%s'\n" , - buf); - out_close: -close (fd); - out: -return pc; -} -int os_process_parent (int pid) {char stat[STAT_PATH_LEN ];
Signature · 1 line
2.46.0
PATCH v2 2/5 um: Remove unused os_process_parent
In reply to Benjamin BergFrom: Benjamin Berg <[email protected]>
The function is not used anywhere.
--- arch/um/include/shared/os.h | 1 - arch/um/os-Linux/process.c | 39 ------------------------------------- 2 files changed, 40 deletions(-)
arch/um/include/shared/os.h +0 -1
@@ -199,7 +199,6 @@ extern int create_mem_file(unsigned long long len);extern void report_enomem (void );/* process.c */ -extern int os_process_parent (int pid);extern void os_alarm_process (int pid);extern void os_stop_process (int pid);extern void os_kill_process (int pid,int reap_child);
arch/um/os-Linux/process.c +0 -39
@@ -18,45 +18,6 @@#include <longjmp.h> #include <os.h> -#define FAILURE_PID -1 - -#define STAT_PATH_LEN sizeof("/proc/#######/stat\0") -#define COMM_SCANF "%*[^)])" - -int os_process_parent (int pid) -{ -char stat[STAT_PATH_LEN ]; -char data[256 ]; -int parent =FAILURE_PID , n, fd; - -if (pid ==-1 ) -return parent; - -snprintf (stat,sizeof (stat),"/proc/%d/stat" , pid); - fd =open (stat,O_RDONLY ,0 ); -if (fd <0 ) { -printk (UM_KERN_ERR "Couldn't open '%s', errno = %d\n" , stat, - errno); -return parent; - } - -CATCH_EINTR (n =read (fd, data,sizeof (data))); -close (fd); - -if (n <0 ) { -printk (UM_KERN_ERR "Couldn't read '%s', errno = %d\n" , stat, - errno); -return parent; - } - - parent =FAILURE_PID ; - n =sscanf (data,"%*d " COMM_SCANF " %*c %d" , &parent); -if (n !=1 ) -printk (UM_KERN_ERR "Failed to scan '%s'\n" , data); - -return parent; -} -void os_alarm_process (int pid) {kill (pid,SIGALRM );
Signature · 1 line
2.46.0
PATCH v2 3/5 um: Remove unused os_stop_process
In reply to Benjamin BergFrom: Benjamin Berg <[email protected]>
The function is not used anywhere.
--- arch/um/include/shared/os.h | 1 - arch/um/os-Linux/process.c | 5 ----- 2 files changed, 6 deletions(-)
arch/um/include/shared/os.h +0 -1
@@ -200,7 +200,6 @@ extern void report_enomem(void);/* process.c */ extern void os_alarm_process (int pid); -extern void os_stop_process (int pid);extern void os_kill_process (int pid,int reap_child);extern void os_kill_ptraced_process (int pid,int reap_child);
arch/um/os-Linux/process.c +0 -5
@@ -23,11 +23,6 @@ void os_alarm_process(int pid)kill (pid,SIGALRM ); } -void os_stop_process (int pid) -{ -kill (pid,SIGSTOP ); -} -void os_kill_process (int pid,int reap_child) {kill (pid,SIGKILL );
Signature · 1 line
2.46.0
PATCH v2 4/5 um: Remove unused os_getpgrp function
In reply to Benjamin BergFrom: Benjamin Berg <[email protected]>
The function is not used anywhere.
--- arch/um/include/shared/os.h | 1 - arch/um/os-Linux/process.c | 5 ----- 2 files changed, 6 deletions(-)
arch/um/include/shared/os.h +0 -1
@@ -204,7 +204,6 @@ extern void os_kill_process(int pid, int reap_child);extern void os_kill_ptraced_process (int pid,int reap_child);extern int os_getpid (void ); -extern int os_getpgrp (void );extern void init_new_thread_signals (void );
arch/um/os-Linux/process.c +0 -5
@@ -53,11 +53,6 @@ int os_getpid(void)return syscall (__NR_getpid); } -int os_getpgrp (void ) -{ -return getpgrp (); -} -int os_map_memory (void *virt,int fd,unsigned long long off,unsigned long len,int r,int w,int x) {
Signature · 1 line
2.46.0
PATCH v2 5/5 um: Set HAVE_EFFICIENT_UNALIGNED_ACCESS for x86
In reply to Benjamin BergFrom: Benjamin Berg <[email protected]>
The x86 port of UM has efficient unaligned access. Set the option as it is appropriate and will e.g. cause UBSAN to not enable unaligned memory access checking by default.
--- arch/x86/um/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/x86/um/Kconfig +1 -0
@@ -10,6 +10,7 @@ config UML_X86 def_bool y select ARCH_BINFMT_ELF_EXTRA_PHDRS if X86_32 select DCACHE_WORD_ACCESS + select HAVE_EFFICIENT_UNALIGNED_ACCESS config 64BIT bool "64-bit kernel" if "$(SUBARCH)" = "x86"
Signature · 1 line
2.46.0