* [PATCH 0/5] Minor cleanups for UML
@ 2024-09-13 13:35 Benjamin Berg
2024-09-13 13:35 ` [PATCH 1/5] um: Remove unused os_process_pc Benjamin Berg
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Benjamin Berg @ 2024-09-13 13:35 UTC (permalink / raw)
To: linux-um; +Cc: Benjamin Berg
From: Benjamin Berg <benjamin.berg@intel.com>
This removes a set of unused functions and also select
HAVE_EFFICIENT_UNALIGNED_ACCESS on x86 to avoid UBSAN spewing warnings
by default.
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(-)
--
2.46.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/5] um: Remove unused os_process_pc
2024-09-13 13:35 [PATCH 0/5] Minor cleanups for UML Benjamin Berg
@ 2024-09-13 13:35 ` Benjamin Berg
2024-09-13 13:35 ` [PATCH 2/5] um: Remove unused os_process_parent Benjamin Berg
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Benjamin Berg @ 2024-09-13 13:35 UTC (permalink / raw)
To: linux-um; +Cc: Benjamin Berg
From: Benjamin Berg <benjamin.berg@intel.com>
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(-)
diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
index 9a039d6f1f74..c8c1a93c8d2c 100644
--- a/arch/um/include/shared/os.h
+++ b/arch/um/include/shared/os.h
@@ -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);
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index e52dd37ddadc..6b74a8d91e06 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -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];
--
2.46.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/5] um: Remove unused os_process_parent
2024-09-13 13:35 [PATCH 0/5] Minor cleanups for UML Benjamin Berg
2024-09-13 13:35 ` [PATCH 1/5] um: Remove unused os_process_pc Benjamin Berg
@ 2024-09-13 13:35 ` Benjamin Berg
2024-09-13 13:36 ` [PATCH 3/5] um: Remove unused os_stop_process Benjamin Berg
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Benjamin Berg @ 2024-09-13 13:35 UTC (permalink / raw)
To: linux-um; +Cc: Benjamin Berg
From: Benjamin Berg <benjamin.berg@intel.com>
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(-)
diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
index c8c1a93c8d2c..4bdd4fb5dd80 100644
--- a/arch/um/include/shared/os.h
+++ b/arch/um/include/shared/os.h
@@ -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);
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index 6b74a8d91e06..b25c226c5491 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -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);
--
2.46.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/5] um: Remove unused os_stop_process
2024-09-13 13:35 [PATCH 0/5] Minor cleanups for UML Benjamin Berg
2024-09-13 13:35 ` [PATCH 1/5] um: Remove unused os_process_pc Benjamin Berg
2024-09-13 13:35 ` [PATCH 2/5] um: Remove unused os_process_parent Benjamin Berg
@ 2024-09-13 13:36 ` Benjamin Berg
2024-09-13 13:36 ` [PATCH 4/5] um: Remove unused os_getpgrp function Benjamin Berg
2024-09-13 13:36 ` [PATCH 5/5] um: Set HAVE_EFFICIENT_UNALIGNED_ACCESS for x86 Benjamin Berg
4 siblings, 0 replies; 6+ messages in thread
From: Benjamin Berg @ 2024-09-13 13:36 UTC (permalink / raw)
To: linux-um; +Cc: Benjamin Berg
From: Benjamin Berg <benjamin.berg@intel.com>
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(-)
diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
index 4bdd4fb5dd80..a94093bfa5e4 100644
--- a/arch/um/include/shared/os.h
+++ b/arch/um/include/shared/os.h
@@ -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);
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index b25c226c5491..d1f5e6002805 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -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);
--
2.46.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/5] um: Remove unused os_getpgrp function
2024-09-13 13:35 [PATCH 0/5] Minor cleanups for UML Benjamin Berg
` (2 preceding siblings ...)
2024-09-13 13:36 ` [PATCH 3/5] um: Remove unused os_stop_process Benjamin Berg
@ 2024-09-13 13:36 ` Benjamin Berg
2024-09-13 13:36 ` [PATCH 5/5] um: Set HAVE_EFFICIENT_UNALIGNED_ACCESS for x86 Benjamin Berg
4 siblings, 0 replies; 6+ messages in thread
From: Benjamin Berg @ 2024-09-13 13:36 UTC (permalink / raw)
To: linux-um; +Cc: Benjamin Berg
From: Benjamin Berg <benjamin.berg@intel.com>
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(-)
diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
index a94093bfa5e4..e54f64f55bb7 100644
--- a/arch/um/include/shared/os.h
+++ b/arch/um/include/shared/os.h
@@ -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);
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index d1f5e6002805..f20602e793d9 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -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)
{
--
2.46.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 5/5] um: Set HAVE_EFFICIENT_UNALIGNED_ACCESS for x86
2024-09-13 13:35 [PATCH 0/5] Minor cleanups for UML Benjamin Berg
` (3 preceding siblings ...)
2024-09-13 13:36 ` [PATCH 4/5] um: Remove unused os_getpgrp function Benjamin Berg
@ 2024-09-13 13:36 ` Benjamin Berg
4 siblings, 0 replies; 6+ messages in thread
From: Benjamin Berg @ 2024-09-13 13:36 UTC (permalink / raw)
To: linux-um; +Cc: Benjamin Berg
From: Benjamin Berg <benjamin.berg@intel.com>
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(+)
diff --git a/arch/x86/um/Kconfig b/arch/x86/um/Kconfig
index 186f13268401..dc56c608ce69 100644
--- a/arch/x86/um/Kconfig
+++ b/arch/x86/um/Kconfig
@@ -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"
--
2.46.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-09-13 13:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-13 13:35 [PATCH 0/5] Minor cleanups for UML Benjamin Berg
2024-09-13 13:35 ` [PATCH 1/5] um: Remove unused os_process_pc Benjamin Berg
2024-09-13 13:35 ` [PATCH 2/5] um: Remove unused os_process_parent Benjamin Berg
2024-09-13 13:36 ` [PATCH 3/5] um: Remove unused os_stop_process Benjamin Berg
2024-09-13 13:36 ` [PATCH 4/5] um: Remove unused os_getpgrp function Benjamin Berg
2024-09-13 13:36 ` [PATCH 5/5] um: Set HAVE_EFFICIENT_UNALIGNED_ACCESS for x86 Benjamin Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).