From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 8B9051580FD for ; Sun, 22 Dec 2024 03:41:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8F49DE08FF; Sun, 22 Dec 2024 03:41:05 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8751DE0905 for ; Sun, 22 Dec 2024 03:41:03 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1F68C33BF29 for ; Sun, 22 Dec 2024 03:41:02 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 43BF51E75 for ; Sun, 22 Dec 2024 03:41:00 +0000 (UTC) From: "Mike Gilbert" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Gilbert" Message-ID: <1734838368.986ca640c66862e55a9c54779c2723c0b64373f6.floppym@gentoo> Subject: [gentoo-commits] proj/sandbox:master commit in: tests/, libsandbox/ X-VCS-Repository: proj/sandbox X-VCS-Files: libsandbox/symbols.h.in libsandbox/trace.c tests/faccessat_static-0.c tests/faccessat_static-1.sh tests/faccessat_static.at tests/local.mk X-VCS-Directories: libsandbox/ tests/ X-VCS-Committer: floppym X-VCS-Committer-Name: Mike Gilbert X-VCS-Revision: 986ca640c66862e55a9c54779c2723c0b64373f6 X-VCS-Branch: master Date: Sun, 22 Dec 2024 03:41:00 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 9dd1d5c1-4d45-4a82-a360-c57758cf7379 X-Archives-Hash: 0ada99a9b77d9d77022bca228e48e2d9 commit: 986ca640c66862e55a9c54779c2723c0b64373f6 Author: Mike Gilbert gentoo org> AuthorDate: Sun Dec 22 03:32:48 2024 +0000 Commit: Mike Gilbert gentoo org> CommitDate: Sun Dec 22 03:32:48 2024 +0000 URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=986ca640 trace: wire up faccessat2 Signed-off-by: Mike Gilbert gentoo.org> libsandbox/symbols.h.in | 1 + libsandbox/trace.c | 16 +++++++++++++--- tests/faccessat_static-0.c | 1 + tests/faccessat_static-1.sh | 8 ++++++++ tests/faccessat_static.at | 1 + tests/local.mk | 1 + 6 files changed, 25 insertions(+), 3 deletions(-) diff --git a/libsandbox/symbols.h.in b/libsandbox/symbols.h.in index 5805592..1232874 100644 --- a/libsandbox/symbols.h.in +++ b/libsandbox/symbols.h.in @@ -33,6 +33,7 @@ mkfifo mkfifoat access faccessat +faccessat2 remove rename renameat diff --git a/libsandbox/trace.c b/libsandbox/trace.c index e570207..1b874d0 100644 --- a/libsandbox/trace.c +++ b/libsandbox/trace.c @@ -385,9 +385,9 @@ static bool trace_check_syscall(const struct syscall_entry *se, void *regs) else if (nr == SB_NR_ACCESS) { char *path = do_peekstr(trace_arg(regs, 1)); - int flags = trace_arg(regs, 2); - __sb_debug("(\"%s\", %x)", path, flags); - ret = _SB_SAFE_ACCESS(nr, name, path, flags); + int mode = trace_arg(regs, 2); + __sb_debug("(\"%s\", %x)", path, mode); + ret = _SB_SAFE_ACCESS(nr, name, path, mode); free(path); return ret; @@ -400,6 +400,16 @@ static bool trace_check_syscall(const struct syscall_entry *se, void *regs) free(path); return ret; + } else if (nr == SB_NR_FACCESSAT2) { + int dirfd = trace_arg(regs, 1); + char *path = do_peekstr(trace_arg(regs, 2)); + int mode = trace_arg(regs, 3); + int flags = trace_arg(regs, 4); + __sb_debug("(%i, \"%s\", %x, %x)", dirfd, path, mode, flags); + ret = _SB_SAFE_ACCESS_AT(nr, name, dirfd, path, mode, flags); + free(path); + return ret; + } else if (nr == SB_NR_OPEN) { char *path = do_peekstr(trace_arg(regs, 1)); int flags = trace_arg(regs, 2); diff --git a/tests/faccessat_static-0.c b/tests/faccessat_static-0.c new file mode 100644 index 0000000..8e3bdd9 --- /dev/null +++ b/tests/faccessat_static-0.c @@ -0,0 +1 @@ +#include "faccessat-0.c" diff --git a/tests/faccessat_static-1.sh b/tests/faccessat_static-1.sh new file mode 100644 index 0000000..4bf209d --- /dev/null +++ b/tests/faccessat_static-1.sh @@ -0,0 +1,8 @@ +#!/bin/sh +[ "${at_xfail}" = "yes" ] && exit 77 # see trace-0 +set -e +addwrite "$PWD/file" +faccessat_static-0 0 'file:O_RDWR|O_CREAT:0666' '' rw AT_EMPTY_PATH +exec 9