From: benjamin@sipsolutions.net
To: linux-um@lists.infradead.org
Cc: Benjamin Berg <benjamin@sipsolutions.net>
Subject: [PATCH v3 07/11] um: Do not use printk in userspace trampoline
Date: Fri, 10 Nov 2023 12:03:44 +0100 [thread overview]
Message-ID: <20231110110348.1815612-8-benjamin@sipsolutions.net> (raw)
In-Reply-To: <20231110110348.1815612-1-benjamin@sipsolutions.net>
From: Benjamin Berg <benjamin@sipsolutions.net>
The trampoline is running in a cloned process. It is not safe to use
printk for error printing there.
Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net>
---
arch/um/os-Linux/skas/process.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index ed20cefb2963..1f5c3f2523d1 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -221,8 +221,8 @@ static int userspace_tramp(void *stack)
addr = mmap64((void *) STUB_CODE, UM_KERN_PAGE_SIZE,
PROT_EXEC, MAP_FIXED | MAP_PRIVATE, fd, offset);
if (addr == MAP_FAILED) {
- printk(UM_KERN_ERR "mapping mmap stub at 0x%lx failed, errno = %d\n",
- STUB_CODE, errno);
+ os_info("mapping mmap stub at 0x%lx failed, errno = %d\n",
+ STUB_CODE, errno);
exit(1);
}
@@ -231,8 +231,8 @@ static int userspace_tramp(void *stack)
STUB_DATA_PAGES * UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE,
MAP_FIXED | MAP_SHARED, fd, offset);
if (addr == MAP_FAILED) {
- printk(UM_KERN_ERR "mapping segfault stack at 0x%lx failed, errno = %d\n",
- STUB_DATA, errno);
+ os_info("mapping segfault stack at 0x%lx failed, errno = %d\n",
+ STUB_DATA, errno);
exit(1);
}
@@ -242,8 +242,8 @@ static int userspace_tramp(void *stack)
sa.sa_sigaction = (void *) segv_handler;
sa.sa_restorer = NULL;
if (sigaction(SIGSEGV, &sa, NULL) < 0) {
- printk(UM_KERN_ERR "%s - setting SIGSEGV handler failed - errno = %d\n",
- __func__, errno);
+ os_info("%s - setting SIGSEGV handler failed - errno = %d\n",
+ __func__, errno);
exit(1);
}
--
2.41.0
_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um
next prev parent reply other threads:[~2023-11-10 11:04 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-10 11:03 [PATCH v3 00/11] General cleanups and fixes from SECCOMP patchset benjamin
2023-11-10 11:03 ` [PATCH v3 01/11] um: Drop support for hosts without SYSEMU_SINGLESTEP support benjamin
2023-11-10 11:03 ` [PATCH v3 02/11] um: Drop NULL check from start_userspace benjamin
2023-11-10 11:03 ` [PATCH v3 03/11] um: Make errors to stop ptraced child fatal during startup benjamin
2023-11-10 11:03 ` [PATCH v3 04/11] um: Don't use vfprintf() for os_info() benjamin
2024-01-04 22:37 ` Richard Weinberger
2024-01-05 8:12 ` Benjamin Berg
2024-01-05 8:56 ` Johannes Berg
2024-01-05 9:16 ` Richard Weinberger
2023-11-10 11:03 ` [PATCH v3 05/11] um: Do not use printk in SIGWINCH helper thread benjamin
2023-11-10 11:03 ` [PATCH v3 06/11] um: Reap winch thread if it fails benjamin
2023-11-10 11:03 ` benjamin [this message]
2023-11-10 11:03 ` [PATCH v3 08/11] um: Always inline stub functions benjamin
2023-11-10 11:03 ` [PATCH v3 09/11] um: Rely on PTRACE_SETREGSET to set FS/GS base registers benjamin
2024-01-04 23:05 ` Richard Weinberger
2024-01-04 23:34 ` Richard Weinberger
2024-01-05 9:54 ` Benjamin Berg
2024-01-05 13:29 ` Richard Weinberger
2023-11-10 11:03 ` [PATCH v3 10/11] um: Remove unused register save/restore functions benjamin
2023-11-10 11:03 ` [PATCH v3 11/11] um: Mark 32bit syscall helpers as clobbering memory benjamin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231110110348.1815612-8-benjamin@sipsolutions.net \
--to=benjamin@sipsolutions.net \
--cc=linux-um@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.