From: Mark Hatle <mark.hatle@kernel.crashing.org>
To: yocto-patches@lists.yoctoproject.org
Cc: seebs@seebs.net, richard.purdie@linuxfoundation.org
Subject: [pseudo][PATCH 2/4] ports/linux/pseudo_wrappers.c: Reorder the syscall operations
Date: Wed, 14 Jan 2026 19:10:01 -0600 [thread overview]
Message-ID: <1768439403-23665-3-git-send-email-mark.hatle@kernel.crashing.org> (raw)
In-Reply-To: <1768439403-23665-1-git-send-email-mark.hatle@kernel.crashing.org>
From: "mark.hatle" <mark.hatle@kernel.crashing.org>
The seccomp wrap always takes effect when pseudo is running, this will
prevent various behavior, even if pseudo is generally considered to be
disabled, but in memory.
The openat2 and renameat2 however should only run if pseudo is enabled.
Signed-off-by: mark.hatle <mark.hatle@kernel.crashing.org>
---
ports/linux/pseudo_wrappers.c | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/ports/linux/pseudo_wrappers.c b/ports/linux/pseudo_wrappers.c
index 6b54083..b486c34 100644
--- a/ports/linux/pseudo_wrappers.c
+++ b/ports/linux/pseudo_wrappers.c
@@ -65,19 +65,6 @@ syscall(long number, ...) {
return rc;
}
-#ifdef SYS_renameat2
- /* concerns exist about trying to parse arguments because syscall(2)
- * specifies strange ABI behaviors. If we can get better clarity on
- * that, it could make sense to redirect to wrap_renameat2().
- */
- if (number == SYS_renameat2) {
- errno = ENOSYS;
- return -1;
- }
-#else
- (void) number;
-#endif
-
#ifdef SYS_seccomp
/* pseudo and seccomp are incompatible as pseudo uses different syscalls
* so pretend to enable seccomp but really do nothing */
@@ -92,6 +79,10 @@ syscall(long number, ...) {
}
#endif
+ if (pseudo_disabled) {
+ goto call_syscall;
+ }
+
#ifdef SYS_openat2
/* concerns exist about trying to parse arguments because syscall(2)
* specifies strange ABI behaviors. If we can get better clarity on
@@ -105,6 +96,18 @@ syscall(long number, ...) {
}
#endif
+#ifdef SYS_renameat2
+ /* concerns exist about trying to parse arguments because syscall(2)
+ * specifies strange ABI behaviors. If we can get better clarity on
+ * that, it could make sense to redirect to wrap_renameat2().
+ */
+ if (number == SYS_renameat2) {
+ errno = ENOSYS;
+ return -1;
+ }
+#endif
+
+call_syscall:
/* gcc magic to attempt to just pass these args to syscall. we have to
* guess about the number of args; the docs discuss calling conventions
* up to 7, so let's try that?
--
1.8.3.1
next prev parent reply other threads:[~2026-01-15 1:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-15 1:09 [pseudo][PATCH 0/4] Implement openat2 wrapper Mark Hatle
2026-01-15 1:10 ` [pseudo][PATCH 1/4] test-syscall: Remove build warning Mark Hatle
2026-01-15 1:10 ` Mark Hatle [this message]
2026-01-15 1:10 ` [pseudo][PATCH 3/4] ports/linux/pseudo_wrappers.c: Call the wrappers where possible Mark Hatle
2026-01-15 1:10 ` [pseudo][PATCH 4/4] openat2: Implement openat2 wrapper Mark Hatle
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=1768439403-23665-3-git-send-email-mark.hatle@kernel.crashing.org \
--to=mark.hatle@kernel.crashing.org \
--cc=richard.purdie@linuxfoundation.org \
--cc=seebs@seebs.net \
--cc=yocto-patches@lists.yoctoproject.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.