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; +} From patchwork Wed May 15 09:33:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1935408 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=xa0ENKww; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=hp7YKLI0; 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=s7xbGbQH; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=E7ecEPnG; 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 4VfSjl2L8dz1ydW for ; Wed, 15 May 2024 19:34:35 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id DE3103CF7BF for ; Wed, 15 May 2024 11:34:32 +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)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id F2EE53CD986 for ; Wed, 15 May 2024 11:33:57 +0200 (CEST) Authentication-Results: in-3.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.de (client-ip=195.135.223.130; 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 [195.135.223.130]) (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 A01661A0BC27 for ; Wed, 15 May 2024 11:33:56 +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 E7C17339EE; 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=1715765636; 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=sZT4peIxZS592A6ZO4fOuEAwUJdoI7TWAATvRmmhGBE=; b=xa0ENKwwRWcgkzwn/GY/3xkp3GoPwxVvzoItlagRessBjm/Q1t0YK1I63j5HqWuMBkxPkZ eHZgZl1gMkgx/UwuSEKgqFcVOj7hFu1O7T00EzLlQnEohXqvbDWcZOoyO2CyhL/a4iUqlq FFnZt0RpebaEaOI3x/O9ugSpvYCcvTA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715765636; 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=sZT4peIxZS592A6ZO4fOuEAwUJdoI7TWAATvRmmhGBE=; b=hp7YKLI0Co+0jQ66AZ6RM69y+St/7LtT1lC9n1VRkJpB/PCpzEfxNkuH/jYmcadoEG05Cq /kJTpz3ir80YUFAQ== Authentication-Results: smtp-out1.suse.de; none 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=sZT4peIxZS592A6ZO4fOuEAwUJdoI7TWAATvRmmhGBE=; b=s7xbGbQHgMTfl9Q57hjC6i1dj1CSGMX7QhlyG36j/4XvJlwXPEshku1dyaIRZ+OXW8XJMz Tibhw3z753pdb3NKEr7abBoBfQRTSpD40JHX6W+guVWmTRd42KoX12yXwqMjrTpkweTGcL uTM61jLYUswykmWFTcY0rB84Xv1Abu8= 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=sZT4peIxZS592A6ZO4fOuEAwUJdoI7TWAATvRmmhGBE=; b=E7ecEPnGh2ysOZ2shrdJyZVPrBlfa+oNSoYjnZWtP1fA2EVpifdch9pMXRwY/EBG1tx+ez SuB9EKYj2lYpfTCQ== 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 B22E613A66; 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 ePNqKYOBRGb1TwAAD6G6ig (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:41 +0200 Message-Id: <20240515093349.7347-3-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-Score: -2.80 X-Spam-Level: X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; 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]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.com:email]; RCVD_TLS_ALL(0.00)[] 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 v1 02/10] Add listmount/statmount fallback declarations 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 --- configure.ac | 5 +++ include/lapi/mount.h | 67 ++++++++++++++++++++++++++++++ include/lapi/stat.h | 10 ++++- include/lapi/syscalls/aarch64.in | 2 + include/lapi/syscalls/arc.in | 2 + include/lapi/syscalls/arm.in | 2 + include/lapi/syscalls/hppa.in | 2 + include/lapi/syscalls/i386.in | 2 + include/lapi/syscalls/ia64.in | 2 + include/lapi/syscalls/loongarch.in | 2 + include/lapi/syscalls/mips_n32.in | 2 + include/lapi/syscalls/mips_n64.in | 2 + include/lapi/syscalls/mips_o32.in | 2 + include/lapi/syscalls/powerpc.in | 2 + include/lapi/syscalls/powerpc64.in | 2 + include/lapi/syscalls/s390.in | 2 + include/lapi/syscalls/s390x.in | 2 + include/lapi/syscalls/sh.in | 2 + include/lapi/syscalls/sparc.in | 2 + include/lapi/syscalls/sparc64.in | 2 + include/lapi/syscalls/x86_64.in | 2 + 21 files changed, 117 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 1f7aa70bd..95c91c6af 100644 --- a/configure.ac +++ b/configure.ac @@ -113,6 +113,7 @@ AC_CHECK_FUNCS_ONCE([ \ io_uring_register \ io_uring_enter \ kcmp \ + listmount \ mallinfo \ mallinfo2 \ mallopt \ @@ -142,6 +143,7 @@ AC_CHECK_FUNCS_ONCE([ \ setns \ sigpending \ splice \ + statmount \ statx \ stime \ sync_file_range \ @@ -232,6 +234,9 @@ AC_CHECK_TYPES([struct mount_attr],,,[ #endif ]) +AC_CHECK_TYPES([struct mnt_id_req],,,[#include ]) +AC_CHECK_TYPES([struct statmount],,,[#include ]) + # Tools knobs # Bash diff --git a/include/lapi/mount.h b/include/lapi/mount.h index c1af944fe..57542832f 100644 --- a/include/lapi/mount.h +++ b/include/lapi/mount.h @@ -37,4 +37,71 @@ # define MS_NOSYMFOLLOW 256 #endif +#ifndef HAVE_MNT_ID_REQ +struct mnt_id_req { + __u32 size; + __u32 spare; + __u64 mnt_id; + __u64 param; +}; +#endif + +#ifndef HAVE_STATMOUNT +struct statmount { + __u32 size; + __u32 __spare1; + __u64 mask; + __u32 sb_dev_major; + __u32 sb_dev_minor; + __u64 sb_magic; + __u32 sb_flags; + __u32 fs_type; + __u64 mnt_id; + __u64 mnt_parent_id; + __u32 mnt_id_old; + __u32 mnt_parent_id_old; + __u64 mnt_attr; + __u64 mnt_propagation; + __u64 mnt_peer_group; + __u64 mnt_master; + __u64 propagate_from; + __u32 mnt_root; + __u32 mnt_point; + __u64 __spare2[50]; + char str[]; +}; +#endif + +#ifndef MNT_ID_REQ_SIZE_VER0 +# define MNT_ID_REQ_SIZE_VER0 24 +#endif + +#ifndef STATMOUNT_SB_BASIC +# define STATMOUNT_SB_BASIC 0x00000001U +#endif + +#ifndef STATMOUNT_MNT_BASIC +# define STATMOUNT_MNT_BASIC 0x00000002U +#endif + +#ifndef STATMOUNT_PROPAGATE_FROM +# define STATMOUNT_PROPAGATE_FROM 0x00000004U +#endif + +#ifndef STATMOUNT_MNT_ROOT +# define STATMOUNT_MNT_ROOT 0x00000008U +#endif + +#ifndef STATMOUNT_MNT_POINT +# define STATMOUNT_MNT_POINT 0x00000010U +#endif + +#ifndef STATMOUNT_FS_TYPE +# define STATMOUNT_FS_TYPE 0x00000020U +#endif + +#ifndef LSMT_ROOT +# define LSMT_ROOT 0xffffffffffffffff +#endif + #endif /* LAPI_MOUNT_H__ */ diff --git a/include/lapi/stat.h b/include/lapi/stat.h index 3606c9eb0..84dc76faf 100644 --- a/include/lapi/stat.h +++ b/include/lapi/stat.h @@ -95,7 +95,11 @@ struct statx { uint32_t stx_dev_major; uint32_t stx_dev_minor; /* 0x90 */ - uint64_t __spare2[14]; + __u64 stx_mnt_id; + __u32 stx_dio_mem_align; + __u32 stx_dio_offset_align; + /* 0xa0 */ + __u64 __spare3[12]; /* 0x100 */ }; #endif @@ -229,4 +233,8 @@ static inline int statx(int dirfd, const char *pathname, unsigned int flags, # define STATX_ATTR_VERITY 0x00100000 #endif +#ifndef STATX_MNT_ID_UNIQUE +# define STATX_MNT_ID_UNIQUE 0x00004000U +#endif + #endif /* LAPI_STAT_H__ */ diff --git a/include/lapi/syscalls/aarch64.in b/include/lapi/syscalls/aarch64.in index 2cb6c2d87..3b32a3b2a 100644 --- a/include/lapi/syscalls/aarch64.in +++ b/include/lapi/syscalls/aarch64.in @@ -297,4 +297,6 @@ faccessat2 439 epoll_pwait2 441 quotactl_fd 443 futex_waitv 449 +statmount 457 +listmount 458 _sysctl 1078 diff --git a/include/lapi/syscalls/arc.in b/include/lapi/syscalls/arc.in index 3e2ee9061..1a3a908e4 100644 --- a/include/lapi/syscalls/arc.in +++ b/include/lapi/syscalls/arc.in @@ -317,3 +317,5 @@ faccessat2 439 epoll_pwait2 441 quotactl_fd 443 futex_waitv 449 +statmount 457 +listmount 458 diff --git a/include/lapi/syscalls/arm.in b/include/lapi/syscalls/arm.in index 7bdbca533..78d84549f 100644 --- a/include/lapi/syscalls/arm.in +++ b/include/lapi/syscalls/arm.in @@ -395,3 +395,5 @@ faccessat2 (__NR_SYSCALL_BASE+439) epoll_pwait2 (__NR_SYSCALL_BASE+441) quotactl_fd (__NR_SYSCALL_BASE+443) futex_waitv (__NR_SYSCALL_BASE+449) +statmount (__NR_SYSCALL_BASE+457) +listmount (__NR_SYSCALL_BASE+458) diff --git a/include/lapi/syscalls/hppa.in b/include/lapi/syscalls/hppa.in index 8ebdafafb..1f01a4a0c 100644 --- a/include/lapi/syscalls/hppa.in +++ b/include/lapi/syscalls/hppa.in @@ -44,3 +44,5 @@ faccessat2 439 epoll_pwait2 441 quotactl_fd 443 futex_waitv 449 +statmount 457 +listmount 458 diff --git a/include/lapi/syscalls/i386.in b/include/lapi/syscalls/i386.in index 1472631c4..f4e6589ab 100644 --- a/include/lapi/syscalls/i386.in +++ b/include/lapi/syscalls/i386.in @@ -431,3 +431,5 @@ faccessat2 439 epoll_pwait2 441 quotactl_fd 443 futex_waitv 449 +statmount 457 +listmount 458 diff --git a/include/lapi/syscalls/ia64.in b/include/lapi/syscalls/ia64.in index 0ea6e9722..dd8b8c79f 100644 --- a/include/lapi/syscalls/ia64.in +++ b/include/lapi/syscalls/ia64.in @@ -344,3 +344,5 @@ faccessat2 1463 epoll_pwait2 1465 quotactl_fd 1467 futex_waitv 1473 +statmount 1481 +listmount 1482 diff --git a/include/lapi/syscalls/loongarch.in b/include/lapi/syscalls/loongarch.in index 301f611f6..f48c0658c 100644 --- a/include/lapi/syscalls/loongarch.in +++ b/include/lapi/syscalls/loongarch.in @@ -305,3 +305,5 @@ memfd_secret 447 process_mrelease 448 futex_waitv 449 set_mempolicy_home_node 450 +statmount 457 +listmount 458 diff --git a/include/lapi/syscalls/mips_n32.in b/include/lapi/syscalls/mips_n32.in index e818c9d92..af5928c0e 100644 --- a/include/lapi/syscalls/mips_n32.in +++ b/include/lapi/syscalls/mips_n32.in @@ -371,3 +371,5 @@ epoll_pwait2 6441 mount_setattr 6442 quotactl_fd 6443 futex_waitv 6449 +statmount 6457 +listmount 6458 diff --git a/include/lapi/syscalls/mips_n64.in b/include/lapi/syscalls/mips_n64.in index 6e15f43b3..a6d83e2e0 100644 --- a/include/lapi/syscalls/mips_n64.in +++ b/include/lapi/syscalls/mips_n64.in @@ -347,3 +347,5 @@ epoll_pwait2 5441 mount_setattr 5442 quotactl_fd 5443 futex_waitv 5449 +statmount 5457 +listmount 5458 diff --git a/include/lapi/syscalls/mips_o32.in b/include/lapi/syscalls/mips_o32.in index 921d5d331..eda7388a3 100644 --- a/include/lapi/syscalls/mips_o32.in +++ b/include/lapi/syscalls/mips_o32.in @@ -417,3 +417,5 @@ epoll_pwait2 4441 mount_setattr 4442 quotactl_fd 4443 futex_waitv 4449 +statmount 4457 +listmount 4458 diff --git a/include/lapi/syscalls/powerpc.in b/include/lapi/syscalls/powerpc.in index 545d9d3d6..1b40ea53d 100644 --- a/include/lapi/syscalls/powerpc.in +++ b/include/lapi/syscalls/powerpc.in @@ -424,3 +424,5 @@ faccessat2 439 epoll_pwait2 441 quotactl_fd 443 futex_waitv 449 +statmount 457 +listmount 458 diff --git a/include/lapi/syscalls/powerpc64.in b/include/lapi/syscalls/powerpc64.in index 545d9d3d6..1b40ea53d 100644 --- a/include/lapi/syscalls/powerpc64.in +++ b/include/lapi/syscalls/powerpc64.in @@ -424,3 +424,5 @@ faccessat2 439 epoll_pwait2 441 quotactl_fd 443 futex_waitv 449 +statmount 457 +listmount 458 diff --git a/include/lapi/syscalls/s390.in b/include/lapi/syscalls/s390.in index 7213ac5f8..6593a4ff7 100644 --- a/include/lapi/syscalls/s390.in +++ b/include/lapi/syscalls/s390.in @@ -411,3 +411,5 @@ faccessat2 439 epoll_pwait2 441 quotactl_fd 443 futex_waitv 449 +statmount 457 +listmount 458 diff --git a/include/lapi/syscalls/s390x.in b/include/lapi/syscalls/s390x.in index 879012e2b..b98e727d6 100644 --- a/include/lapi/syscalls/s390x.in +++ b/include/lapi/syscalls/s390x.in @@ -359,3 +359,5 @@ faccessat2 439 epoll_pwait2 441 quotactl_fd 443 futex_waitv 449 +statmount 457 +listmount 458 diff --git a/include/lapi/syscalls/sh.in b/include/lapi/syscalls/sh.in index 7d5192a27..59178113e 100644 --- a/include/lapi/syscalls/sh.in +++ b/include/lapi/syscalls/sh.in @@ -405,3 +405,5 @@ faccessat2 439 epoll_pwait2 441 quotactl_fd 443 futex_waitv 449 +statmount 457 +listmount 458 diff --git a/include/lapi/syscalls/sparc.in b/include/lapi/syscalls/sparc.in index 91d2fb1c2..56a244ceb 100644 --- a/include/lapi/syscalls/sparc.in +++ b/include/lapi/syscalls/sparc.in @@ -410,3 +410,5 @@ faccessat2 439 epoll_pwait2 441 quotactl_fd 443 futex_waitv 449 +statmount 457 +listmount 458 diff --git a/include/lapi/syscalls/sparc64.in b/include/lapi/syscalls/sparc64.in index 1f2fc59b7..84051a600 100644 --- a/include/lapi/syscalls/sparc64.in +++ b/include/lapi/syscalls/sparc64.in @@ -375,3 +375,5 @@ faccessat2 439 epoll_pwait2 441 quotactl_fd 443 futex_waitv 449 +statmount 457 +listmount 458 diff --git a/include/lapi/syscalls/x86_64.in b/include/lapi/syscalls/x86_64.in index dc61aa56e..935c5d7bc 100644 --- a/include/lapi/syscalls/x86_64.in +++ b/include/lapi/syscalls/x86_64.in @@ -352,6 +352,8 @@ faccessat2 439 epoll_pwait2 441 quotactl_fd 443 futex_waitv 449 +statmount 457 +listmount 458 rt_sigaction 512 rt_sigreturn 513 ioctl 514 From patchwork Wed May 15 09:33:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1935412 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=of0bwz8V; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=/7EotKSN; 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=of0bwz8V; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=/7EotKSN; 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 4VfSl52k4xz1ymw for ; Wed, 15 May 2024 19:35:45 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 0303E3CF7E9 for ; Wed, 15 May 2024 11:35:43 +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 65CEC3CD986 for ; Wed, 15 May 2024 11:33:58 +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 B11EF10009E2 for ; Wed, 15 May 2024 11:33:57 +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 25339339F0; Wed, 15 May 2024 09:33:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715765636; 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=bFp1ujAIA/zECwSOzdfpYjXhDcjJ+Dn3X0D6RjX8hSs=; b=of0bwz8VwDmLywKjeeVwLeRH7coi+7eMQMXzo3wZ+1l63bY00Y1v8pktBuTvUDXl/sD1Yn BfVHnA1dAlUKRhuzPzA82z+ERxatw6Gd7RrMuQxZ6q895VdHxSdrjIz5UZHB/jNfglLlNR Mgnz2XzjP+60nOunt4TQUbYxAAU0g6w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715765636; 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=bFp1ujAIA/zECwSOzdfpYjXhDcjJ+Dn3X0D6RjX8hSs=; b=/7EotKSNeawi3E0Yuc4N1RJSVRMf2bF5Ke3bwxhoQ2J81NDYuScUoKhOeLFJY1GK5mrT0y X14XB6hZO/e1e3Cw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=of0bwz8V; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="/7EotKSN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715765636; 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=bFp1ujAIA/zECwSOzdfpYjXhDcjJ+Dn3X0D6RjX8hSs=; b=of0bwz8VwDmLywKjeeVwLeRH7coi+7eMQMXzo3wZ+1l63bY00Y1v8pktBuTvUDXl/sD1Yn BfVHnA1dAlUKRhuzPzA82z+ERxatw6Gd7RrMuQxZ6q895VdHxSdrjIz5UZHB/jNfglLlNR Mgnz2XzjP+60nOunt4TQUbYxAAU0g6w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715765636; 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=bFp1ujAIA/zECwSOzdfpYjXhDcjJ+Dn3X0D6RjX8hSs=; b=/7EotKSNeawi3E0Yuc4N1RJSVRMf2bF5Ke3bwxhoQ2J81NDYuScUoKhOeLFJY1GK5mrT0y X14XB6hZO/e1e3Cw== 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 002B31372E; 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 kAutOYOBRGb1TwAAD6G6ig (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:42 +0200 Message-Id: <20240515093349.7347-4-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:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,suse.de:dkim,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; 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: 25339339F0 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 03/10] Add listmount01 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 listmount() is properly recognizing a mounted root directory using LSMT_ROOT flag. Signed-off-by: Andrea Cervesato --- runtest/syscalls | 2 + .../kernel/syscalls/listmount/.gitignore | 1 + testcases/kernel/syscalls/listmount/Makefile | 7 ++ .../kernel/syscalls/listmount/listmount.h | 26 ++++++++ .../kernel/syscalls/listmount/listmount01.c | 66 +++++++++++++++++++ 5 files changed, 102 insertions(+) create mode 100644 testcases/kernel/syscalls/listmount/.gitignore create mode 100644 testcases/kernel/syscalls/listmount/Makefile create mode 100644 testcases/kernel/syscalls/listmount/listmount.h create mode 100644 testcases/kernel/syscalls/listmount/listmount01.c diff --git a/runtest/syscalls b/runtest/syscalls index d9cf37510..8fd4a9a0a 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -706,6 +706,8 @@ linkat02 linkat02 listen01 listen01 +listmount01 listmount01 + listxattr01 listxattr01 listxattr02 listxattr02 listxattr03 listxattr03 diff --git a/testcases/kernel/syscalls/listmount/.gitignore b/testcases/kernel/syscalls/listmount/.gitignore new file mode 100644 index 000000000..5257b298c --- /dev/null +++ b/testcases/kernel/syscalls/listmount/.gitignore @@ -0,0 +1 @@ +listmount01 diff --git a/testcases/kernel/syscalls/listmount/Makefile b/testcases/kernel/syscalls/listmount/Makefile new file mode 100644 index 000000000..8cf1b9024 --- /dev/null +++ b/testcases/kernel/syscalls/listmount/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/listmount/listmount.h b/testcases/kernel/syscalls/listmount/listmount.h new file mode 100644 index 000000000..93766cd33 --- /dev/null +++ b/testcases/kernel/syscalls/listmount/listmount.h @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2024 SUSE LLC Andrea Cervesato + */ + +#ifndef LISTMOUNT_H + +#define _GNU_SOURCE + +#include "tst_test.h" +#include "lapi/mount.h" +#include "lapi/syscalls.h" + +static inline ssize_t listmount(uint64_t mnt_id, uint64_t last_mnt_id, + uint64_t list[], size_t num, unsigned int flags) +{ + struct mnt_id_req req = { + .size = MNT_ID_REQ_SIZE_VER0, + .mnt_id = mnt_id, + .param = last_mnt_id, + }; + + return tst_syscall(__NR_listmount, &req, list, num, flags); +} + +#endif diff --git a/testcases/kernel/syscalls/listmount/listmount01.c b/testcases/kernel/syscalls/listmount/listmount01.c new file mode 100644 index 000000000..20cc90507 --- /dev/null +++ b/testcases/kernel/syscalls/listmount/listmount01.c @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2024 SUSE LLC Andrea Cervesato + */ + +/** + * [Description] + * + * This test verifies that listmount() is properly recognizing a mounted + * root directory using LSMT_ROOT flag. + * + * [Algorithm] + * + * * move into a new unshared namespace + * * mount() a root inside temporary folder and get its mount ID + * * get list of mounted IDs using listmount(LSMT_ROOT, ..) + * * verify that the root mount ID is the only mount ID present inside the list + */ + +#include "listmount.h" +#include "lapi/stat.h" +#include "lapi/sched.h" + +#define MNTPOINT "mntpoint" +#define LISTSIZE 32 + +static uint64_t root_id; + +static void run(void) +{ + uint64_t list[LISTSIZE]; + + TST_EXP_POSITIVE(listmount(LSMT_ROOT, 0, list, LISTSIZE, 0)); + if (TST_RET == -1) + return; + + TST_EXP_EQ_LI(TST_RET, 1); + TST_EXP_EQ_LI(list[0], root_id); +} + +static void setup(void) +{ + struct statx sx; + + SAFE_UNSHARE(CLONE_NEWNS); + + SAFE_CHROOT(MNTPOINT); + SAFE_MOUNT("", "/", NULL, MS_REC | MS_PRIVATE, NULL); + SAFE_STATX(AT_FDCWD, "/", 0, STATX_MNT_ID_UNIQUE, &sx); + + root_id = sx.stx_mnt_id; +} + +static struct tst_test test = { + .test_all = run, + .setup = setup, + .forks_child = 1, + .min_kver = "6.8", + .mount_device = 1, + .mntpoint = MNTPOINT, + .all_filesystems = 1, + .skip_filesystems = (const char *const []) { + "fuse", + NULL + }, +}; From patchwork Wed May 15 09:33:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1935407 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=StPS7ZHA; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=lkMYKAfa; 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=StPS7ZHA; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=lkMYKAfa; 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 4VfSjR1MPWz1ydW for ; Wed, 15 May 2024 19:34:19 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id D8C1C3CF785 for ; Wed, 15 May 2024 11:34:16 +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 751263CD986 for ; Wed, 15 May 2024 11:33:57 +0200 (CEST) Authentication-Results: in-3.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.de (client-ip=195.135.223.130; 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 [195.135.223.130]) (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 C83F61A0BC2C 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-out1.suse.de (Postfix) with ESMTPS id 58473339F2; Wed, 15 May 2024 09:33:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715765636; 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=7t6HtRml77kFvTFKI6ZlzSMqN0i1+8wET235ZCa8dnw=; b=StPS7ZHAJxZc335wpFDmxNpxM4ZlDWghpdbBQ6wCqNnGmaiA1xin0YhwaGj6qk1cLT3nt4 Y3cKq5EngXCG843ssf2KZFDxcySMYA3QS9s0ogbi6gRFJoI6IqEFBeLx3vZkyCSE04nRf9 32nJnTJghYHd8fthx7U6lTc0XtUwYNU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715765636; 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=7t6HtRml77kFvTFKI6ZlzSMqN0i1+8wET235ZCa8dnw=; b=lkMYKAfaNlPF7ALyUYC2whbIMnXL1lTwRvYtALy/C6c/EUVrLjyWQ1J+AxPzf+hJ8XphE6 I+5nuHSI2ZAOfVCw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=StPS7ZHA; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=lkMYKAfa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715765636; 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=7t6HtRml77kFvTFKI6ZlzSMqN0i1+8wET235ZCa8dnw=; b=StPS7ZHAJxZc335wpFDmxNpxM4ZlDWghpdbBQ6wCqNnGmaiA1xin0YhwaGj6qk1cLT3nt4 Y3cKq5EngXCG843ssf2KZFDxcySMYA3QS9s0ogbi6gRFJoI6IqEFBeLx3vZkyCSE04nRf9 32nJnTJghYHd8fthx7U6lTc0XtUwYNU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715765636; 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=7t6HtRml77kFvTFKI6ZlzSMqN0i1+8wET235ZCa8dnw=; b=lkMYKAfaNlPF7ALyUYC2whbIMnXL1lTwRvYtALy/C6c/EUVrLjyWQ1J+AxPzf+hJ8XphE6 I+5nuHSI2ZAOfVCw== 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 31CF513A62; Wed, 15 May 2024 09:33:56 +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 KF83CoSBRGb1TwAAD6G6ig (envelope-from ); Wed, 15 May 2024 09:33:56 +0000 From: Andrea Cervesato To: ltp@lists.linux.it Date: Wed, 15 May 2024 11:33:43 +0200 Message-Id: <20240515093349.7347-5-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-Score: -3.01 X-Rspamd-Action: no action X-Rspamd-Queue-Id: 58473339F2 X-Spam-Level: X-Rspamd-Server: rspamd2.dmz-prg2.suse.org 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:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim,suse.com:email]; 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-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 v1 04/10] Add listmount02 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 listmount() is properly reading groups of mount IDs. Signed-off-by: Andrea Cervesato --- runtest/syscalls | 1 + .../kernel/syscalls/listmount/.gitignore | 1 + .../kernel/syscalls/listmount/listmount02.c | 106 ++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 testcases/kernel/syscalls/listmount/listmount02.c diff --git a/runtest/syscalls b/runtest/syscalls index 8fd4a9a0a..355c182f8 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -707,6 +707,7 @@ linkat02 linkat02 listen01 listen01 listmount01 listmount01 +listmount02 listmount02 listxattr01 listxattr01 listxattr02 listxattr02 diff --git a/testcases/kernel/syscalls/listmount/.gitignore b/testcases/kernel/syscalls/listmount/.gitignore index 5257b298c..30bbf9f02 100644 --- a/testcases/kernel/syscalls/listmount/.gitignore +++ b/testcases/kernel/syscalls/listmount/.gitignore @@ -1 +1,2 @@ listmount01 +listmount02 diff --git a/testcases/kernel/syscalls/listmount/listmount02.c b/testcases/kernel/syscalls/listmount/listmount02.c new file mode 100644 index 000000000..712f17a50 --- /dev/null +++ b/testcases/kernel/syscalls/listmount/listmount02.c @@ -0,0 +1,106 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2024 SUSE LLC Andrea Cervesato + */ + +/** + * [Description] + * + * This test verifies that listmount() is properly reading groups of mount IDs. + * + * [Algorithm] + * + * * move into a new unshared namespace + * * mount() our new root inside temporary folder + * * generate a full mounts tree inside root folder + * * read the full list of mounted IDs using listmount(LSMT_ROOT, ..) + * * read the list of mounted IDs using groups of fixed size + * * compare the first mount list with the second mount list + */ + +#include "listmount.h" +#include "lapi/sched.h" + +#define MNTPOINT "mntpoint" +#define BIND_MOUNTS 7 +#define GROUPS_SIZE 3 +#define LISTSIZE (1 << BIND_MOUNTS) + +static void run(void) +{ + ssize_t ret; + size_t id, tot_ids, count = 0; + uint64_t mount_ids[LISTSIZE]; + uint64_t list[LISTSIZE]; + + for (int i = 0; i < BIND_MOUNTS; i++) + SAFE_MOUNT("/", "/", NULL, MS_BIND, NULL); + + tst_res(TINFO, "Reading all %d mount IDs in once", LISTSIZE); + + TST_EXP_POSITIVE(listmount(LSMT_ROOT, 0, mount_ids, LISTSIZE, 0)); + if (TST_RET == -1) + goto end; + + tot_ids = (size_t)TST_RET; + + if (tot_ids != LISTSIZE) { + tst_res(TFAIL, "listmount() returned %lu but %d was expected", + tot_ids, LISTSIZE); + goto end; + } + + tst_res(TINFO, "Reading groups of %d mount IDs", GROUPS_SIZE); + + while (count < LISTSIZE) { + id = count ? list[count - 1] : 0; + ret = listmount(LSMT_ROOT, id, list + count, GROUPS_SIZE, 0); + + tst_res(TDEBUG, "listmount(LSMT_ROOT, %lu, list + %lu, %d, 0)", + id, count, GROUPS_SIZE); + + if (ret == -1) { + tst_res(TFAIL, "listmount() failed with %s", tst_strerrno(errno)); + goto end; + } + + count += ret; + + if (TST_RET < GROUPS_SIZE) + break; + } + + for (size_t i = 0; i < LISTSIZE; i++) { + if (mount_ids[i] != list[i]) { + tst_res(TFAIL, "Mount ID differs at %ld index", i); + goto end; + } + } + + tst_res(TPASS, "All mount IDs have been correctly read"); + +end: + SAFE_UMOUNT("/"); +} + +static void setup(void) +{ + SAFE_UNSHARE(CLONE_NEWNS); + SAFE_CHROOT(MNTPOINT); + + SAFE_MOUNT("", "/", NULL, MS_REC | MS_SHARED, NULL); +} + +static struct tst_test test = { + .test_all = run, + .setup = setup, + .forks_child = 1, + .min_kver = "6.8", + .mount_device = 1, + .mntpoint = MNTPOINT, + .all_filesystems = 1, + .skip_filesystems = (const char *const []) { + "fuse", + NULL + }, +}; From patchwork Wed May 15 09:33:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1935411 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=BuqwQ7Q4; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=FK7rG8oq; 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=BuqwQ7Q4; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=FK7rG8oq; 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 4VfSkn4NTZz1ymw for ; Wed, 15 May 2024 19:35:29 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 3167F3CF772 for ; Wed, 15 May 2024 11:35:27 +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)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 486023CF672 for ; Wed, 15 May 2024 11:33:58 +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 A6AEF1A0BC2C for ; Wed, 15 May 2024 11:33:57 +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 8AB382048B; Wed, 15 May 2024 09:33:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715765636; 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=B6eURaw0BpIjuDhs+K4lJN3NGByIlcvSsqcfPYpTYwg=; b=BuqwQ7Q4XQCtvZHFoTY8sweeG2az7TZj3HqwolbREd5GJb78dlReTZz6U5pJXQ1qexpJ6R J7icEMulizAOA/tz5IB1yIzvYqCBVRvvZRMl3oUqT/HP/f3NMcjgAhLORzVEJqfe4qn5vC DwcuQ0oqcl00YrUn4mr3Vhy02FbqEP0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715765636; 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=B6eURaw0BpIjuDhs+K4lJN3NGByIlcvSsqcfPYpTYwg=; b=FK7rG8oqfLIsCAVljY8atAeOxpdvPQVAtzyCDLkZ/MsumauhOBhCff2jG3Z/YulzcsWVW3 nl792o26MQr91oCg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715765636; 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=B6eURaw0BpIjuDhs+K4lJN3NGByIlcvSsqcfPYpTYwg=; b=BuqwQ7Q4XQCtvZHFoTY8sweeG2az7TZj3HqwolbREd5GJb78dlReTZz6U5pJXQ1qexpJ6R J7icEMulizAOA/tz5IB1yIzvYqCBVRvvZRMl3oUqT/HP/f3NMcjgAhLORzVEJqfe4qn5vC DwcuQ0oqcl00YrUn4mr3Vhy02FbqEP0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715765636; 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=B6eURaw0BpIjuDhs+K4lJN3NGByIlcvSsqcfPYpTYwg=; b=FK7rG8oqfLIsCAVljY8atAeOxpdvPQVAtzyCDLkZ/MsumauhOBhCff2jG3Z/YulzcsWVW3 nl792o26MQr91oCg== 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 64D881372E; Wed, 15 May 2024 09:33:56 +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 GK2XFoSBRGb1TwAAD6G6ig (envelope-from ); Wed, 15 May 2024 09:33:56 +0000 From: Andrea Cervesato To: ltp@lists.linux.it Date: Wed, 15 May 2024 11:33:44 +0200 Message-Id: <20240515093349.7347-6-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 [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; 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]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.com:email]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 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 v1 05/10] Add stamount01 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 statmount() is working with no mask flags. Signed-off-by: Andrea Cervesato --- runtest/syscalls | 2 + .../kernel/syscalls/statmount/.gitignore | 1 + testcases/kernel/syscalls/statmount/Makefile | 7 ++ .../kernel/syscalls/statmount/statmount.h | 26 +++++++ .../kernel/syscalls/statmount/statmount01.c | 69 +++++++++++++++++++ 5 files changed, 105 insertions(+) create mode 100644 testcases/kernel/syscalls/statmount/.gitignore create mode 100644 testcases/kernel/syscalls/statmount/Makefile create mode 100644 testcases/kernel/syscalls/statmount/statmount.h create mode 100644 testcases/kernel/syscalls/statmount/statmount01.c diff --git a/runtest/syscalls b/runtest/syscalls index 355c182f8..407cae890 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -1537,6 +1537,8 @@ stat03_64 stat03_64 stat04 symlink01 -T stat04 stat04_64 symlink01 -T stat04_64 +statmount01 statmount01 + statfs01 statfs01 statfs01_64 statfs01_64 statfs02 statfs02 diff --git a/testcases/kernel/syscalls/statmount/.gitignore b/testcases/kernel/syscalls/statmount/.gitignore new file mode 100644 index 000000000..f1529eb29 --- /dev/null +++ b/testcases/kernel/syscalls/statmount/.gitignore @@ -0,0 +1 @@ +statmount01 diff --git a/testcases/kernel/syscalls/statmount/Makefile b/testcases/kernel/syscalls/statmount/Makefile new file mode 100644 index 000000000..8cf1b9024 --- /dev/null +++ b/testcases/kernel/syscalls/statmount/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/statmount/statmount.h b/testcases/kernel/syscalls/statmount/statmount.h new file mode 100644 index 000000000..e807c8288 --- /dev/null +++ b/testcases/kernel/syscalls/statmount/statmount.h @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2024 SUSE LLC Andrea Cervesato + */ + +#ifndef STATMOUNT_H + +#define _GNU_SOURCE + +#include "tst_test.h" +#include "lapi/mount.h" +#include "lapi/syscalls.h" + +static inline int statmount(uint64_t mnt_id, uint64_t mask, struct statmount *buf, + size_t bufsize, unsigned int flags) +{ + struct mnt_id_req req = { + .size = MNT_ID_REQ_SIZE_VER0, + .mnt_id = mnt_id, + .param = mask, + }; + + return tst_syscall(__NR_statmount, &req, buf, bufsize, flags); +} + +#endif diff --git a/testcases/kernel/syscalls/statmount/statmount01.c b/testcases/kernel/syscalls/statmount/statmount01.c new file mode 100644 index 000000000..4bf879916 --- /dev/null +++ b/testcases/kernel/syscalls/statmount/statmount01.c @@ -0,0 +1,69 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2024 SUSE LLC Andrea Cervesato + */ + +/** + * [Description] + * + * This test verifies that statmount() is working with no mask flags. + * + * [Algorithm] + * + * * create a mount point + * * run statmount() on the mount point without giving any mask + * * read results and check that mask and size are correct + */ + +#include "statmount.h" +#include "lapi/stat.h" +#include "lapi/sched.h" + +#define MNTPOINT "mntpoint" + +static uint64_t root_id; +static struct statmount *st_mount; + +static void run(void) +{ + memset(st_mount, 0, sizeof(struct statmount)); + + TST_EXP_PASS(statmount( + root_id, + 0, + st_mount, + sizeof(struct statmount), + 0)); + + if (TST_RET == -1) + return; + + TST_EXP_EQ_LI(st_mount->mask, 0); + TST_EXP_EQ_LI(st_mount->size, sizeof(struct statmount)); +} + +static void setup(void) +{ + struct statx sx; + + SAFE_STATX(AT_FDCWD, MNTPOINT, 0, STATX_MNT_ID_UNIQUE, &sx); + + root_id = sx.stx_mnt_id; +} + +static struct tst_test test = { + .test_all = run, + .setup = setup, + .min_kver = "6.8", + .mount_device = 1, + .mntpoint = MNTPOINT, + .all_filesystems = 1, + .skip_filesystems = (const char *const []) { + "fuse", + NULL + }, + .bufs = (struct tst_buffers []) { + {&st_mount, .size = sizeof(struct statmount)}, + {} + } +}; From patchwork Wed May 15 09:33:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1935410 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=LlKp3z0U; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=mWN2QGRW; 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=LlKp3z0U; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=mWN2QGRW; 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 4VfSkT0cGJz1ymw for ; Wed, 15 May 2024 19:35:13 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id BE5143CF7E9 for ; Wed, 15 May 2024 11:35:10 +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 [IPv6:2001:4b78:1:20::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 351FA3CF5C5 for ; Wed, 15 May 2024 11:33:57 +0200 (CEST) Authentication-Results: in-6.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-6.smtp.seeweb.it (Postfix) with ESMTPS id 49FAC1408700 for ; Wed, 15 May 2024 11:33:57 +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 BBB7B2048C; Wed, 15 May 2024 09:33:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715765636; 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=n1LGhqS+6aUQK94XOnfnXri6oBu2Hk8YSzG8xUkuc28=; b=LlKp3z0UX0ahdJAlUenzvHEeLr6vIFqWvZx/ifsLWnQiKtnWp/y9p6bc8o66wdUsQe7Aga E1Ekh7A5o4lKl8ItUHh+9bcQraMclqAchAyhWidMgzbLrYiNk3JoehftBQcEcCdwWRtUVL OqdeDYgexjtOlXbfd84UOH593i7dXJY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715765636; 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=n1LGhqS+6aUQK94XOnfnXri6oBu2Hk8YSzG8xUkuc28=; b=mWN2QGRW2bPYDu9e8u/+zYYWXYJjMnR/9aQ9fHQ1XOUjsfV/5xLrBFoOO7qRuB5eonDwZ5 h+SrapChF4DihzAw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=LlKp3z0U; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=mWN2QGRW DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715765636; 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=n1LGhqS+6aUQK94XOnfnXri6oBu2Hk8YSzG8xUkuc28=; b=LlKp3z0UX0ahdJAlUenzvHEeLr6vIFqWvZx/ifsLWnQiKtnWp/y9p6bc8o66wdUsQe7Aga E1Ekh7A5o4lKl8ItUHh+9bcQraMclqAchAyhWidMgzbLrYiNk3JoehftBQcEcCdwWRtUVL OqdeDYgexjtOlXbfd84UOH593i7dXJY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715765636; 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=n1LGhqS+6aUQK94XOnfnXri6oBu2Hk8YSzG8xUkuc28=; b=mWN2QGRW2bPYDu9e8u/+zYYWXYJjMnR/9aQ9fHQ1XOUjsfV/5xLrBFoOO7qRuB5eonDwZ5 h+SrapChF4DihzAw== 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 96C8513A62; Wed, 15 May 2024 09:33:56 +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 CFvoIoSBRGb1TwAAD6G6ig (envelope-from ); Wed, 15 May 2024 09:33:56 +0000 From: Andrea Cervesato To: ltp@lists.linux.it Date: Wed, 15 May 2024 11:33:45 +0200 Message-Id: <20240515093349.7347-7-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-Score: -3.01 X-Rspamd-Action: no action X-Rspamd-Queue-Id: BBB7B2048C X-Spam-Level: X-Rspamd-Server: rspamd2.dmz-prg2.suse.org 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-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 v1 06/10] Add statmount02 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 statmount() is correctly reading basic filesystem info using STATMOUNT_SB_BASIC. Signed-off-by: Andrea Cervesato --- runtest/syscalls | 1 + .../kernel/syscalls/statmount/.gitignore | 1 + .../kernel/syscalls/statmount/statmount02.c | 76 +++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 testcases/kernel/syscalls/statmount/statmount02.c diff --git a/runtest/syscalls b/runtest/syscalls index 407cae890..5f1df42ca 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -1538,6 +1538,7 @@ stat04 symlink01 -T stat04 stat04_64 symlink01 -T stat04_64 statmount01 statmount01 +statmount02 statmount02 statfs01 statfs01 statfs01_64 statfs01_64 diff --git a/testcases/kernel/syscalls/statmount/.gitignore b/testcases/kernel/syscalls/statmount/.gitignore index f1529eb29..a30b9565f 100644 --- a/testcases/kernel/syscalls/statmount/.gitignore +++ b/testcases/kernel/syscalls/statmount/.gitignore @@ -1 +1,2 @@ statmount01 +statmount02 diff --git a/testcases/kernel/syscalls/statmount/statmount02.c b/testcases/kernel/syscalls/statmount/statmount02.c new file mode 100644 index 000000000..b110e992d --- /dev/null +++ b/testcases/kernel/syscalls/statmount/statmount02.c @@ -0,0 +1,76 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2024 SUSE LLC Andrea Cervesato + */ + +/** + * [Description] + * + * This test verifies that statmount() is correctly reading basic filesystem + * info using STATMOUNT_SB_BASIC. + * The btrfs validation is currently skipped due to the lack of support for VFS. + * + * [Algorithm] + * + * * create a mount point and read its mount info + * * run statmount() on the mount point using STATMOUNT_SB_BASIC + * * read results and check if mount info are correct + */ + +#include "statmount.h" +#include "lapi/stat.h" +#include "lapi/sched.h" +#include + +#define MNTPOINT "mntpoint" + +static struct statmount *st_mount; +static struct statx *sx_mount; +static struct statfs *sf_mount; + +static void run(void) +{ + memset(st_mount, 0, sizeof(struct statmount)); + + TST_EXP_PASS(statmount( + sx_mount->stx_mnt_id, + STATMOUNT_SB_BASIC, + st_mount, + sizeof(struct statmount), + 0)); + + if (TST_RET == -1) + return; + + TST_EXP_EQ_LI(st_mount->mask, STATMOUNT_SB_BASIC); + TST_EXP_EQ_LI(st_mount->size, sizeof(struct statmount)); + TST_EXP_EQ_LI(st_mount->sb_dev_major, sx_mount->stx_dev_major); + TST_EXP_EQ_LI(st_mount->sb_dev_minor, sx_mount->stx_dev_minor); + TST_EXP_EQ_LI(st_mount->sb_magic, sf_mount->f_type); +} + +static void setup(void) +{ + SAFE_STATX(AT_FDCWD, MNTPOINT, 0, STATX_MNT_ID_UNIQUE, sx_mount); + SAFE_STATFS(MNTPOINT, sf_mount); +} + +static struct tst_test test = { + .test_all = run, + .setup = setup, + .min_kver = "6.8", + .mount_device = 1, + .mntpoint = MNTPOINT, + .all_filesystems = 1, + .skip_filesystems = (const char *const []) { + "fuse", + "btrfs", + NULL + }, + .bufs = (struct tst_buffers []) { + {&st_mount, .size = sizeof(struct statmount)}, + {&sx_mount, .size = sizeof(struct statx)}, + {&sf_mount, .size = sizeof(struct statfs)}, + {} + } +}; From patchwork Wed May 15 09:33:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1935413 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=TH95tkKN; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=pAjrjuIg; 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=u6ehjyWe; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=8w/6wL8z; 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 4VfSlX2NDtz1ymw for ; Wed, 15 May 2024 19:36:08 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 070693CF7E9 for ; Wed, 15 May 2024 11:36:06 +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 [217.194.8.7]) (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 ABD6D3CF672 for ; Wed, 15 May 2024 11:33:58 +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 0B0702095EE for ; Wed, 15 May 2024 11:33:58 +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 EDF8B339F3; Wed, 15 May 2024 09:33:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715765637; 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=6FBwUiHxgGuJToDPCl/CxD15WUb4m4zjOr/qjrAZEQA=; b=TH95tkKNx4x6wzVuBlVhZ4BcbvDwWHFzCxODSQV4t+YmtjwsFYrVmC0NescDYoLpGSEHgs d8LGRHv5J/jI7cBe6zd467+7ooLfNkK9Q5h04M6dirGZpZ5tFQ7/pXfenjDJKuSKMFzi4K CYDmbtvyjS2gT97+hYDP/Dclj+1w9T4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715765637; 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=6FBwUiHxgGuJToDPCl/CxD15WUb4m4zjOr/qjrAZEQA=; b=pAjrjuIg6CxOaA96CqkbNmz1YUwXP0BnNcMkDTPVdMSCXoDHHwD4VfEGlT7xyO8ijcTQDZ okRopRRapORe9mDw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=u6ehjyWe; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="8w/6wL8z" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715765636; 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=6FBwUiHxgGuJToDPCl/CxD15WUb4m4zjOr/qjrAZEQA=; b=u6ehjyWeWVcpgPW7AL6ZyRX9JjR+SM/+7HejaRBadR7D/vjc/Px7jiiR4qvOMmPH9L5Er2 ThNKguCzBqpiY1qDPpekocSTCV3RExo58awniDtkNHJDWN3RlUn4OISfDcgbqawElk4Arf BPxGd0Ye7F9rfsdzFLbHjYLGhWZqn60= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715765636; 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=6FBwUiHxgGuJToDPCl/CxD15WUb4m4zjOr/qjrAZEQA=; b=8w/6wL8zUUCMp0dvJhsd9YIDGpkVsPhSwi8F+X6z17SPdgseZAV0Q/9cZCZKFlkMCbz3zc 493bsEltfODTQjDA== 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 C86161372E; Wed, 15 May 2024 09:33:56 +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 wMH5LoSBRGb1TwAAD6G6ig (envelope-from ); Wed, 15 May 2024 09:33:56 +0000 From: Andrea Cervesato To: ltp@lists.linux.it Date: Wed, 15 May 2024 11:33:46 +0200 Message-Id: <20240515093349.7347-8-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: EDF8B339F3 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-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 v1 07/10] Add statmount03 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 statmount() is correctly reading mount information (mount id, parent mount id, mount attributes etc.) using STATMOUNT_MNT_BASIC. Signed-off-by: Andrea Cervesato --- runtest/syscalls | 1 + .../kernel/syscalls/statmount/.gitignore | 1 + .../kernel/syscalls/statmount/statmount03.c | 99 +++++++++++++++++++ 3 files changed, 101 insertions(+) create mode 100644 testcases/kernel/syscalls/statmount/statmount03.c diff --git a/runtest/syscalls b/runtest/syscalls index 5f1df42ca..116106521 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -1539,6 +1539,7 @@ stat04_64 symlink01 -T stat04_64 statmount01 statmount01 statmount02 statmount02 +statmount03 statmount03 statfs01 statfs01 statfs01_64 statfs01_64 diff --git a/testcases/kernel/syscalls/statmount/.gitignore b/testcases/kernel/syscalls/statmount/.gitignore index a30b9565f..2a02bf721 100644 --- a/testcases/kernel/syscalls/statmount/.gitignore +++ b/testcases/kernel/syscalls/statmount/.gitignore @@ -1,2 +1,3 @@ statmount01 statmount02 +statmount03 diff --git a/testcases/kernel/syscalls/statmount/statmount03.c b/testcases/kernel/syscalls/statmount/statmount03.c new file mode 100644 index 000000000..6140940bd --- /dev/null +++ b/testcases/kernel/syscalls/statmount/statmount03.c @@ -0,0 +1,99 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2024 SUSE LLC Andrea Cervesato + */ + +/** + * [Description] + * + * This test verifies that statmount() is correctly reading mount information + * (mount id, parent mount id, mount attributes etc.) using STATMOUNT_MNT_BASIC. + * + * [Algorithm] + * + * * create a mount point + * * create a new parent folder inside the mount point and obtain its mount info + * * create the new "/" mount folder and obtain its mount info + * * run statmount() on the mount point using STATMOUNT_MNT_BASIC + * * read results and check if mount info are correct + */ + +#include "statmount.h" +#include "lapi/stat.h" +#include "lapi/sched.h" + +#define MNTPOINT "mntpoint" +#define MYPARENT MNTPOINT "/myroot" + +static uint64_t root_id; +static uint64_t root_id_old; +static uint64_t parent_id; +static uint64_t parent_id_old; +static struct statmount *st_mount; + +static void run(void) +{ + memset(st_mount, 0, sizeof(struct statmount)); + + TST_EXP_PASS(statmount( + root_id, + STATMOUNT_MNT_BASIC, + st_mount, + sizeof(struct statmount), + 0)); + + if (TST_RET == -1) + return; + + TST_EXP_EQ_LI(st_mount->mask, STATMOUNT_MNT_BASIC); + TST_EXP_EQ_LI(st_mount->size, sizeof(struct statmount)); + TST_EXP_EQ_LI(st_mount->mnt_id, root_id); + TST_EXP_EQ_LI(st_mount->mnt_id_old, root_id_old); + TST_EXP_EQ_LI(st_mount->mnt_parent_id, parent_id); + TST_EXP_EQ_LI(st_mount->mnt_parent_id_old, parent_id_old); + TST_EXP_EQ_LI(st_mount->mnt_propagation, MS_PRIVATE); +} + +static void setup(void) +{ + struct statx sx; + + SAFE_UNSHARE(CLONE_NEWNS); + SAFE_MKDIR(MYPARENT, 0700); + + SAFE_STATX(AT_FDCWD, MYPARENT, 0, STATX_MNT_ID_UNIQUE, &sx); + parent_id = sx.stx_mnt_id; + + SAFE_STATX(AT_FDCWD, MYPARENT, 0, STATX_MNT_ID, &sx); + parent_id_old = sx.stx_mnt_id; + + SAFE_MOUNT("", "/", NULL, MS_REC | MS_PRIVATE, NULL); + SAFE_MOUNT(MYPARENT, MYPARENT, NULL, MS_BIND, NULL); + SAFE_CHROOT(MYPARENT); + SAFE_CHDIR("/"); + + SAFE_STATX(AT_FDCWD, "/", 0, STATX_MNT_ID_UNIQUE, &sx); + root_id = sx.stx_mnt_id; + + SAFE_STATX(AT_FDCWD, "/", 0, STATX_MNT_ID, &sx); + root_id_old = sx.stx_mnt_id; +} + +static struct tst_test test = { + .test_all = run, + .setup = setup, + .min_kver = "6.8", + .needs_tmpdir = 1, + .format_device = 1, + .mount_device = 1, + .mntpoint = MNTPOINT, + .all_filesystems = 1, + .skip_filesystems = (const char *const []) { + "fuse", + NULL + }, + .bufs = (struct tst_buffers []) { + {&st_mount, .size = sizeof(struct statmount)}, + {} + } +}; From patchwork Wed May 15 09:33:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1935409 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=0hRuAuCU; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=a/IOsTcc; 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=0hRuAuCU; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=a/IOsTcc; 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) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VfSkB0qRtz1ydW for ; Wed, 15 May 2024 19:34:58 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 74D603CF76D for ; Wed, 15 May 2024 11:34:55 +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 289CE3CD986 for ; Wed, 15 May 2024 11:33:58 +0200 (CEST) Authentication-Results: in-4.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.de (client-ip=195.135.223.130; 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 [195.135.223.130]) (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 97C1811F4D2D for ; Wed, 15 May 2024 11:33:57 +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 2C99E339F4; Wed, 15 May 2024 09:33:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715765637; 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=Dgu2rRXne7PpTs+AecDO4WyzAOKC9C5BPD8jMjXz7vc=; b=0hRuAuCU/b1i5qOVKIwcHQVNgtHCBmGEvZP33HMvq7mAIacxXFbUlV85bjKZ07yP5l0Sr5 ZJC6Bps5GkmFXHlidyhulhRFkcM1OCysetkMSFiLpNLXIW0VzBpC4BMuyVgg+yJ6TqvYaZ hMwYI+uk7V1hnOAafiYG9h0zisebqtk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715765637; 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=Dgu2rRXne7PpTs+AecDO4WyzAOKC9C5BPD8jMjXz7vc=; b=a/IOsTccfIr2eC3w25zgZ2v34loN8S1LYRNTfx2s8Oxmz9wD+1M2CmHKqTrtKpZ4a9GoXj UnsB0aKAboWEImDw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715765637; 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=Dgu2rRXne7PpTs+AecDO4WyzAOKC9C5BPD8jMjXz7vc=; b=0hRuAuCU/b1i5qOVKIwcHQVNgtHCBmGEvZP33HMvq7mAIacxXFbUlV85bjKZ07yP5l0Sr5 ZJC6Bps5GkmFXHlidyhulhRFkcM1OCysetkMSFiLpNLXIW0VzBpC4BMuyVgg+yJ6TqvYaZ hMwYI+uk7V1hnOAafiYG9h0zisebqtk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715765637; 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=Dgu2rRXne7PpTs+AecDO4WyzAOKC9C5BPD8jMjXz7vc=; b=a/IOsTccfIr2eC3w25zgZ2v34loN8S1LYRNTfx2s8Oxmz9wD+1M2CmHKqTrtKpZ4a9GoXj UnsB0aKAboWEImDw== 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 0674013A62; Wed, 15 May 2024 09:33:56 +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 eEovO4SBRGb1TwAAD6G6ig (envelope-from ); Wed, 15 May 2024 09:33:56 +0000 From: Andrea Cervesato To: ltp@lists.linux.it Date: Wed, 15 May 2024 11:33:47 +0200 Message-Id: <20240515093349.7347-9-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-Score: -2.80 X-Spam-Level: X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; 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]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.com:email]; RCVD_TLS_ALL(0.00)[] 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 08/10] Add statmount04 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 statmount() is correctly reading propagation from what mount in current namespace using STATMOUNT_PROPAGATE_FROM. Signed-off-by: Andrea Cervesato --- runtest/syscalls | 1 + .../kernel/syscalls/statmount/.gitignore | 1 + .../kernel/syscalls/statmount/statmount04.c | 133 ++++++++++++++++++ 3 files changed, 135 insertions(+) create mode 100644 testcases/kernel/syscalls/statmount/statmount04.c diff --git a/runtest/syscalls b/runtest/syscalls index 116106521..3c262ca3e 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -1540,6 +1540,7 @@ stat04_64 symlink01 -T stat04_64 statmount01 statmount01 statmount02 statmount02 statmount03 statmount03 +statmount04 statmount04 statfs01 statfs01 statfs01_64 statfs01_64 diff --git a/testcases/kernel/syscalls/statmount/.gitignore b/testcases/kernel/syscalls/statmount/.gitignore index 2a02bf721..e720050b5 100644 --- a/testcases/kernel/syscalls/statmount/.gitignore +++ b/testcases/kernel/syscalls/statmount/.gitignore @@ -1,3 +1,4 @@ statmount01 statmount02 statmount03 +statmount04 diff --git a/testcases/kernel/syscalls/statmount/statmount04.c b/testcases/kernel/syscalls/statmount/statmount04.c new file mode 100644 index 000000000..cfb0e9962 --- /dev/null +++ b/testcases/kernel/syscalls/statmount/statmount04.c @@ -0,0 +1,133 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2024 SUSE LLC Andrea Cervesato + */ + +/** + * [Description] + * + * This test verifies that statmount() is correctly reading propagation from + * what mount in current namespace using STATMOUNT_PROPAGATE_FROM. + * + * [Algorithm] + * + * * create a mount point + * * propagate a mounted folder inside the mount point + * * run statmount() on the mount point using STATMOUNT_PROPAGATE_FROM + * * read results and check propagated_from parameter contains the propagated + * folder ID + */ + +#include "statmount.h" +#include "lapi/stat.h" +#include "lapi/sched.h" +#include "tst_safe_stdio.h" + +#define MNTPOINT "mntpoint" +#define DIR_A MNTPOINT "/LTP_DIR_A" +#define DIR_C_SUBFOLDER "/LTP_DIR_A/propagated" +#define DIR_C (MNTPOINT DIR_C_SUBFOLDER) +#define DIR_B MNTPOINT "/LTP_DIR_B" +#define DIR_D MNTPOINT "/LTP_DIR_B/propagated" + +static uint64_t peer_group_id; +static uint64_t dird_id; +static struct statmount *st_mount; + +static int read_peer_group(void) +{ + FILE *file; + char line[PATH_MAX]; + char mroot[PATH_MAX]; + int group = -1; + + file = SAFE_FOPEN("/proc/self/mountinfo", "r"); + + while (fgets(line, sizeof(line), file)) { + if (sscanf(line, "%*d %*d %*d:%*d %s %*s %*s shared:%d", mroot, &group) != 2) + continue; + + if (strcmp(mroot, DIR_C_SUBFOLDER) == 0) + break; + } + + if (group == -1) + tst_brk(TBROK, "Can't reed peer group ID for %s", DIR_C_SUBFOLDER); + + return group; +} + +static void run(void) +{ + memset(st_mount, 0, sizeof(struct statmount)); + + TST_EXP_PASS(statmount( + dird_id, + STATMOUNT_PROPAGATE_FROM, + st_mount, + sizeof(struct statmount), + 0)); + + if (TST_RET == -1) + return; + + TST_EXP_EQ_LI(st_mount->mask, STATMOUNT_PROPAGATE_FROM); + TST_EXP_EQ_LI(st_mount->size, sizeof(struct statmount)); + TST_EXP_EQ_LI(st_mount->propagate_from, peer_group_id); +} + +static void setup(void) +{ + struct statx sx; + + /* create DIR_A / DIR_C structure with DIR_C mounted */ + SAFE_MKDIR(DIR_A, 0700); + SAFE_MOUNT(DIR_A, DIR_A, "none", MS_BIND, NULL); + SAFE_MOUNT("none", DIR_A, "none", MS_SHARED, NULL); + + SAFE_MKDIR(DIR_C, 0700); + SAFE_MOUNT(DIR_C, DIR_C, "none", MS_BIND, NULL); + SAFE_MOUNT("none", DIR_C, "none", MS_SHARED, NULL); + + /* DIR_A mounts into DIR_B. DIR_D is propagated */ + SAFE_MKDIR(DIR_B, 0700); + SAFE_MOUNT(DIR_A, DIR_B, "none", MS_BIND, NULL); + SAFE_MOUNT("none", DIR_B, "none", MS_SLAVE, NULL); + + SAFE_STATX(AT_FDCWD, DIR_D, 0, STATX_MNT_ID_UNIQUE, &sx); + dird_id = sx.stx_mnt_id; + + peer_group_id = read_peer_group(); +} + +static void cleanup(void) +{ + if (tst_is_mounted(DIR_C)) + SAFE_UMOUNT(DIR_C); + + if (tst_is_mounted(DIR_B)) + SAFE_UMOUNT(DIR_B); + + if (tst_is_mounted(DIR_A)) + SAFE_UMOUNT(DIR_A); +} + +static struct tst_test test = { + .test_all = run, + .setup = setup, + .cleanup = cleanup, + .min_kver = "6.8", + .needs_tmpdir = 1, + .format_device = 1, + .mount_device = 1, + .mntpoint = MNTPOINT, + .all_filesystems = 1, + .skip_filesystems = (const char *const []) { + "fuse", + NULL + }, + .bufs = (struct tst_buffers []) { + {&st_mount, .size = sizeof(struct statmount)}, + {} + } +}; From patchwork Wed May 15 09:33:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1935414 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=VObkzQOs; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=onFSnV+Q; 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=VObkzQOs; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=onFSnV+Q; 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 4VfSly4QSpz1ymw for ; Wed, 15 May 2024 19:36:30 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 561D63CF72D for ; Wed, 15 May 2024 11:36:28 +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 [IPv6:2001:4b78:1:20::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 28A193CF731 for ; Wed, 15 May 2024 11:33:59 +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: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-6.smtp.seeweb.it (Postfix) with ESMTPS id 6E0DF1408701 for ; Wed, 15 May 2024 11:33:58 +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 61E762048A; Wed, 15 May 2024 09:33:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715765637; 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=Sn0di5rzGd5SNhnR2+1IKOwEvEyw0VZYX9AkcXoGUO8=; b=VObkzQOsLVHNGfurX/zjJFQZCvcMMIet5t8vw+gf3x30Az4V/P29m5WU3pPvlXGkjJlUFg LKMBgUOO1WQz0E6tj6fPCtF+Vuia4EQMYYoSZkuq0lGowUlygi/lnQf0WvWRJDLQUDnIQC EafpbA2P8Tr17+kuAnBfwfEpHJLeons= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715765637; 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=Sn0di5rzGd5SNhnR2+1IKOwEvEyw0VZYX9AkcXoGUO8=; b=onFSnV+QEzU50s3gsd93Csr3+egzmRjjSZVs0mfDI9uvTZ/xoQ7JgYtH5zsPE8RAssCWII jMVb3yYM13Hb1QBw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=VObkzQOs; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=onFSnV+Q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715765637; 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=Sn0di5rzGd5SNhnR2+1IKOwEvEyw0VZYX9AkcXoGUO8=; b=VObkzQOsLVHNGfurX/zjJFQZCvcMMIet5t8vw+gf3x30Az4V/P29m5WU3pPvlXGkjJlUFg LKMBgUOO1WQz0E6tj6fPCtF+Vuia4EQMYYoSZkuq0lGowUlygi/lnQf0WvWRJDLQUDnIQC EafpbA2P8Tr17+kuAnBfwfEpHJLeons= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715765637; 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=Sn0di5rzGd5SNhnR2+1IKOwEvEyw0VZYX9AkcXoGUO8=; b=onFSnV+QEzU50s3gsd93Csr3+egzmRjjSZVs0mfDI9uvTZ/xoQ7JgYtH5zsPE8RAssCWII jMVb3yYM13Hb1QBw== 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 39BCE1372E; Wed, 15 May 2024 09:33:57 +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 mPOuC4WBRGb1TwAAD6G6ig (envelope-from ); Wed, 15 May 2024 09:33:57 +0000 From: Andrea Cervesato To: ltp@lists.linux.it Date: Wed, 15 May 2024 11:33:48 +0200 Message-Id: <20240515093349.7347-10-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: 61E762048A 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-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 v1 09/10] Add statmount05 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 STATMOUNT_MNT_ROOT and STATMOUNT_MNT_POINT functionalities of statmount(). Signed-off-by: Andrea Cervesato --- runtest/syscalls | 1 + .../kernel/syscalls/statmount/.gitignore | 1 + .../kernel/syscalls/statmount/statmount05.c | 138 ++++++++++++++++++ 3 files changed, 140 insertions(+) create mode 100644 testcases/kernel/syscalls/statmount/statmount05.c diff --git a/runtest/syscalls b/runtest/syscalls index 3c262ca3e..2984117e6 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -1541,6 +1541,7 @@ statmount01 statmount01 statmount02 statmount02 statmount03 statmount03 statmount04 statmount04 +statmount05 statmount05 statfs01 statfs01 statfs01_64 statfs01_64 diff --git a/testcases/kernel/syscalls/statmount/.gitignore b/testcases/kernel/syscalls/statmount/.gitignore index e720050b5..f64763242 100644 --- a/testcases/kernel/syscalls/statmount/.gitignore +++ b/testcases/kernel/syscalls/statmount/.gitignore @@ -2,3 +2,4 @@ statmount01 statmount02 statmount03 statmount04 +statmount05 diff --git a/testcases/kernel/syscalls/statmount/statmount05.c b/testcases/kernel/syscalls/statmount/statmount05.c new file mode 100644 index 000000000..9882719f5 --- /dev/null +++ b/testcases/kernel/syscalls/statmount/statmount05.c @@ -0,0 +1,138 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2024 SUSE LLC Andrea Cervesato + */ + +/** + * [Description] + * + * This test verifies STATMOUNT_MNT_ROOT and STATMOUNT_MNT_POINT functionalities + * of statmount(). In particular, STATMOUNT_MNT_ROOT will give the mount root + * (i.e. mount --bind /mnt /bla -> /mnt) and STATMOUNT_MNT_POINT will + * give the mount point (i.e. mount --bind /mnt /bla -> /bla). + * + * [Algorithm] + * + * * create a mount point + * * mount a folder inside the mount point + * * run statmount() on the mounted folder using STATMOUNT_MNT_ROOT + * * read results and check if contain the mount root path + * * run statmount() on the mounted folder using STATMOUNT_MNT_POINT + * * read results and check if contain the mount point path + */ + +#include "statmount.h" +#include "lapi/stat.h" +#include "lapi/sched.h" + +#define MNTPOINT "mntpoint" +#define DIRA MNTPOINT "/LTP_DIR_A" +#define DIRB MNTPOINT "/LTP_DIR_B" +#define SM_SIZE (1 << 10) + +static uint64_t root_id; +static struct statmount *st_mount; +static char mnt_root[PATH_MAX]; +static char mnt_point[PATH_MAX]; + +static void test_mount_root(void) +{ + tst_res(TINFO, "Testing STATMOUNT_MNT_ROOT"); + + char *last_root; + + memset(st_mount, 0, SM_SIZE); + + TST_EXP_PASS(statmount( + root_id, + STATMOUNT_MNT_ROOT, + st_mount, + SM_SIZE, + 0)); + + if (TST_RET == -1) + return; + + last_root = strrchr(mnt_root, '/'); + + TST_EXP_EQ_LI(st_mount->mask, STATMOUNT_MNT_ROOT); + TST_EXP_EXPR(strcmp(st_mount->str + st_mount->mnt_root, last_root) == 0, + "statmount() read '%s', expected '%s'", + st_mount->str + st_mount->mnt_root, + last_root); +} + +static void test_mount_point(void) +{ + tst_res(TINFO, "Testing STATMOUNT_MNT_POINT"); + + memset(st_mount, 0, SM_SIZE); + + TST_EXP_POSITIVE(statmount( + root_id, + STATMOUNT_MNT_POINT, + st_mount, + SM_SIZE, + 0)); + + if (TST_RET == -1) + return; + + TST_EXP_EQ_LI(st_mount->mask, STATMOUNT_MNT_POINT); + TST_EXP_EXPR(strcmp(st_mount->str + st_mount->mnt_point, mnt_point) == 0, + "mount point is '%s'", + st_mount->str + st_mount->mnt_point); +} + +static void run(void) +{ + test_mount_root(); + test_mount_point(); +} + +static void setup(void) +{ + char *tmpdir; + struct statx sx; + + tmpdir = tst_get_tmpdir(); + snprintf(mnt_root, PATH_MAX, "%s/%s", tmpdir, DIRA); + snprintf(mnt_point, PATH_MAX, "%s/%s", tmpdir, DIRB); + free(tmpdir); + + SAFE_MKDIR(mnt_root, 0700); + SAFE_MKDIR(mnt_point, 0700); + SAFE_MOUNT(mnt_root, mnt_point, "none", MS_BIND, NULL); + + SAFE_STATX(AT_FDCWD, mnt_point, 0, STATX_MNT_ID_UNIQUE, &sx); + root_id = sx.stx_mnt_id; +} + +static void cleanup(void) +{ + if (tst_is_mounted(DIRB)) + SAFE_UMOUNT(DIRB); + + if (tst_is_mounted(DIRA)) + SAFE_UMOUNT(DIRA); +} + +static struct tst_test test = { + .test_all = run, + .setup = setup, + .cleanup = cleanup, + .min_kver = "6.8", + .needs_tmpdir = 1, + .format_device = 1, + .mount_device = 1, + .mntpoint = MNTPOINT, + .all_filesystems = 1, + .skip_filesystems = (const char *const []) { + "fuse", + NULL + }, + .bufs = (struct tst_buffers []) { + {&st_mount, .size = SM_SIZE}, + {} + } +}; From patchwork Wed May 15 09:33:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1935415 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=C3JueDK/; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=O+RM2rzu; 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=C3JueDK/; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=O+RM2rzu; 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 4VfSmH24HCz1ymw for ; Wed, 15 May 2024 19:36:47 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id DBEE33CF791 for ; Wed, 15 May 2024 11:36:44 +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 4F28E3CF74A for ; Wed, 15 May 2024 11:33:59 +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: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-4.smtp.seeweb.it (Postfix) with ESMTPS id 9A3EC1000CF5 for ; Wed, 15 May 2024 11:33:58 +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 970242048D; Wed, 15 May 2024 09:33:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715765637; 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=ViHSx8QjhJNj5eZ77Q/fbB6cgsOvS03qTHjZ4BxfxBM=; b=C3JueDK/RHWnixVdIkOV07itH0Aj/ARErXyWETu8XP+5E1Ncf4XN3QzBmd6ueKdC4ZXCXO L0QGA3hssDEINNauXLaR7WIMAy5DeGJrYTrAzIKTMUcarBUNRGmsZN9gPJsIr9P+rdY7iS 51peZ20evIaPIxp4/VN19DNt+khp7MA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715765637; 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=ViHSx8QjhJNj5eZ77Q/fbB6cgsOvS03qTHjZ4BxfxBM=; b=O+RM2rzusTcLwY0qib0YLTKsznDbR0KTRQW0RM4QRR8IAQJR9+BwBBjjsyfa/BjJxXNjrh DfryAqzWvjCNAODQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="C3JueDK/"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=O+RM2rzu DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715765637; 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=ViHSx8QjhJNj5eZ77Q/fbB6cgsOvS03qTHjZ4BxfxBM=; b=C3JueDK/RHWnixVdIkOV07itH0Aj/ARErXyWETu8XP+5E1Ncf4XN3QzBmd6ueKdC4ZXCXO L0QGA3hssDEINNauXLaR7WIMAy5DeGJrYTrAzIKTMUcarBUNRGmsZN9gPJsIr9P+rdY7iS 51peZ20evIaPIxp4/VN19DNt+khp7MA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715765637; 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=ViHSx8QjhJNj5eZ77Q/fbB6cgsOvS03qTHjZ4BxfxBM=; b=O+RM2rzusTcLwY0qib0YLTKsznDbR0KTRQW0RM4QRR8IAQJR9+BwBBjjsyfa/BjJxXNjrh DfryAqzWvjCNAODQ== 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 7076B13A62; Wed, 15 May 2024 09:33:57 +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 0FEuGYWBRGb1TwAAD6G6ig (envelope-from ); Wed, 15 May 2024 09:33:57 +0000 From: Andrea Cervesato To: ltp@lists.linux.it Date: Wed, 15 May 2024 11:33:49 +0200 Message-Id: <20240515093349.7347-11-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-Score: -3.01 X-Rspamd-Action: no action X-Rspamd-Queue-Id: 970242048D X-Spam-Level: X-Rspamd-Server: rspamd2.dmz-prg2.suse.org 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:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim,suse.com:email]; 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-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 10/10] Add statmount06 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 statmount() is correctly reading name of the filesystem type using STATMOUNT_FS_TYPE. Signed-off-by: Andrea Cervesato --- runtest/syscalls | 1 + .../kernel/syscalls/statmount/.gitignore | 1 + .../kernel/syscalls/statmount/statmount06.c | 73 +++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 testcases/kernel/syscalls/statmount/statmount06.c diff --git a/runtest/syscalls b/runtest/syscalls index 2984117e6..86e253f77 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -1542,6 +1542,7 @@ statmount02 statmount02 statmount03 statmount03 statmount04 statmount04 statmount05 statmount05 +statmount06 statmount06 statfs01 statfs01 statfs01_64 statfs01_64 diff --git a/testcases/kernel/syscalls/statmount/.gitignore b/testcases/kernel/syscalls/statmount/.gitignore index f64763242..03a75bd40 100644 --- a/testcases/kernel/syscalls/statmount/.gitignore +++ b/testcases/kernel/syscalls/statmount/.gitignore @@ -3,3 +3,4 @@ statmount02 statmount03 statmount04 statmount05 +statmount06 diff --git a/testcases/kernel/syscalls/statmount/statmount06.c b/testcases/kernel/syscalls/statmount/statmount06.c new file mode 100644 index 000000000..5c9be9be9 --- /dev/null +++ b/testcases/kernel/syscalls/statmount/statmount06.c @@ -0,0 +1,73 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2024 SUSE LLC Andrea Cervesato + */ + +/** + * [Description] + * + * This test verifies that statmount() is correctly reading name of the + * filesystem type using STATMOUNT_FS_TYPE. + * + * [Algorithm] + * + * * create a mount point + * * run statmount() on the mount point using STATMOUNT_FS_TYPE + * * read results and check if contain the name of the filesystem + */ + +#include "statmount.h" +#include "lapi/stat.h" +#include "lapi/sched.h" + +#define MNTPOINT "mntpoint" +#define SM_SIZE (1 << 10) + +static uint64_t root_id; +static struct statmount *st_mount; + +static void run(void) +{ + memset(st_mount, 0, SM_SIZE); + + TST_EXP_PASS(statmount( + root_id, + STATMOUNT_FS_TYPE, + st_mount, + SM_SIZE, + 0)); + + if (TST_RET == -1) + return; + + TST_EXP_EQ_LI(st_mount->mask, STATMOUNT_FS_TYPE); + TST_EXP_EXPR(strcmp(st_mount->str + st_mount->fs_type, tst_device->fs_type) == 0, + "statmount() read '%s', expected '%s'", + st_mount->str + st_mount->fs_type, tst_device->fs_type); +} + +static void setup(void) +{ + struct statx sx; + + SAFE_STATX(AT_FDCWD, MNTPOINT, 0, STATX_MNT_ID_UNIQUE, &sx); + root_id = sx.stx_mnt_id; +} + +static struct tst_test test = { + .test_all = run, + .setup = setup, + .min_kver = "6.8", + .format_device = 1, + .mount_device = 1, + .mntpoint = MNTPOINT, + .all_filesystems = 1, + .skip_filesystems = (const char *const []) { + "fuse", + NULL + }, + .bufs = (struct tst_buffers []) { + {&st_mount, .size = SM_SIZE}, + {} + } +};