From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id E78481582EF for ; Sat, 22 Feb 2025 19:49:15 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id C1B1134325F for ; Sat, 22 Feb 2025 19:49:15 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 7B4DF110472; Sat, 22 Feb 2025 19:49:09 +0000 (UTC) Received: from smtp.gentoo.org (mail.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)) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id 6FCA1110472 for ; Sat, 22 Feb 2025 19:49:09 +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)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2B59F343200 for ; Sat, 22 Feb 2025 19:49:09 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 8C4D3271C for ; Sat, 22 Feb 2025 19:49:07 +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: <1739583774.6e81c90d8704157127a33d5ec118739b41918d79.floppym@gentoo> Subject: [gentoo-commits] proj/sandbox:master commit in: libsandbox/ X-VCS-Repository: proj/sandbox X-VCS-Files: libsandbox/libsandbox.c X-VCS-Directories: libsandbox/ X-VCS-Committer: floppym X-VCS-Committer-Name: Mike Gilbert X-VCS-Revision: 6e81c90d8704157127a33d5ec118739b41918d79 X-VCS-Branch: master Date: Sat, 22 Feb 2025 19:49:07 +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: afc3463a-4c23-47c0-9e2c-c788be70d3e9 X-Archives-Hash: ebab6d2a5134f88f204ff43dd293a55b commit: 6e81c90d8704157127a33d5ec118739b41918d79 Author: Mike Gilbert gentoo org> AuthorDate: Mon Feb 10 19:14:00 2025 +0000 Commit: Mike Gilbert gentoo org> CommitDate: Sat Feb 15 01:42:54 2025 +0000 URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=6e81c90d Skip access checks when opening a directory for writing coreutils tests expect to get EISDIR. Signed-off-by: Mike Gilbert gentoo.org> libsandbox/libsandbox.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libsandbox/libsandbox.c b/libsandbox/libsandbox.c index b795930..f5b3e62 100644 --- a/libsandbox/libsandbox.c +++ b/libsandbox/libsandbox.c @@ -641,6 +641,12 @@ static int check_syscall(sbcontext_t *sbcontext, int sb_nr, const char *func, dirfd = trace_dirfd; } + if (sb_nr == SB_NR_OPEN_WR || sb_nr == SB_NR_OPEN_WR_CREAT) { + struct stat st; + if (!fstatat(dirfd, file, &st, flags) && S_ISDIR(st.st_mode)) + return 1; /* let the kernel return EISDIR */ + } + if (is_symlink_func(sb_nr)) flags |= AT_SYMLINK_NOFOLLOW;