From patchwork Wed Jul 24 09:45:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1964212 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=sgutdAZb; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=pcj3vWuW; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=sgutdAZb; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=pcj3vWuW; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WTTg93Bcmz1yXp for ; Wed, 24 Jul 2024 19:46:29 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 2B0C53D1BF1 for ; Wed, 24 Jul 2024 11:46:27 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [217.194.8.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 87D6B3D0E76 for ; Wed, 24 Jul 2024 11:46:06 +0200 (CEST) Authentication-Results: in-4.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.de (client-ip=2a07:de40:b251:101:10:150:64:1; helo=smtp-out1.suse.de; envelope-from=andrea.cervesato@suse.de; receiver=lists.linux.it) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id F08ED100040D for ; Wed, 24 Jul 2024 11:46:05 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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-out1.suse.de (Postfix) with ESMTPS id C401721B1A; Wed, 24 Jul 2024 09:46:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721814364; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ap2A2KDD+U7dDhbXFy+raCWgi3HsCdkmU6Qk8PbbWvA=; b=sgutdAZbzeHfX2irV6ajEJ9PQYLazk8Xf+i4Yq9w41HHJzy/Xf0JzhggEYo2ezwpfWdaJJ 8x7ATZHE/1sMW9faEPTtpDVZgSsDJaGBeIlYm/kzRtp8gaaHq6ULDbxS+EqEiKwxZtgeqa OK0+05Uf0IVyDUwtJh2qqYEXoHXWlwA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721814364; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ap2A2KDD+U7dDhbXFy+raCWgi3HsCdkmU6Qk8PbbWvA=; b=pcj3vWuWb7T5IX7gTsHmA2RwAz455sqPVtfux6kV2UmDrCFHE46aLpQJiz6YHN7STH+bnx EpaKCAuBpNUv5QBw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=sgutdAZb; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=pcj3vWuW DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721814364; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ap2A2KDD+U7dDhbXFy+raCWgi3HsCdkmU6Qk8PbbWvA=; b=sgutdAZbzeHfX2irV6ajEJ9PQYLazk8Xf+i4Yq9w41HHJzy/Xf0JzhggEYo2ezwpfWdaJJ 8x7ATZHE/1sMW9faEPTtpDVZgSsDJaGBeIlYm/kzRtp8gaaHq6ULDbxS+EqEiKwxZtgeqa OK0+05Uf0IVyDUwtJh2qqYEXoHXWlwA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721814364; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ap2A2KDD+U7dDhbXFy+raCWgi3HsCdkmU6Qk8PbbWvA=; b=pcj3vWuWb7T5IX7gTsHmA2RwAz455sqPVtfux6kV2UmDrCFHE46aLpQJiz6YHN7STH+bnx EpaKCAuBpNUv5QBw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2AD0A13411; Wed, 24 Jul 2024 09:46:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id YDIQOlvNoGYxWwAAD6G6ig (envelope-from ); Wed, 24 Jul 2024 09:46:03 +0000 From: Andrea Cervesato Date: Wed, 24 Jul 2024 11:45:31 +0200 MIME-Version: 1.0 Message-Id: <20240724-fchmodat2-v3-1-1dc7cfc634b8@suse.com> References: <20240724-fchmodat2-v3-0-1dc7cfc634b8@suse.com> In-Reply-To: <20240724-fchmodat2-v3-0-1dc7cfc634b8@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2602; i=andrea.cervesato@suse.com; h=from:subject:message-id; bh=U2VGMxIUdQTXMvw5tt0u3nXxyihCqX23E98wwkw4Zeo=; b=owEB7QES/pANAwAIAcvMGrIgs+ZGAcsmYgBmoM1EAcPTqK+HDhC+sVs4CF+KUfpq6AAj6zL/4 M5nGxLkSN2JAbMEAAEIAB0WIQT1ysFzUKRW0sIb39jLzBqyILPmRgUCZqDNRAAKCRDLzBqyILPm Ru0UC/9kHfK2zS9aI0DrTTWobijhiLRHWBIJ5puaXm/RDn+Lj19X4GTYOjOsdUMb3BNODnTKdfZ pd4lFTTKBjyo7RpNkPdQroqeLJg+ESvMznnntM5D3Ga60XAoAUQ/oucYaneoQjc8gKscru0QwFc bjX252bmXkkPlCMcwxG+7z5i/Ac5Is/nMloMnejo98nIr5S+wykCyoPeDlhX1SGSWywCuBfUzHt zbwr0iXdrlrhQXNaI+f/Z3Xcm4VQsQBXBTaoLNFbpGyt062NTmKzfltk6D1EhqU4+y13Bh8XZfN A3dfEpPBCqqPIKxFYrJIpSHH3c3h1xRbjJb92wYoqQUxdOaqDO9RIU9RyyfZMAPWJgfBOwWSJkd q9g2az6hlBW7bDeTBubGbfjU+oL3Sf8+LD8k9gaae02voRED48fmUGungSiNOBI9dVe8rP/boLT yAm77biZGEbuGq/9hF2sxDyTiRqKSnxI93TVK0oPWK/VB8iktm5OcW3g0J2N5IK61AAiI= X-Developer-Key: i=andrea.cervesato@suse.com; a=openpgp; fpr=F5CAC17350A456D2C21BDFD8CBCC1AB220B3E646 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Action: no action X-Rspamd-Queue-Id: C401721B1A X-Spam-Score: -6.31 X-Spam-Level: X-Spamd-Result: default: False [-6.31 / 50.00]; BAYES_HAM(-3.00)[100.00%]; DWL_DNSWL_MED(-2.00)[suse.de:dkim]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.com:email,suse.de:dkim]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-4.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-4.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v3 1/5] Add SAFE_SYMLINKAT macro X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Andrea Cervesato Signed-off-by: Andrea Cervesato --- include/safe_macros_fn.h | 4 ++++ include/tst_safe_macros.h | 3 +++ lib/safe_macros.c | 20 ++++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/include/safe_macros_fn.h b/include/safe_macros_fn.h index d256091b7..6d9e72e4f 100644 --- a/include/safe_macros_fn.h +++ b/include/safe_macros_fn.h @@ -122,6 +122,10 @@ int safe_symlink(const char *file, const int lineno, void (cleanup_fn)(void), const char *oldpath, const char *newpath); +int safe_symlinkat(const char *file, const int lineno, + void (cleanup_fn)(void), const char *oldpath, + const int newdirfd, const char *newpath); + ssize_t safe_write(const char *file, const int lineno, void (cleanup_fn)(void), enum safe_write_opts len_strict, int fildes, const void *buf, size_t nbyte); diff --git a/include/tst_safe_macros.h b/include/tst_safe_macros.h index 92b9bc119..47a6f99df 100644 --- a/include/tst_safe_macros.h +++ b/include/tst_safe_macros.h @@ -191,6 +191,9 @@ int safe_getgroups(const char *file, const int lineno, int size, gid_t list[]); #define SAFE_SYMLINK(oldpath, newpath) \ safe_symlink(__FILE__, __LINE__, NULL, (oldpath), (newpath)) +#define SAFE_SYMLINKAT(oldpath, newdirfd, newpath) \ + safe_symlinkat(__FILE__, __LINE__, NULL, (oldpath), (newdirfd), (newpath)) + #define SAFE_WRITE(len_strict, fildes, buf, nbyte) \ safe_write(__FILE__, __LINE__, NULL, (len_strict), (fildes), (buf), (nbyte)) diff --git a/lib/safe_macros.c b/lib/safe_macros.c index 109268587..f91e77022 100644 --- a/lib/safe_macros.c +++ b/lib/safe_macros.c @@ -527,6 +527,26 @@ int safe_symlink(const char *file, const int lineno, return rval; } +int safe_symlinkat(const char *file, const int lineno, + void (cleanup_fn)(void), const char *oldpath, + const int newdirfd, const char *newpath) +{ + int rval; + + rval = symlinkat(oldpath, newdirfd, newpath); + + if (rval == -1) { + tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn, + "symlinkat(%s,%d,%s) failed", oldpath, newdirfd, newpath); + } else if (rval) { + tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn, + "Invalid symlinkat(%s,%d,%s) return value %d", oldpath, + newdirfd, newpath, rval); + } + + return rval; +} + ssize_t safe_write(const char *file, const int lineno, void (cleanup_fn) (void), enum safe_write_opts len_strict, int fildes, const void *buf, size_t nbyte) From patchwork Wed Jul 24 09:45:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1964214 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=n4Am/f24; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=MCTB8n7x; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=n4Am/f24; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=MCTB8n7x; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WTTgp1M6hz1yXp for ; Wed, 24 Jul 2024 19:47:02 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 02BE33D1C2A for ; Wed, 24 Jul 2024 11:47:00 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [217.194.8.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 61CC13D1BF3 for ; Wed, 24 Jul 2024 11:46:08 +0200 (CEST) Authentication-Results: in-3.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.de (client-ip=2a07:de40:b251:101:10:150:64:2; helo=smtp-out2.suse.de; envelope-from=andrea.cervesato@suse.de; receiver=lists.linux.it) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id EB4671A01524 for ; Wed, 24 Jul 2024 11:46:06 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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-out2.suse.de (Postfix) with ESMTPS id CCFF41F796; Wed, 24 Jul 2024 09:46:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721814365; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5eRUkHziJ3tM8kvcWiH3F/vBFLntz/g884/z24OG2ac=; b=n4Am/f24CMoM+Exw+x181HOrlW/+QUsJh6gctO/qrEVFc+0oY+wH3pR/k7DP1rT6ra3W7b WZ0bu3H6VRUZyP787JBwQgQQ0E7hLHB2AOvyF6VzIR9xA2+O4V6BC1I/Te3nQ61RYlRZKx WieQqwxA2LEnBrll3XN5y+HbQ9xi90Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721814365; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5eRUkHziJ3tM8kvcWiH3F/vBFLntz/g884/z24OG2ac=; b=MCTB8n7xtqyFAtFsUeK7FF4om0kboJ3GSzhI/AOBAveCFw+laHqPD9wLkRoKWCCR2NCZXi CmraRS6x1JQ2ZYAQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="n4Am/f24"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=MCTB8n7x DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721814365; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5eRUkHziJ3tM8kvcWiH3F/vBFLntz/g884/z24OG2ac=; b=n4Am/f24CMoM+Exw+x181HOrlW/+QUsJh6gctO/qrEVFc+0oY+wH3pR/k7DP1rT6ra3W7b WZ0bu3H6VRUZyP787JBwQgQQ0E7hLHB2AOvyF6VzIR9xA2+O4V6BC1I/Te3nQ61RYlRZKx WieQqwxA2LEnBrll3XN5y+HbQ9xi90Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721814365; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5eRUkHziJ3tM8kvcWiH3F/vBFLntz/g884/z24OG2ac=; b=MCTB8n7xtqyFAtFsUeK7FF4om0kboJ3GSzhI/AOBAveCFw+laHqPD9wLkRoKWCCR2NCZXi CmraRS6x1JQ2ZYAQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2968613411; Wed, 24 Jul 2024 09:46:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id cN3ZAF3NoGYxWwAAD6G6ig (envelope-from ); Wed, 24 Jul 2024 09:46:05 +0000 From: Andrea Cervesato Date: Wed, 24 Jul 2024 11:45:32 +0200 MIME-Version: 1.0 Message-Id: <20240724-fchmodat2-v3-2-1dc7cfc634b8@suse.com> References: <20240724-fchmodat2-v3-0-1dc7cfc634b8@suse.com> In-Reply-To: <20240724-fchmodat2-v3-0-1dc7cfc634b8@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6957; i=andrea.cervesato@suse.com; h=from:subject:message-id; bh=UU8j8kZYUBW7JffgT1nx9ktBUE6jiQCGs092IgyCMmQ=; b=owEB7QES/pANAwAIAcvMGrIgs+ZGAcsmYgBmoM1E38JKHdykGxfrXNXmpJ4mK2IyTu8bndQur +baCKc+I9WJAbMEAAEIAB0WIQT1ysFzUKRW0sIb39jLzBqyILPmRgUCZqDNRAAKCRDLzBqyILPm RkLcDACF/RXKDNvn+9kz0Knc5EU1NviNLMfEWO/yTe6gTPI2LznotcJfqteR3MtVamu+1fmuUJ8 UJluPwaCPB6Q2d2WdX6aN10OXGHP5+bEE1WGHfehEGPX0VOvmJBvVH7eKuqjGJ1NzmD50aTeWmg gfj+72mY+cgC9DcWy29vWscT2SRJKoCPCMK45kJi22yF+lgEHcLaA7+EqGDH10ut1MdmUHljgHn /zvO3kf22cWVfpIwvsp04T6LUyA+sUUsdIPllKamOv2X+dG7hMVDaTXFHH/o/LV7KUJVxInROiM 5Q7mTUhvpnRScTv+dvTUZIDG+7o63CEJ6QHXgxe2XGAK5jWtcy701w11eXuSuRVdHgk5XHpfe2y MDiErWRM4YypZkpS+E2tUzA/0vVKzKeLkY/y8sr+mevBO3WtN72SLMlol7LXlAXENdFx0AoowMU 1Vt8hKX7X1Kcdv42H92fAnJ1dyLMbz33zwBdZ6S0MTKS8MPUpwWV5XLAgrfKtgAM5S8Ho= X-Developer-Key: i=andrea.cervesato@suse.com; a=openpgp; fpr=F5CAC17350A456D2C21BDFD8CBCC1AB220B3E646 X-Spam-Level: X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-3.31 / 50.00]; DWL_DNSWL_MED(-2.00)[suse.de:dkim]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_DN_SOME(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_TLS_ALL(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.com:email]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Spam-Score: -3.31 X-Rspamd-Queue-Id: CCFF41F796 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-3.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-3.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v3 2/5] Add fchmodat2 syscalls definitions X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Andrea Cervesato Signed-off-by: Andrea Cervesato --- include/lapi/syscalls/aarch64.in | 1 + include/lapi/syscalls/arc.in | 1 + include/lapi/syscalls/arm.in | 1 + include/lapi/syscalls/hppa.in | 1 + include/lapi/syscalls/i386.in | 1 + include/lapi/syscalls/ia64.in | 1 + include/lapi/syscalls/loongarch.in | 1 + include/lapi/syscalls/mips_n32.in | 1 + include/lapi/syscalls/mips_n64.in | 1 + include/lapi/syscalls/mips_o32.in | 1 + include/lapi/syscalls/powerpc.in | 1 + include/lapi/syscalls/powerpc64.in | 1 + include/lapi/syscalls/s390.in | 1 + include/lapi/syscalls/s390x.in | 1 + include/lapi/syscalls/sh.in | 1 + include/lapi/syscalls/sparc.in | 1 + include/lapi/syscalls/sparc64.in | 1 + include/lapi/syscalls/x86_64.in | 1 + 18 files changed, 18 insertions(+) diff --git a/include/lapi/syscalls/aarch64.in b/include/lapi/syscalls/aarch64.in index 3e7797718..6c3bd69b5 100644 --- a/include/lapi/syscalls/aarch64.in +++ b/include/lapi/syscalls/aarch64.in @@ -300,4 +300,5 @@ landlock_create_ruleset 444 landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 +fchmodat2 452 _sysctl 1078 diff --git a/include/lapi/syscalls/arc.in b/include/lapi/syscalls/arc.in index 7fde1d263..f1721551e 100644 --- a/include/lapi/syscalls/arc.in +++ b/include/lapi/syscalls/arc.in @@ -320,3 +320,4 @@ landlock_create_ruleset 444 landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 +fchmodat2 452 diff --git a/include/lapi/syscalls/arm.in b/include/lapi/syscalls/arm.in index 8e76ad164..032941b7e 100644 --- a/include/lapi/syscalls/arm.in +++ b/include/lapi/syscalls/arm.in @@ -399,3 +399,4 @@ landlock_add_rule (__NR_SYSCALL_BASE+445) landlock_restrict_self (__NR_SYSCALL_BASE+446) memfd_secret (__NR_SYSCALL_BASE+447) futex_waitv (__NR_SYSCALL_BASE+449) +fchmodat2 (__NR_SYSCALL_BASE+452) diff --git a/include/lapi/syscalls/hppa.in b/include/lapi/syscalls/hppa.in index 60c02aff2..39fdcc1d9 100644 --- a/include/lapi/syscalls/hppa.in +++ b/include/lapi/syscalls/hppa.in @@ -47,3 +47,4 @@ landlock_create_ruleset 444 landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 +fchmodat2 452 diff --git a/include/lapi/syscalls/i386.in b/include/lapi/syscalls/i386.in index 31ec1ecb2..36129b491 100644 --- a/include/lapi/syscalls/i386.in +++ b/include/lapi/syscalls/i386.in @@ -434,3 +434,4 @@ landlock_create_ruleset 444 landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 +fchmodat2 452 diff --git a/include/lapi/syscalls/ia64.in b/include/lapi/syscalls/ia64.in index 2e56da7f9..60f657457 100644 --- a/include/lapi/syscalls/ia64.in +++ b/include/lapi/syscalls/ia64.in @@ -347,3 +347,4 @@ landlock_create_ruleset 1468 landlock_add_rule 1469 landlock_restrict_self 1470 futex_waitv 1473 +fchmodat2 1476 diff --git a/include/lapi/syscalls/loongarch.in b/include/lapi/syscalls/loongarch.in index 301f611f6..63e05d6b6 100644 --- a/include/lapi/syscalls/loongarch.in +++ b/include/lapi/syscalls/loongarch.in @@ -305,3 +305,4 @@ memfd_secret 447 process_mrelease 448 futex_waitv 449 set_mempolicy_home_node 450 +fchmodat2 452 diff --git a/include/lapi/syscalls/mips_n32.in b/include/lapi/syscalls/mips_n32.in index 5f0fe65eb..b53fefc1f 100644 --- a/include/lapi/syscalls/mips_n32.in +++ b/include/lapi/syscalls/mips_n32.in @@ -374,3 +374,4 @@ landlock_create_ruleset 6444 landlock_add_rule 6445 landlock_restrict_self 6446 futex_waitv 6449 +fchmodat2 6452 diff --git a/include/lapi/syscalls/mips_n64.in b/include/lapi/syscalls/mips_n64.in index f81c60e66..d9336c6e3 100644 --- a/include/lapi/syscalls/mips_n64.in +++ b/include/lapi/syscalls/mips_n64.in @@ -350,3 +350,4 @@ landlock_create_ruleset 5444 landlock_add_rule 5445 landlock_restrict_self 5446 futex_waitv 5449 +fchmodat2 5452 diff --git a/include/lapi/syscalls/mips_o32.in b/include/lapi/syscalls/mips_o32.in index c2beffb75..30d42419e 100644 --- a/include/lapi/syscalls/mips_o32.in +++ b/include/lapi/syscalls/mips_o32.in @@ -420,3 +420,4 @@ landlock_create_ruleset 4444 landlock_add_rule 4445 landlock_restrict_self 4446 futex_waitv 4449 +fchmodat2 4452 diff --git a/include/lapi/syscalls/powerpc.in b/include/lapi/syscalls/powerpc.in index 5460e4197..2a2259841 100644 --- a/include/lapi/syscalls/powerpc.in +++ b/include/lapi/syscalls/powerpc.in @@ -427,3 +427,4 @@ landlock_create_ruleset 444 landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 +fchmodat2 452 diff --git a/include/lapi/syscalls/powerpc64.in b/include/lapi/syscalls/powerpc64.in index 5460e4197..2a2259841 100644 --- a/include/lapi/syscalls/powerpc64.in +++ b/include/lapi/syscalls/powerpc64.in @@ -427,3 +427,4 @@ landlock_create_ruleset 444 landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 +fchmodat2 452 diff --git a/include/lapi/syscalls/s390.in b/include/lapi/syscalls/s390.in index 275b27f47..656f5c118 100644 --- a/include/lapi/syscalls/s390.in +++ b/include/lapi/syscalls/s390.in @@ -414,3 +414,4 @@ landlock_create_ruleset 444 landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 +fchmodat2 452 diff --git a/include/lapi/syscalls/s390x.in b/include/lapi/syscalls/s390x.in index c200d02b2..46007bf89 100644 --- a/include/lapi/syscalls/s390x.in +++ b/include/lapi/syscalls/s390x.in @@ -362,3 +362,4 @@ landlock_create_ruleset 444 landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 +fchmodat2 452 diff --git a/include/lapi/syscalls/sh.in b/include/lapi/syscalls/sh.in index 6f482a77b..df7c1c378 100644 --- a/include/lapi/syscalls/sh.in +++ b/include/lapi/syscalls/sh.in @@ -408,3 +408,4 @@ landlock_create_ruleset 444 landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 +fchmodat2 452 diff --git a/include/lapi/syscalls/sparc.in b/include/lapi/syscalls/sparc.in index 7181e80a0..03030dd30 100644 --- a/include/lapi/syscalls/sparc.in +++ b/include/lapi/syscalls/sparc.in @@ -413,3 +413,4 @@ landlock_create_ruleset 444 landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 +fchmodat2 452 diff --git a/include/lapi/syscalls/sparc64.in b/include/lapi/syscalls/sparc64.in index c96ab2021..4ab40a5c5 100644 --- a/include/lapi/syscalls/sparc64.in +++ b/include/lapi/syscalls/sparc64.in @@ -378,3 +378,4 @@ landlock_create_ruleset 444 landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 +fchmodat2 452 diff --git a/include/lapi/syscalls/x86_64.in b/include/lapi/syscalls/x86_64.in index 3082ca110..57ffce837 100644 --- a/include/lapi/syscalls/x86_64.in +++ b/include/lapi/syscalls/x86_64.in @@ -355,6 +355,7 @@ landlock_create_ruleset 444 landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 +fchmodat2 452 rt_sigaction 512 rt_sigreturn 513 ioctl 514 From patchwork Wed Jul 24 09:45:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1964213 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=Av7Q0snf; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=NRBH3HhU; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=Av7Q0snf; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=NRBH3HhU; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WTTgT1ySFz1yXp for ; Wed, 24 Jul 2024 19:46:45 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 051863D0E76 for ; Wed, 24 Jul 2024 11:46:43 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 53FA73D1B59 for ; Wed, 24 Jul 2024 11:46:08 +0200 (CEST) Authentication-Results: in-6.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.de (client-ip=2a07:de40:b251:101:10:150:64:1; helo=smtp-out1.suse.de; envelope-from=andrea.cervesato@suse.de; receiver=lists.linux.it) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id C8E4814088EB for ; Wed, 24 Jul 2024 11:46:07 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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-out1.suse.de (Postfix) with ESMTPS id B460F21B22; Wed, 24 Jul 2024 09:46:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721814366; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wn4AUPCAINYbsjPHwo3Kzubjli8gEifZ3rcwEBGawAs=; b=Av7Q0snfWpUVmeHqRCBVeXXxjG0zVjY++hyfgTyieGtUXXFB6k6zlSy5/jUtNZIieizwKl nTa10njx1wJempD/vDxYKVBmy+Wn2oLwNkVRjNcGLHuMV35DgvHpAgShLsBbMVRXr10Va8 8f0tRZ6x4U4IUzvj9rEyRsl8FS+qJCE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721814366; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wn4AUPCAINYbsjPHwo3Kzubjli8gEifZ3rcwEBGawAs=; b=NRBH3HhU80sAlSv7M99t8gVx6iDyV97uPPIk78muZX5sgeQMHD7Sme9NYZMBM5XsCj4Wmo 7sXgeqjV14xCqXBw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721814366; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wn4AUPCAINYbsjPHwo3Kzubjli8gEifZ3rcwEBGawAs=; b=Av7Q0snfWpUVmeHqRCBVeXXxjG0zVjY++hyfgTyieGtUXXFB6k6zlSy5/jUtNZIieizwKl nTa10njx1wJempD/vDxYKVBmy+Wn2oLwNkVRjNcGLHuMV35DgvHpAgShLsBbMVRXr10Va8 8f0tRZ6x4U4IUzvj9rEyRsl8FS+qJCE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721814366; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wn4AUPCAINYbsjPHwo3Kzubjli8gEifZ3rcwEBGawAs=; b=NRBH3HhU80sAlSv7M99t8gVx6iDyV97uPPIk78muZX5sgeQMHD7Sme9NYZMBM5XsCj4Wmo 7sXgeqjV14xCqXBw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 164CC13411; Wed, 24 Jul 2024 09:46:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id UOXUNl3NoGYxWwAAD6G6ig (envelope-from ); Wed, 24 Jul 2024 09:46:05 +0000 From: Andrea Cervesato Date: Wed, 24 Jul 2024 11:45:33 +0200 MIME-Version: 1.0 Message-Id: <20240724-fchmodat2-v3-3-1dc7cfc634b8@suse.com> References: <20240724-fchmodat2-v3-0-1dc7cfc634b8@suse.com> In-Reply-To: <20240724-fchmodat2-v3-0-1dc7cfc634b8@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=798; i=andrea.cervesato@suse.com; h=from:subject:message-id; bh=coG/Sr6m6VtDhSTp55MPcNGf3m9wsY63eAFVUcXpPYE=; b=owEB7QES/pANAwAIAcvMGrIgs+ZGAcsmYgBmoM1EYAfd37PrirRCzD56BuG+U0oO0iSFjuEsP tp2zJhn//aJAbMEAAEIAB0WIQT1ysFzUKRW0sIb39jLzBqyILPmRgUCZqDNRAAKCRDLzBqyILPm RrP9C/0WmDWzph5dDp//kbHeRgzRj3VGlvSsXG5ZWJUoexUxfZWGCr5ozFurVB757c6vqEVl2j0 1oDgLPbeh5apCIqVJvYo1q6JkylirVZETcyBoTvK6FtgzKeH5x8NYOtIniZrYM+d4CXGlz151Vo gQHcZ812+06n4d909mqrhzw6u2qvEC1Zk2Nx46n+S/Kisjshtn6znpcwgX0N3r1vz1mLdH3RVVj wdTDxliziA/tYkfbzQoEN4/iN+FpLDBHgop+ygUbImD26aN7mU4UNXoq1aMYKLsT4QnFp5g9/gw a11ZkZi2B6DkSpjTQx7SYdJNgWao4Fsxrf1R/I9HIwkK+uwYjZYMdzEYSFqO4LwEmawA51X77nh HybWNA6+Sr8uut8Qnr+piyV7dOxBP+QcGRuWMbCqppvTDkVkVZ7pekGRO7qTBAqsxybjiYW3z86 GGh3f0PyiQ9FwFREgNgOJ8Sy4zueE5FpRWOkrcoCHwmytj9IjsIXBQ+9O4yt6cRP8tskY= X-Developer-Key: i=andrea.cervesato@suse.com; a=openpgp; fpr=F5CAC17350A456D2C21BDFD8CBCC1AB220B3E646 X-Spamd-Result: default: False [-4.10 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,imap1.dmz-prg2.suse.org:helo] X-Spam-Level: X-Spam-Score: -4.10 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-6.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-6.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v3 3/5] Add fchmodat2 fallback definition X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Andrea Cervesato Signed-off-by: Andrea Cervesato --- include/lapi/stat.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/lapi/stat.h b/include/lapi/stat.h index 3606c9eb0..5e289d3ca 100644 --- a/include/lapi/stat.h +++ b/include/lapi/stat.h @@ -229,4 +229,17 @@ static inline int statx(int dirfd, const char *pathname, unsigned int flags, # define STATX_ATTR_VERITY 0x00100000 #endif +static inline int fchmodat2( + int dfd, const char *filename, mode_t mode, int flags) +{ + int ret; + + ret = tst_syscall(__NR_fchmodat2, dfd, filename, mode, flags); + if (ret == -1) + tst_brk(TBROK | TERRNO, "%s(%d,%s,%d,%d) error", + __func__, dfd, filename, mode, flags); + + return ret; +} + #endif /* LAPI_STAT_H__ */ From patchwork Wed Jul 24 09:45:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1964215 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=i96ABX30; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Y9zSmmEp; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=i96ABX30; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Y9zSmmEp; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WTThF0Z9Kz1yXp for ; Wed, 24 Jul 2024 19:47:25 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id D94713D1C34 for ; Wed, 24 Jul 2024 11:47:22 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [IPv6:2001:4b78:1:20::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 764683D1C08 for ; Wed, 24 Jul 2024 11:46:09 +0200 (CEST) Authentication-Results: in-7.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.de (client-ip=2a07:de40:b251:101:10:150:64:1; helo=smtp-out1.suse.de; envelope-from=andrea.cervesato@suse.de; receiver=lists.linux.it) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id C63E120012F for ; Wed, 24 Jul 2024 11:46:08 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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-out1.suse.de (Postfix) with ESMTPS id BAEA721B27; Wed, 24 Jul 2024 09:46:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721814367; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NrK0dT7lZhLSEhaTatUzOdVXTlDrMIblJ/fjBTHEYVM=; b=i96ABX30Ov8ZL76vNSndcK9/YMNVD5OwSl1xyjU9n2JU9APknwaFuQAxQi9MWlqMcs69Ke mQe5aScHf1AGxKSCKy2A76tF2mlrqXQa77lvdwPMGQqgvo9dTpRWVjielcGUfIhBSMbFVm ULCdASB/4DRRA2dOLsQ8zFkL5PJILSc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721814367; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NrK0dT7lZhLSEhaTatUzOdVXTlDrMIblJ/fjBTHEYVM=; b=Y9zSmmEpgybcpyShvmoQAnrPEWkHzuBbqHbxo6LjHQHAzik3tT4eBb0MBPTs9cUz+F89mo 8x9rsidKEMTzRcAA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721814367; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NrK0dT7lZhLSEhaTatUzOdVXTlDrMIblJ/fjBTHEYVM=; b=i96ABX30Ov8ZL76vNSndcK9/YMNVD5OwSl1xyjU9n2JU9APknwaFuQAxQi9MWlqMcs69Ke mQe5aScHf1AGxKSCKy2A76tF2mlrqXQa77lvdwPMGQqgvo9dTpRWVjielcGUfIhBSMbFVm ULCdASB/4DRRA2dOLsQ8zFkL5PJILSc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721814367; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NrK0dT7lZhLSEhaTatUzOdVXTlDrMIblJ/fjBTHEYVM=; b=Y9zSmmEpgybcpyShvmoQAnrPEWkHzuBbqHbxo6LjHQHAzik3tT4eBb0MBPTs9cUz+F89mo 8x9rsidKEMTzRcAA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1FDA113411; Wed, 24 Jul 2024 09:46:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id wKUbOF7NoGYxWwAAD6G6ig (envelope-from ); Wed, 24 Jul 2024 09:46:06 +0000 From: Andrea Cervesato Date: Wed, 24 Jul 2024 11:45:34 +0200 MIME-Version: 1.0 Message-Id: <20240724-fchmodat2-v3-4-1dc7cfc634b8@suse.com> References: <20240724-fchmodat2-v3-0-1dc7cfc634b8@suse.com> In-Reply-To: <20240724-fchmodat2-v3-0-1dc7cfc634b8@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4524; i=andrea.cervesato@suse.com; h=from:subject:message-id; bh=uA89MOoxhJpTVqLDiOsJZcR3M+atTlwjV1H6cElX+Vc=; b=owEB7QES/pANAwAIAcvMGrIgs+ZGAcsmYgBmoM1EUmjMoBAETxIdpYSPBwV/0/Yp7D5sqaLMc AQQxxL2PN+JAbMEAAEIAB0WIQT1ysFzUKRW0sIb39jLzBqyILPmRgUCZqDNRAAKCRDLzBqyILPm Rt7RDACL8oV52B/bQx50vHiRY5Dp6IzgZPCyiJUr47yMa8kHw/9aCj7RiEEwr5yq0aX6aMnscoY Vw9UHU91+VQMpN76/dq7VQWHYzHoeHH/kej4ZSMJGF0Vjpgeq86w+Ws5KXB9Qm9JGw26cVnpSVl 9/riR4Z83dKhMfFUouGXwvTW4B129E4AhsFNV368LFStpQO7FIBXqAKi5vjm16lNDX64Qk/Ih6W cCcUnYjV3EPuRXQvO5Q8Hpp9941sXZhLPSc23ikM+arQoplPfLxkbGWz6U3RZLCbbziTDyNVyPQ plPWw2PhWCdNsxYNmJ4OLPFH4vWZp+DFM3m5aUn+SkgH8s2EEp4WjcWUDVFlz0TeILQUgtDvYVJ eb7tx/p+uL7YLu1iPWNBBtgkD81O2IPb7jzY/yGGwKCwRe3IsRdhjemxWxXXj5xSfHESBDlJ2JV AGxPftjlVJ117b2AWveGZMPf1INh1guulddljFF/2/TXXxnu4G+AYnVMW6rsKWCXTX5zI= X-Developer-Key: i=andrea.cervesato@suse.com; a=openpgp; fpr=F5CAC17350A456D2C21BDFD8CBCC1AB220B3E646 X-Spamd-Result: default: False [-4.10 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,imap1.dmz-prg2.suse.org:helo] X-Spam-Level: X-Spam-Score: -4.10 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-7.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-7.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v3 4/5] Add fchmodat2_01 test X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Andrea Cervesato This test verifies that fchmodat2() syscall is properly working with AT_SYMLINK_NOFOLLOW on regular files. Signed-off-by: Andrea Cervesato --- runtest/syscalls | 2 + testcases/kernel/syscalls/fchmodat2/.gitignore | 1 + testcases/kernel/syscalls/fchmodat2/Makefile | 7 ++ testcases/kernel/syscalls/fchmodat2/fchmodat2_01.c | 114 +++++++++++++++++++++ 4 files changed, 124 insertions(+) diff --git a/runtest/syscalls b/runtest/syscalls index 27eb9a86b..b4bb4f391 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -265,6 +265,8 @@ fchmod06 fchmod06 fchmodat01 fchmodat01 fchmodat02 fchmodat02 +fchmodat2_01 fchmodat2_01 + fchown01 fchown01 fchown01_16 fchown01_16 fchown02 fchown02 diff --git a/testcases/kernel/syscalls/fchmodat2/.gitignore b/testcases/kernel/syscalls/fchmodat2/.gitignore new file mode 100644 index 000000000..47d5e2427 --- /dev/null +++ b/testcases/kernel/syscalls/fchmodat2/.gitignore @@ -0,0 +1 @@ +fchmodat2_01 diff --git a/testcases/kernel/syscalls/fchmodat2/Makefile b/testcases/kernel/syscalls/fchmodat2/Makefile new file mode 100644 index 000000000..8cf1b9024 --- /dev/null +++ b/testcases/kernel/syscalls/fchmodat2/Makefile @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2024 SUSE LLC Andrea Cervesato + +top_srcdir ?= ../../../.. + +include $(top_srcdir)/include/mk/testcases.mk +include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/testcases/kernel/syscalls/fchmodat2/fchmodat2_01.c b/testcases/kernel/syscalls/fchmodat2/fchmodat2_01.c new file mode 100644 index 000000000..a00c06bf5 --- /dev/null +++ b/testcases/kernel/syscalls/fchmodat2/fchmodat2_01.c @@ -0,0 +1,114 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2024 SUSE LLC Andrea Cervesato + */ + +/*\ + * [Description] + * + * This test verifies that fchmodat2() syscall is properly working with + * AT_SYMLINK_NOFOLLOW regular files, symbolic links and directories. + */ + +#include "tst_test.h" +#include "tst_safe_file_at.h" +#include "lapi/fcntl.h" +#include "lapi/stat.h" + +#define MNTPOINT "mntpoint" +#define FNAME "myfile" +#define SNAME "symlink" +#define DNAME "mydir" +#define DNAME_PATH MNTPOINT"/"DNAME + +static int fd_dir = -1; + +static void verify_mode(int dirfd, const char *path, mode_t mode) +{ + struct stat st; + + SAFE_FSTATAT(dirfd, path, &st, AT_SYMLINK_NOFOLLOW); + TST_EXP_EQ_LI(st.st_mode, mode); +} + +static void test_regular_file(void) +{ + tst_res(TINFO, "Using regular files"); + + SAFE_CHMOD(MNTPOINT"/"FNAME, 0640); + + TST_EXP_PASS(fchmodat2(fd_dir, FNAME, 0700, 0)); + verify_mode(fd_dir, FNAME, S_IFREG | 0700); + + TST_EXP_PASS(fchmodat2(fd_dir, FNAME, 0700, AT_SYMLINK_NOFOLLOW)); + verify_mode(fd_dir, FNAME, S_IFREG | 0700); +} + +static void test_symbolic_link(void) +{ + tst_res(TINFO, "Using symbolic link"); + + TST_EXP_PASS(fchmodat2(fd_dir, SNAME, 0700, 0)); + verify_mode(fd_dir, FNAME, S_IFREG | 0700); + verify_mode(fd_dir, SNAME, S_IFLNK | 0777); + + TST_EXP_PASS(fchmodat2(fd_dir, SNAME, 0640, AT_SYMLINK_NOFOLLOW)); + verify_mode(fd_dir, FNAME, S_IFREG | 0700); + verify_mode(fd_dir, SNAME, S_IFLNK | 0640); +} + +static void test_empty_folder(void) +{ + tst_res(TINFO, "Using empty folder"); + + int fd; + + SAFE_CHMOD(DNAME_PATH, 0640); + fd = SAFE_OPEN(DNAME_PATH, O_PATH | O_DIRECTORY, 0640); + + TST_EXP_PASS(fchmodat2(fd, "", 0777, AT_EMPTY_PATH)); + verify_mode(fd_dir, DNAME, S_IFDIR | 0777); + + SAFE_CLOSE(fd); +} + +static void run(void) +{ + test_regular_file(); + test_empty_folder(); + test_symbolic_link(); +} + +static void setup(void) +{ + fd_dir = SAFE_OPEN(MNTPOINT, O_PATH | O_DIRECTORY, 0640); + + if (access(DNAME_PATH, F_OK) == -1) + SAFE_MKDIR(DNAME_PATH, 0640); + + SAFE_TOUCH(MNTPOINT"/"FNAME, 0640, NULL); + SAFE_SYMLINKAT(FNAME, fd_dir, SNAME); +} + +static void cleanup(void) +{ + SAFE_UNLINKAT(fd_dir, SNAME, 0); + SAFE_RMDIR(DNAME_PATH); + + if (fd_dir != -1) + SAFE_CLOSE(fd_dir); +} + +static struct tst_test test = { + .test_all = run, + .setup = setup, + .cleanup = cleanup, + .min_kver = "6.6", + .mntpoint = MNTPOINT, + .format_device = 1, + .all_filesystems = 1, + .skip_filesystems = (const char *const []) { + "fuse", + NULL + }, +}; From patchwork Wed Jul 24 09:45:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1964216 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=iIYEVxUf; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=qakqwV2p; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=iIYEVxUf; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=qakqwV2p; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WTThY64B6z1yXp for ; Wed, 24 Jul 2024 19:47:41 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id A2A8E3D1C43 for ; Wed, 24 Jul 2024 11:47:39 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [IPv6:2001:4b78:1:20::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id BF7A83D1C1D for ; Wed, 24 Jul 2024 11:46:10 +0200 (CEST) Authentication-Results: in-3.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.de (client-ip=2a07:de40:b251:101:10:150:64:2; helo=smtp-out2.suse.de; envelope-from=andrea.cervesato@suse.de; receiver=lists.linux.it) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id B21101A01988 for ; Wed, 24 Jul 2024 11:46:09 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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-out2.suse.de (Postfix) with ESMTPS id AEB0C1F799; Wed, 24 Jul 2024 09:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721814368; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M0rEv2nrfqt3ge1Vwty0JzWUB0Z5dm11yOrV+8qlVx0=; b=iIYEVxUfNzMXU0f98An9+nzxDaonK64mqKNvne1tkk173docPHSlrw/6wAREyyT/XK3lPS Rz4tyuRFiILpwKLol9phqrQjEvQ1U7SX20RzSnDtCfJOcrvrl4NPRX0uLFAR9MhJ9ZFUNh KS4hcTm969Q5uj03odR40F13ej36edw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721814368; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M0rEv2nrfqt3ge1Vwty0JzWUB0Z5dm11yOrV+8qlVx0=; b=qakqwV2pX8qucOrpNydXcu+5EgymOCOyWh7T5ajCM/SM5lZqFP+c4ytBxkmnGFsCs87oro ipALgEBBAyUh7mAg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721814368; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M0rEv2nrfqt3ge1Vwty0JzWUB0Z5dm11yOrV+8qlVx0=; b=iIYEVxUfNzMXU0f98An9+nzxDaonK64mqKNvne1tkk173docPHSlrw/6wAREyyT/XK3lPS Rz4tyuRFiILpwKLol9phqrQjEvQ1U7SX20RzSnDtCfJOcrvrl4NPRX0uLFAR9MhJ9ZFUNh KS4hcTm969Q5uj03odR40F13ej36edw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721814368; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M0rEv2nrfqt3ge1Vwty0JzWUB0Z5dm11yOrV+8qlVx0=; b=qakqwV2pX8qucOrpNydXcu+5EgymOCOyWh7T5ajCM/SM5lZqFP+c4ytBxkmnGFsCs87oro ipALgEBBAyUh7mAg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 0F12D13411; Wed, 24 Jul 2024 09:46:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id sAEzNF/NoGYxWwAAD6G6ig (envelope-from ); Wed, 24 Jul 2024 09:46:07 +0000 From: Andrea Cervesato Date: Wed, 24 Jul 2024 11:45:35 +0200 MIME-Version: 1.0 Message-Id: <20240724-fchmodat2-v3-5-1dc7cfc634b8@suse.com> References: <20240724-fchmodat2-v3-0-1dc7cfc634b8@suse.com> In-Reply-To: <20240724-fchmodat2-v3-0-1dc7cfc634b8@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2700; i=andrea.cervesato@suse.com; h=from:subject:message-id; bh=3NhMXj7DCJcgn1hU5AL0jVK6oGmlwbBr14uXLXw3MiU=; b=owEB7QES/pANAwAIAcvMGrIgs+ZGAcsmYgBmoM1E2tECZuEE7S0va05y7j+7X2GQ2MavFvZR8 ck0no12lfuJAbMEAAEIAB0WIQT1ysFzUKRW0sIb39jLzBqyILPmRgUCZqDNRAAKCRDLzBqyILPm RmALC/9oPRmhWLDT5kTQ0DG2s39goo4K8dlRwHsNO1VfR5Skwx80Xk8Y8i3yWCVkIrC8vup0iLC YYAF8/7ckGDcidIAAQ3Ox2S4KAHijj3mftO06+SGA/uxyxZJXDpoObDZ4RhrLBetUqXfevDMo83 qHjC5+DXJPYuaaTVGAQE2Xr0rza1P1nw1lyr2/7R7ejHp00CGsowzCObuCf2xQ/YWG01BdlEual OTARqjNlkhnBZ/IqYnvF8zFkqQL+IGbVBd5Qdb+kP0/T/QMsHQYJz4pQZt/UV2x9RRsX6zALrDH KpuX+J01jsO3gjNWve7CDYwY8JkAq9xtiFdUiDs6EddtYgPru5QTAkIlvC0U07q4lX+Zpl7XP8H jMoaHf9rJXE3MYhNkl+ERLvc2ZLatOPcz3lbr+wkS2aTVUXtAkB20WXfQGgICLUEfGsovmTU5Ji /zEKAS4Ydx2oVQijApKF3EVafaxYVirVXslyVZ5R1IP5Ia3lTqW96D8J2KqlI+Om91O2o= X-Developer-Key: i=andrea.cervesato@suse.com; a=openpgp; fpr=F5CAC17350A456D2C21BDFD8CBCC1AB220B3E646 X-Spamd-Result: default: False [-4.10 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.com:email] X-Spam-Level: X-Spam-Score: -4.10 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-3.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-3.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v3 5/5] Add fchmodat2_02 test X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Andrea Cervesato This test verifies that fchmodat2() syscall properly raises errors with invalid arguments. Signed-off-by: Andrea Cervesato --- runtest/syscalls | 1 + testcases/kernel/syscalls/fchmodat2/.gitignore | 1 + testcases/kernel/syscalls/fchmodat2/fchmodat2_02.c | 68 ++++++++++++++++++++++ 3 files changed, 70 insertions(+) diff --git a/runtest/syscalls b/runtest/syscalls index b4bb4f391..5cbcf3a4c 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -266,6 +266,7 @@ fchmodat01 fchmodat01 fchmodat02 fchmodat02 fchmodat2_01 fchmodat2_01 +fchmodat2_02 fchmodat2_02 fchown01 fchown01 fchown01_16 fchown01_16 diff --git a/testcases/kernel/syscalls/fchmodat2/.gitignore b/testcases/kernel/syscalls/fchmodat2/.gitignore index 47d5e2427..9f713198c 100644 --- a/testcases/kernel/syscalls/fchmodat2/.gitignore +++ b/testcases/kernel/syscalls/fchmodat2/.gitignore @@ -1 +1,2 @@ fchmodat2_01 +fchmodat2_02 diff --git a/testcases/kernel/syscalls/fchmodat2/fchmodat2_02.c b/testcases/kernel/syscalls/fchmodat2/fchmodat2_02.c new file mode 100644 index 000000000..f8497d8a8 --- /dev/null +++ b/testcases/kernel/syscalls/fchmodat2/fchmodat2_02.c @@ -0,0 +1,68 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2024 SUSE LLC Andrea Cervesato + */ + +/*\ + * [Description] + * + * This test verifies that fchmodat2() syscall properly raises errors with + * invalid values. + */ + +#include "tst_test.h" +#include "lapi/fcntl.h" +#include "lapi/syscalls.h" +#include "tst_tmpdir.h" + +#define FILENAME "file.bin" + +static char *tmpdir; +static int fd; +static int fd_invalid = -1; + +static struct tcase { + int *fd; + char *fname; + int mode; + int flag; + int exp_errno; + char *msg; +} tcases[] = { + {&fd_invalid, FILENAME, 0777, 0, EBADF, "bad file descriptor"}, + {&fd, "doesnt_exist.txt", 0777, 0, ENOENT, "unexisting file"}, + {&fd, FILENAME, 0777, -1, EINVAL, "invalid flags"}, +}; + +static void run(unsigned int i) +{ + struct tcase *tc = &tcases[i]; + + TST_EXP_FAIL(tst_syscall(__NR_fchmodat2, + *tc->fd, tc->fname, tc->mode, tc->flag), + tc->exp_errno, + "Test %s", tc->msg); +} + +static void setup(void) +{ + tmpdir = tst_tmpdir_path(); + + SAFE_TOUCH(FILENAME, 0640, NULL); + fd = SAFE_OPEN(tmpdir, O_PATH | O_DIRECTORY, 0640); +} + +static void cleanup(void) +{ + if (fd != -1) + SAFE_CLOSE(fd); +} + +static struct tst_test test = { + .test = run, + .tcnt = ARRAY_SIZE(tcases), + .setup = setup, + .cleanup = cleanup, + .needs_tmpdir = 1, +}; +