From patchwork Wed May 15 09:33:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1935406 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=VNkRfaZ0; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=diYEkZ2C; 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=VNkRfaZ0; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=diYEkZ2C; 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) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VfSj81V69z1ydW for ; Wed, 15 May 2024 19:34:03 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 2F2A33CF750 for ; Wed, 15 May 2024 11:34:00 +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 50B7E3CD986 for ; Wed, 15 May 2024 11:33:57 +0200 (CEST) Authentication-Results: in-4.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.de (client-ip=195.135.223.131; 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 [195.135.223.131]) (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 88DB8100034C for ; Wed, 15 May 2024 11:33:56 +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 A81F22048A; Wed, 15 May 2024 09:33:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715765635; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ln6zJMRE5VCtE9Y081k7QIT+S488GvK62i49+/E3FnM=; b=VNkRfaZ0B+OJhhqOtQZJKGCP3WEYAejA0CF+AnPIepfzt+3vZsoS2W5jvWXaY3r1FxHxV3 WrcQSNnYE1CFVzxNb1o/ebAtuTXejGvZZTPbd8xYVldGmV0XtOmGEAP9F3lhQs1IVABUI+ EU1MAlsODQjAig+vqabC23Hp5u/pP8E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715765635; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ln6zJMRE5VCtE9Y081k7QIT+S488GvK62i49+/E3FnM=; b=diYEkZ2CaC+cVlZtfhpypHXv1ju6QR65TEgwSyBfUM/4JC3UYX67rubUF5ssfdetcg+wr7 tWO6pxFr3qCJzYCw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=VNkRfaZ0; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=diYEkZ2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715765635; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ln6zJMRE5VCtE9Y081k7QIT+S488GvK62i49+/E3FnM=; b=VNkRfaZ0B+OJhhqOtQZJKGCP3WEYAejA0CF+AnPIepfzt+3vZsoS2W5jvWXaY3r1FxHxV3 WrcQSNnYE1CFVzxNb1o/ebAtuTXejGvZZTPbd8xYVldGmV0XtOmGEAP9F3lhQs1IVABUI+ EU1MAlsODQjAig+vqabC23Hp5u/pP8E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715765635; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ln6zJMRE5VCtE9Y081k7QIT+S488GvK62i49+/E3FnM=; b=diYEkZ2CaC+cVlZtfhpypHXv1ju6QR65TEgwSyBfUM/4JC3UYX67rubUF5ssfdetcg+wr7 tWO6pxFr3qCJzYCw== 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 7EDA813A62; Wed, 15 May 2024 09:33:55 +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 CJ7sHIOBRGb1TwAAD6G6ig (envelope-from ); Wed, 15 May 2024 09:33:55 +0000 From: Andrea Cervesato To: ltp@lists.linux.it Date: Wed, 15 May 2024 11:33:40 +0200 Message-Id: <20240515093349.7347-2-andrea.cervesato@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240515093349.7347-1-andrea.cervesato@suse.de> References: <20240515093349.7347-1-andrea.cervesato@suse.de> MIME-Version: 1.0 X-Spam-Level: X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; 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:+]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: A81F22048A X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Score: -3.01 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 v1 01/10] Add SAFE_STATX 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 Reviewed-by: Petr Vorel --- include/tst_safe_macros.h | 7 +++++++ lib/tst_safe_macros.c | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/include/tst_safe_macros.h b/include/tst_safe_macros.h index 8de8ef106..43ff50a33 100644 --- a/include/tst_safe_macros.h +++ b/include/tst_safe_macros.h @@ -503,4 +503,11 @@ int safe_sscanf(const char *file, const int lineno, const char *restrict buffer, #define SAFE_SSCANF(buffer, format, ...) \ safe_sscanf(__FILE__, __LINE__, (buffer), (format), ##__VA_ARGS__) +struct statx; +int safe_statx(const char *file, const int lineno, + int dirfd, const char *pathname, int flags, unsigned int mask, + struct statx *buf); +#define SAFE_STATX(dirfd, pathname, flags, mask, buf) \ + safe_statx(__FILE__, __LINE__, (dirfd), (pathname), (flags), (mask), (buf)) + #endif /* TST_SAFE_MACROS_H__ */ diff --git a/lib/tst_safe_macros.c b/lib/tst_safe_macros.c index 39b8cc924..bf2f3c0d8 100644 --- a/lib/tst_safe_macros.c +++ b/lib/tst_safe_macros.c @@ -710,3 +710,24 @@ int safe_mprotect(const char *file, const int lineno, return rval; } + +int safe_statx(const char *file, const int lineno, + int dirfd, const char *pathname, int flags, unsigned int mask, + struct statx *buf) +{ + int rval; + + rval = statx(dirfd, pathname, flags, mask, buf); + + if (rval == -1) { + tst_brk_(file, lineno, TBROK | TERRNO, + "statx(%d,%s,%d,%u,%p) failed", dirfd, pathname, flags, mask, buf); + } else if (rval) { + tst_brk_(file, lineno, TBROK | TERRNO, + "Invalid statx(%d,%s,%d,%u,%p) return value %d", + dirfd, pathname, flags, mask, buf, + rval); + } + + return rval; +}