From patchwork Thu May 16 12:29:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1935973 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=Cl4pF4uD; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=qzJo7msG; 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=tm/r5muL; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=lQCPfSba; 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 4Vg8Z105wtz20KF for ; Thu, 16 May 2024 22:30:17 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id A80FB3CFA61 for ; Thu, 16 May 2024 14:30:14 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [IPv6:2001:4b78:1:20::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id B2FA73CF95E for ; Thu, 16 May 2024 14:29:37 +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: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-7.smtp.seeweb.it (Postfix) with ESMTPS id EE809200ACA for ; Thu, 16 May 2024 14:29:36 +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 E85575C34B for ; Thu, 16 May 2024 12:29:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=47WgTMA+5HOSGmUE9o0FaeTrAdNzXpfho0PY50pB6ws=; b=Cl4pF4uDzjtnuZ0RsHgn/56N4sAZ1pZtNW0meVkosUXOEtTscZMsBkcPpIhfJM3OnQEGgy ZTcMB6ko686dJvY82rHg/jsj67EcG/42aoDHAocx5E/DxwJGqOvm8wvYeQcWuZau59KJMJ sqfKZyT85loLIjt13Zqyk9ZZIYbSR40= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=47WgTMA+5HOSGmUE9o0FaeTrAdNzXpfho0PY50pB6ws=; b=qzJo7msG0eLU1gun7s/OyW3/Ru/EbCBbqEpdc8Zbza8GbE18FItNLMSJo+j9Qw4BXIQC76 0x3DQpEZnoIvoQBg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="tm/r5muL"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=lQCPfSba DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715862574; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=47WgTMA+5HOSGmUE9o0FaeTrAdNzXpfho0PY50pB6ws=; b=tm/r5muLtMz7SazOVejZ25RI/xjCmYgLouOb9rdP9N9sFXRy//HQ0x7VX0OA+6BgwPe9F0 japwmRvLgs5rTAt43aZmC9GNVMZIlhTLw/67YLPVig/scU5HaIcWhoTlBbk4DyxO4dfNW2 Dbu63ul8dfhlyAmXZ2cMjXACgvCccmg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715862574; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=47WgTMA+5HOSGmUE9o0FaeTrAdNzXpfho0PY50pB6ws=; b=lQCPfSbaaLpPK8yjmOyX8NKgK+zeOlearM5ifW3i9gnqOk68lV3C1FdWkIlsqXbMfXa4Gl EMVb7ftPBnMGTGBw== 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 D44A113991 for ; Thu, 16 May 2024 12:29:34 +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 MKeWMi78RWbOfwAAD6G6ig (envelope-from ) for ; Thu, 16 May 2024 12:29:34 +0000 From: Andrea Cervesato Date: Thu, 16 May 2024 14:29:09 +0200 MIME-Version: 1.0 Message-Id: <20240516-listmount_statmount-v3-1-2ff4ba29bba7@suse.com> References: <20240516-listmount_statmount-v3-0-2ff4ba29bba7@suse.com> In-Reply-To: <20240516-listmount_statmount-v3-0-2ff4ba29bba7@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1914; i=andrea.cervesato@suse.com; h=from:subject:message-id; bh=+hTltiI4dIoQVZxGiGcMdIRIdVpi+1cKDHmfRdGJ9b4=; b=owEB7QES/pANAwAIAcvMGrIgs+ZGAcsmYgBmRfwtpOmC1CFIs1UgTd0vjjA/qEeksance/BUc USzCIhEd4mJAbMEAAEIAB0WIQT1ysFzUKRW0sIb39jLzBqyILPmRgUCZkX8LQAKCRDLzBqyILPm Rt6PDACfJOVQ+TSYXrX7sOb257JrnC9JxQMMYuijE+aRDh1uI25oJJX2xh3NLUPEfC3/Yh6oOXO kGGSs248wR+wgprwPHlAiRtfw5IZLqtSfDc7SsFFy43UfCqyFH29AzqQhXW4DfCPb+nDukvhNFC asgyTW2UZwyK4N7nMUatZxQ69rZOEi1DAFG1dTO+OBXJIlSYROjHVbQScID25YPgogBED0rZCPs 9/b6m3xlHTzqaK89nPkFN+Vu2ksGM0Ca5gHMWkD3HO6UkhFXLxUSVkmz3M5VAEuEaw1GdhSCFlp 6QWg4MQitKJ7xoiO6tK14FSHxounwERAzMP/lW+6YoRn6Cd6ytxtn0MKoMjIZ11I0XlPbYgBWyq 0SZUwKD5+oGpA2qgPEEveCU2yF2uFv6Y33BWfbDvR2+QdEr6svDQtwR/1RrOrsGzE7hRcXzdFGh Qs29zQrfNmHfMYQZRmQ7uvt9QY2sH1GSGko/mULmw40NqMqd4TGJw/NAtFOoEP4VB0Dg8= X-Developer-Key: i=andrea.cervesato@suse.com; a=openpgp; fpr=F5CAC17350A456D2C21BDFD8CBCC1AB220B3E646 X-Spam-Level: X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; 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)[]; ARC_NA(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; DWL_DNSWL_BLOCKED(0.00)[suse.de:dkim]; RCPT_COUNT_ONE(0.00)[1]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: E85575C34B X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Score: -4.51 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-7.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-7.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v3 01/11] 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 Reviewed-by: Avinesh Kumar --- include/tst_safe_macros.h | 7 +++++++ lib/tst_safe_macros.c | 22 ++++++++++++++++++++++ 2 files changed, 29 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..f50a7bcc2 100644 --- a/lib/tst_safe_macros.c +++ b/lib/tst_safe_macros.c @@ -20,6 +20,7 @@ #include "tst_safe_macros.h" #include "lapi/personality.h" #include "lapi/pidfd.h" +#include "lapi/stat.h" int safe_access(const char *file, const int lineno, const char *pathname, int mode) @@ -710,3 +711,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 Thu May 16 12:29:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1935982 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=DJ2PRwc+; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=iYm/U/Bh; 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=DJ2PRwc+; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=iYm/U/Bh; 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 4Vg8d06s6qz20KF for ; Thu, 16 May 2024 22:32:52 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 09EBE3CF99B for ; Thu, 16 May 2024 14:32:50 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [217.194.8.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 picard.linux.it (Postfix) with ESMTPS id 05C273CFA0E for ; Thu, 16 May 2024 14:29:41 +0200 (CEST) Authentication-Results: in-2.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-2.smtp.seeweb.it (Postfix) with ESMTPS id EE694602123 for ; Thu, 16 May 2024 14:29:36 +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 0B8DE5C34D for ; Thu, 16 May 2024 12:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kri14HRsynL9NP339m69rzLgTXKOvtIcOn1ngSZO12I=; b=DJ2PRwc+J9vcW+JIvOvVqEKfD5sey5wwltAmgf2ZSS3sbIkgOTmEQdPFMspklNORsScGpv VHKKbwNu/9Q359gtXM3KCYNi7FIXvyvZD+iURJrw7/HUtF7t2n9iVihkODcdPw8t9vYYRA 4E0Yqbi7+vDQBURU2B2V0DQvG5kwCWo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kri14HRsynL9NP339m69rzLgTXKOvtIcOn1ngSZO12I=; b=iYm/U/BhbwQ2+zVNm/QgEnYHxW9QjaRnYTsGgbmXPjLpk/3DLGBeSPBqum044PtGHAY8VP ZQphl88cBXYHibDw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kri14HRsynL9NP339m69rzLgTXKOvtIcOn1ngSZO12I=; b=DJ2PRwc+J9vcW+JIvOvVqEKfD5sey5wwltAmgf2ZSS3sbIkgOTmEQdPFMspklNORsScGpv VHKKbwNu/9Q359gtXM3KCYNi7FIXvyvZD+iURJrw7/HUtF7t2n9iVihkODcdPw8t9vYYRA 4E0Yqbi7+vDQBURU2B2V0DQvG5kwCWo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kri14HRsynL9NP339m69rzLgTXKOvtIcOn1ngSZO12I=; b=iYm/U/BhbwQ2+zVNm/QgEnYHxW9QjaRnYTsGgbmXPjLpk/3DLGBeSPBqum044PtGHAY8VP ZQphl88cBXYHibDw== 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 EA8F913A69 for ; Thu, 16 May 2024 12:29:34 +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 qNr+Ny78RWbOfwAAD6G6ig (envelope-from ) for ; Thu, 16 May 2024 12:29:34 +0000 From: Andrea Cervesato Date: Thu, 16 May 2024 14:29:10 +0200 MIME-Version: 1.0 Message-Id: <20240516-listmount_statmount-v3-2-2ff4ba29bba7@suse.com> References: <20240516-listmount_statmount-v3-0-2ff4ba29bba7@suse.com> In-Reply-To: <20240516-listmount_statmount-v3-0-2ff4ba29bba7@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6753; i=andrea.cervesato@suse.com; h=from:subject:message-id; bh=Jf2tvQghaCONR/mmyE2R2IQ+O+iNPCZNB33/TczwVtU=; b=owEB7QES/pANAwAIAcvMGrIgs+ZGAcsmYgBmRfwt/r50ba5xHFDdxvzMsbZzz5XhsL9OaijH3 e3UtIiJ3eeJAbMEAAEIAB0WIQT1ysFzUKRW0sIb39jLzBqyILPmRgUCZkX8LQAKCRDLzBqyILPm RtLuC/9PUFYjshsdPzhyeIJwTWXoL6mJa5zaFyB5BBqtYDK4A/NpV2w8VHyjZYwre4QV7kuAhbT nxAMTrnSU3WBxZlV+ni94SGFjNYSQZwcaeEyIgBb6LHBu6jc9jfWiwj3K6Pm/8Jgth2nbQG8vtf 1s8EHqndl1X/k8hoqyQoDWwQqMWSFyu+dL0HeZSwSTg67HGq8KiFAFS1yx0LxlEyI+c4owrh+UB O00NcKeoZ526WXZcs5Jq6Hdit9Nmban0fStL0ObJpCo8/+M6hkrggQN5iovJo/223bWRmPVFqEF kQuP7OF1KxWyoS2XIQyxkO/MG+JCGcFxBLxIxGq4kNl74ZhLOZWac4Ld0v9K8kJK6h4Zlb5IyZS cEkLzevPw0R76iSi7hIxycuh+kz/3wm2bfqeuin0Lyxv8ks2ZpE9e6niTZdr9rPdV82O/8dv46o A6Zsn7icQiiI02NZd2/7evc11rnrbdC6wfh9+qDxpw6y7eQpLJsm4/0jVcuT7Cwo1RE+U= X-Developer-Key: i=andrea.cervesato@suse.com; a=openpgp; fpr=F5CAC17350A456D2C21BDFD8CBCC1AB220B3E646 X-Spam-Score: -4.30 X-Spam-Level: X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; TO_DN_NONE(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.com:email] X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,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-2.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-2.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v3 02/11] Add listmount/statmount syscalls 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 Reviewed-by: Avinesh Kumar --- 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 ++ 18 files changed, 36 insertions(+) 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 Thu May 16 12:29:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1935981 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=zTqLHcM+; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=IFAjxNiZ; 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=zTqLHcM+; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=IFAjxNiZ; 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 4Vg8cK3wq2z20KF for ; Thu, 16 May 2024 22:32:17 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 2D2793CF95E for ; Thu, 16 May 2024 14:32:15 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) (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 464743CF98A for ; Thu, 16 May 2024 14:29:38 +0200 (CEST) Authentication-Results: in-5.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-5.smtp.seeweb.it (Postfix) with ESMTPS id EE31A600C78 for ; Thu, 16 May 2024 14:29:36 +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 2025A34924 for ; Thu, 16 May 2024 12:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OcngAa9n7wwGfLXAah+5j185B246yDE4zqVXiSx5agc=; b=zTqLHcM+e3jKSH+RJi9SDLzVF///UDJ5qkIULC9GtNMqmhUCLO5sLbHtUvXJKqgRkNWzXC zro62kedW2cS0mCFarQ4GTwZCV6UCYcBWJpwCLfbomQW5PhsG1mrgjgByp7futdp8G3LGQ Z3IDokhNIQ+aC6ZwWpV3eMMqpek/ArY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OcngAa9n7wwGfLXAah+5j185B246yDE4zqVXiSx5agc=; b=IFAjxNiZ1Cif0qVFAcU2cOmlxMutUIyMFq1DkAHajFenhk6mIZHoqJkWhEUkHNC1pbyTYn wjRETuB3TMfF6dBw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OcngAa9n7wwGfLXAah+5j185B246yDE4zqVXiSx5agc=; b=zTqLHcM+e3jKSH+RJi9SDLzVF///UDJ5qkIULC9GtNMqmhUCLO5sLbHtUvXJKqgRkNWzXC zro62kedW2cS0mCFarQ4GTwZCV6UCYcBWJpwCLfbomQW5PhsG1mrgjgByp7futdp8G3LGQ Z3IDokhNIQ+aC6ZwWpV3eMMqpek/ArY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OcngAa9n7wwGfLXAah+5j185B246yDE4zqVXiSx5agc=; b=IFAjxNiZ1Cif0qVFAcU2cOmlxMutUIyMFq1DkAHajFenhk6mIZHoqJkWhEUkHNC1pbyTYn wjRETuB3TMfF6dBw== 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 0F3A813A6A for ; Thu, 16 May 2024 12:29:35 +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 iHJ2Ai/8RWbOfwAAD6G6ig (envelope-from ) for ; Thu, 16 May 2024 12:29:35 +0000 From: Andrea Cervesato Date: Thu, 16 May 2024 14:29:11 +0200 MIME-Version: 1.0 Message-Id: <20240516-listmount_statmount-v3-3-2ff4ba29bba7@suse.com> References: <20240516-listmount_statmount-v3-0-2ff4ba29bba7@suse.com> In-Reply-To: <20240516-listmount_statmount-v3-0-2ff4ba29bba7@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3605; i=andrea.cervesato@suse.com; h=from:subject:message-id; bh=hoP/WeLBriswU9VAcuqC6eIrSjxpS9ndWh8NDWIxSRY=; b=owEB7QES/pANAwAIAcvMGrIgs+ZGAcsmYgBmRfwtLgosCf4eOWviM6qSh4efjIJsvfrR7l8Ui txwKlXJQOaJAbMEAAEIAB0WIQT1ysFzUKRW0sIb39jLzBqyILPmRgUCZkX8LQAKCRDLzBqyILPm RrBqDACP7LSt1pRJoXsBoyZa3ZWZx605iGqCIcTHDY7OvKz5zPHF9D7KhEzyziJDSpQfv8CLu3I 4lh5pxqWQWNwdhrT+/k7a1MJdZTq2wDOghC6jJexWFSwaYVBFcV8PXVl/+MrkJJAZQw39NvQWer oCPi44cfijQNSaduNACzG/yZehdLxlyi/D1J2AFk0vw+ObKtteu2m+LLD1jWV/YSp2Y4Cw8zZUZ duglDzdUmHxPC+B7ruZkRkJO9++kSy3VpS50pV4Gdz0A9AB+CdFZK4diJJpM1FImlACQ4t6wH0X VW3m9wY7DPaxSLqDLb5rS2ZLKr32v2Db+CM3GiHi/PC3Nb7W46w4KclrkvlzOfoW3jJZ9+5QVlf Ux0Os/GZp6hMu4naBi4giPwJ8D8B/Y4qNiqlqB2sTEnK4ArGEpeRA6Gv0Aieg0ffwiv6HPXH/9Z /z+dNLkeBtNZ4z131IhwGTucv4zZElgLdsH+FPc1qJjQcFINCfgFxbI/U8UQ24KQC4UZw= X-Developer-Key: i=andrea.cervesato@suse.com; a=openpgp; fpr=F5CAC17350A456D2C21BDFD8CBCC1AB220B3E646 X-Spam-Level: X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.com:email] X-Spam-Score: -4.30 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-5.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-5.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v3 03/11] 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 --- configure.ac | 5 ++++ include/lapi/mount.h | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++ include/lapi/stat.h | 10 +++++++- 3 files changed, 84 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 85c5739c4..80462d2f8 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 \ @@ -233,6 +235,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..01a0fd2d6 100644 --- a/include/lapi/mount.h +++ b/include/lapi/mount.h @@ -2,12 +2,15 @@ /* * Copyright (c) Linux Test Project, 2015-2022 * Copyright (c) 2015 Cui Bixuan + * Copyright (C) 2024 SUSE LLC Andrea Cervesato */ #ifndef LAPI_MOUNT_H__ #define LAPI_MOUNT_H__ +#include #include +#include "config.h" #ifndef MS_REC # define MS_REC 16384 @@ -37,4 +40,71 @@ # define MS_NOSYMFOLLOW 256 #endif +#ifndef HAVE_STRUCT_MNT_ID_REQ +struct mnt_id_req { + uint32_t size; + uint32_t spare; + uint64_t mnt_id; + uint64_t param; +}; +#endif + +#ifndef HAVE_STRUCT_STATMOUNT +struct statmount { + uint32_t size; + uint32_t __spare1; + uint64_t mask; + uint32_t sb_dev_major; + uint32_t sb_dev_minor; + uint64_t sb_magic; + uint32_t sb_flags; + uint32_t fs_type; + uint64_t mnt_id; + uint64_t mnt_parent_id; + uint32_t mnt_id_old; + uint32_t mnt_parent_id_old; + uint64_t mnt_attr; + uint64_t mnt_propagation; + uint64_t mnt_peer_group; + uint64_t mnt_master; + uint64_t propagate_from; + uint32_t mnt_root; + uint32_t mnt_point; + uint64_t __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__ */ From patchwork Thu May 16 12:29:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1935974 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=CR+RcgGs; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=s8BOR+pn; 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=CR+RcgGs; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=s8BOR+pn; 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 4Vg8ZJ6Jtsz20KF for ; Thu, 16 May 2024 22:30:32 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 8F62E3CFADC for ; Thu, 16 May 2024 14:30:30 +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 C99B23CF97F for ; Thu, 16 May 2024 14:29:37 +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 F0BB51A011FA for ; Thu, 16 May 2024 14:29:36 +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 340105C34E for ; Thu, 16 May 2024 12:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YdcFoqnY9c2OXF1MmVqo3x9VoWV8L0Iw24DkxfcUyKw=; b=CR+RcgGskRbJBect75gi92hnOgztZ6PtFPYNAQXPpJNSiIMaAYrdYUfBYohcqUqfgvlrvd /pyLUTtLwbN+/YoewMVl2iG/uWeCLhovPFOSby5GK1HHkRXnRwYIDUAuvqgbVXHl/gNhzU SIuVOjclO0W1NXyXX0zVGG+Y7FnuLJA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YdcFoqnY9c2OXF1MmVqo3x9VoWV8L0Iw24DkxfcUyKw=; b=s8BOR+pnJ79v8W/3HGslD6VFK1Qxr6ma0VkEOdIUQQj6DgZonWDrrGQU3WOOBYbQWWopxE /I06MTHgDIl6vHBA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=CR+RcgGs; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=s8BOR+pn DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YdcFoqnY9c2OXF1MmVqo3x9VoWV8L0Iw24DkxfcUyKw=; b=CR+RcgGskRbJBect75gi92hnOgztZ6PtFPYNAQXPpJNSiIMaAYrdYUfBYohcqUqfgvlrvd /pyLUTtLwbN+/YoewMVl2iG/uWeCLhovPFOSby5GK1HHkRXnRwYIDUAuvqgbVXHl/gNhzU SIuVOjclO0W1NXyXX0zVGG+Y7FnuLJA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YdcFoqnY9c2OXF1MmVqo3x9VoWV8L0Iw24DkxfcUyKw=; b=s8BOR+pnJ79v8W/3HGslD6VFK1Qxr6ma0VkEOdIUQQj6DgZonWDrrGQU3WOOBYbQWWopxE /I06MTHgDIl6vHBA== 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 254E613991 for ; Thu, 16 May 2024 12:29:35 +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 sEfiBy/8RWbOfwAAD6G6ig (envelope-from ) for ; Thu, 16 May 2024 12:29:35 +0000 From: Andrea Cervesato Date: Thu, 16 May 2024 14:29:12 +0200 MIME-Version: 1.0 Message-Id: <20240516-listmount_statmount-v3-4-2ff4ba29bba7@suse.com> References: <20240516-listmount_statmount-v3-0-2ff4ba29bba7@suse.com> In-Reply-To: <20240516-listmount_statmount-v3-0-2ff4ba29bba7@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4180; i=andrea.cervesato@suse.com; h=from:subject:message-id; bh=qLi0GKtdGynRUAjLBjjefQivRv0YUAJKIml6b3f5PCQ=; b=owEB7QES/pANAwAIAcvMGrIgs+ZGAcsmYgBmRfwuq8+tBvijYvZTBgmPdp0u9azohYGM9yM07 +vEJu/fD9uJAbMEAAEIAB0WIQT1ysFzUKRW0sIb39jLzBqyILPmRgUCZkX8LgAKCRDLzBqyILPm RiePDACvvp9wK2ltFB20uluc9wBEkEgHpiH+o/2JmskdynStmavpNRbwMyObQz4bJcSl6EgHlQC zWLQkjMH4K+zhH2in1CVbACkDxcyai5oRy2QwL7V7QHR8Hxin0il19UQvqupgSszuxu06dIrzvP BIk6CLjYlHBcVGjzu7MemdgPDm0vLD9q709MiY95XnFCwdYrjgoeb7M+9wed8TzuMAz1vYMZvYv ctxXFU94ETZ5kIMspW8JZpdMbU19TrrDxlM4dr9yu9Qaq/H9ppCocHZ7s2q1rTzRXAHoHOw0B6E G6nbWFpj63lDTTq1ewQwnAuqK3Tu/WSfzpT78vbmIKhfakuiqpsbFJvaYQcsSib4uSxtrvYQau8 a+8hHvmNwJK/ZTkXmtRvw6cs38EtECcQCjkOnIcVmz1OIL5BWcyYmGG1SnFtrbegADy3Qm6a/uF w27yfTTjNNgP2VQUMqOtEMGR+iPMcTXkPUBdm3vQ/se/GoII+77qtVE8TM8ZilLBooLBc= X-Developer-Key: i=andrea.cervesato@suse.com; a=openpgp; fpr=F5CAC17350A456D2C21BDFD8CBCC1AB220B3E646 X-Spam-Score: -4.51 X-Rspamd-Action: no action X-Rspamd-Queue-Id: 340105C34E X-Spam-Level: X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; 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)[]; ARC_NA(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; DWL_DNSWL_BLOCKED(0.00)[suse.de:dkim]; RCPT_COUNT_ONE(0.00)[1]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; 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 v3 04/11] 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. --- runtest/syscalls | 2 + testcases/kernel/syscalls/listmount/.gitignore | 1 + testcases/kernel/syscalls/listmount/Makefile | 7 +++ testcases/kernel/syscalls/listmount/listmount.h | 26 +++++++++ testcases/kernel/syscalls/listmount/listmount01.c | 66 +++++++++++++++++++++++ 5 files changed, 102 insertions(+) diff --git a/runtest/syscalls b/runtest/syscalls index cf06ee563..bce04c0cf 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..e586c3ab3 --- /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 Thu May 16 12:29:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1935972 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=nSaD8wgR; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=1V/pSWsU; 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=nSaD8wgR; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=1V/pSWsU; 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 4Vg8Yq1sSHz1yfq for ; Thu, 16 May 2024 22:30:06 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 302593CFA8F for ; Thu, 16 May 2024 14:29:57 +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 F3BBA3CF95E for ; Thu, 16 May 2024 14:29:36 +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 0CD921000F79 for ; Thu, 16 May 2024 14:29:35 +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 4A4265C34F for ; Thu, 16 May 2024 12:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DEZoiWI1HDDyKKFotC2j3L82XgzUt0ipCj9k/PGE91E=; b=nSaD8wgR5S3+hcM9JKgQ0VcaHmBxGkCOC+enEVxkuzNmvDgfbakWTGl3QIoy7r9JiWQxaE /KYd9gcx+825lFk736q7XfbuEg8QvdIoeGZLPocd4+wZraoBr3ZJOi0PrToMr2jRduH9b0 G/Ataeei3aJe++F/mnJTqaadtkuJb/c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DEZoiWI1HDDyKKFotC2j3L82XgzUt0ipCj9k/PGE91E=; b=1V/pSWsUAxm8gw8U0+GEjXULNaaWjfRqKjfyA4d8dJyAGI/GXBX0JrwErekOufn1EL3MVa AVYaScmyFMIePTDg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=nSaD8wgR; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="1V/pSWsU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DEZoiWI1HDDyKKFotC2j3L82XgzUt0ipCj9k/PGE91E=; b=nSaD8wgR5S3+hcM9JKgQ0VcaHmBxGkCOC+enEVxkuzNmvDgfbakWTGl3QIoy7r9JiWQxaE /KYd9gcx+825lFk736q7XfbuEg8QvdIoeGZLPocd4+wZraoBr3ZJOi0PrToMr2jRduH9b0 G/Ataeei3aJe++F/mnJTqaadtkuJb/c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DEZoiWI1HDDyKKFotC2j3L82XgzUt0ipCj9k/PGE91E=; b=1V/pSWsUAxm8gw8U0+GEjXULNaaWjfRqKjfyA4d8dJyAGI/GXBX0JrwErekOufn1EL3MVa AVYaScmyFMIePTDg== 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 3B149137C3 for ; Thu, 16 May 2024 12:29:35 +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 QJEcDS/8RWbOfwAAD6G6ig (envelope-from ) for ; Thu, 16 May 2024 12:29:35 +0000 From: Andrea Cervesato Date: Thu, 16 May 2024 14:29:13 +0200 MIME-Version: 1.0 Message-Id: <20240516-listmount_statmount-v3-5-2ff4ba29bba7@suse.com> References: <20240516-listmount_statmount-v3-0-2ff4ba29bba7@suse.com> In-Reply-To: <20240516-listmount_statmount-v3-0-2ff4ba29bba7@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3766; i=andrea.cervesato@suse.com; h=from:subject:message-id; bh=xbgV+pzivGC7E4r80ESIhvD9j7U+FfCrJgP3xp6Ag/4=; b=owEB7QES/pANAwAIAcvMGrIgs+ZGAcsmYgBmRfwuHEqTFCsZjDvXHgvuV+zFw10BLsRP/XrSU NEyLF0wY9SJAbMEAAEIAB0WIQT1ysFzUKRW0sIb39jLzBqyILPmRgUCZkX8LgAKCRDLzBqyILPm Rh5/C/0R5e/aO2haOwUMaL5YLdIKbq+2PZrqeaXrqOjs1uUPy4wd3W02S1P0JC8r8SkKGJcg008 EPn8/w+DtqMs26HbB9c8ecDz/XZCoQPYxR/UBRKC76fpjrIu2EiCf5CvgrvXm/V1D+hAVQU31we 7hoYC/pJmX3ZvE+P3TUuGJmsDHlxZu71zixrVgfZak1w2Mo5l1/PhGguziOtHCMif1+L7mOir8h Lpa7q66COZ46espuA+78URPdjQ68RDo+u912rTA4FzZzeAX8ZyrkR5yXV5V1BH4LTBnjumONleI mWLgsMgsyOe2UFdY2boFNRZlFipZhOSlO7Ghi1FdI5aK0ex4knCdIOphTRzzGN0PudOGd9v2V0r kwTx7ZzvMnwsuFrUhal4t7BiFhuck82JEM0vHzIiDUn7lXmGX/4F3Kx0RbGdsQddlp+6aFDp+aA bd+8+MVuOrCWkScbc8ESOAXW6VytX3AlzWlOenswYtqdJrvF0GzXxr2nFpr37gp1jvDvM= X-Developer-Key: i=andrea.cervesato@suse.com; a=openpgp; fpr=F5CAC17350A456D2C21BDFD8CBCC1AB220B3E646 X-Spam-Level: X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; 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)[]; ARC_NA(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; DWL_DNSWL_BLOCKED(0.00)[suse.de:dkim]; RCPT_COUNT_ONE(0.00)[1]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 4A4265C34F X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Score: -4.51 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-4.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-4.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v3 05/11] 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. --- runtest/syscalls | 1 + testcases/kernel/syscalls/listmount/.gitignore | 1 + testcases/kernel/syscalls/listmount/listmount02.c | 106 ++++++++++++++++++++++ 3 files changed, 108 insertions(+) diff --git a/runtest/syscalls b/runtest/syscalls index bce04c0cf..8831c0aec 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..cd742bd64 --- /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 Thu May 16 12:29:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1935975 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=bhEP0LnV; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=29gX4zuk; 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=bhEP0LnV; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=29gX4zuk; 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 4Vg8Zg0nRfz20KF for ; Thu, 16 May 2024 22:30:51 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id C5D9A3CFA6A for ; Thu, 16 May 2024 14:30:48 +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 [IPv6:2001:4b78:1:20::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 F3BCC3CF95E for ; Thu, 16 May 2024 14:29:37 +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 019DC100113F for ; Thu, 16 May 2024 14:29:36 +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 600BA5C353 for ; Thu, 16 May 2024 12:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nMwE4poR0pgzvbcHjU3aU2mILrMHdbiDYK0XgfA1AeU=; b=bhEP0LnVyVA+bZGVHpiWD/8IJ9EX/Lb2fW0RT4fMy1re7IH/omO/vIl/u3dCxBdj6aItjC 3adS9fIL/yRlxjeGEKwVxLVM/y7FmmF34IfKZ4tf/VuBme+YV6YxH154qUz/8pC8PC4hRi K7kbP+6ClEgnzBAM48ruQjZULafB0/M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nMwE4poR0pgzvbcHjU3aU2mILrMHdbiDYK0XgfA1AeU=; b=29gX4zukrtjmTjQ2cHnlHtRSUH3DOFdcFqDM1u9xr6opSAt9f74ma6WbHDO8fUdoPACxnr fajwGHihV/A1TfBA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=bhEP0LnV; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=29gX4zuk DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nMwE4poR0pgzvbcHjU3aU2mILrMHdbiDYK0XgfA1AeU=; b=bhEP0LnVyVA+bZGVHpiWD/8IJ9EX/Lb2fW0RT4fMy1re7IH/omO/vIl/u3dCxBdj6aItjC 3adS9fIL/yRlxjeGEKwVxLVM/y7FmmF34IfKZ4tf/VuBme+YV6YxH154qUz/8pC8PC4hRi K7kbP+6ClEgnzBAM48ruQjZULafB0/M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nMwE4poR0pgzvbcHjU3aU2mILrMHdbiDYK0XgfA1AeU=; b=29gX4zukrtjmTjQ2cHnlHtRSUH3DOFdcFqDM1u9xr6opSAt9f74ma6WbHDO8fUdoPACxnr fajwGHihV/A1TfBA== 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 508BD13A69 for ; Thu, 16 May 2024 12:29:35 +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 QN9uEi/8RWbOfwAAD6G6ig (envelope-from ) for ; Thu, 16 May 2024 12:29:35 +0000 From: Andrea Cervesato Date: Thu, 16 May 2024 14:29:14 +0200 MIME-Version: 1.0 Message-Id: <20240516-listmount_statmount-v3-6-2ff4ba29bba7@suse.com> References: <20240516-listmount_statmount-v3-0-2ff4ba29bba7@suse.com> In-Reply-To: <20240516-listmount_statmount-v3-0-2ff4ba29bba7@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4101; i=andrea.cervesato@suse.com; h=from:subject:message-id; bh=Qx8T74AfQ8h9rHqYZ8E6v+EO8V0TTdhkia11iJd7rYM=; b=owEB7QES/pANAwAIAcvMGrIgs+ZGAcsmYgBmRfwuzWmyf1BrxbhVt5JaMNECyODqd/MUJvO/K 4IsqgQp+QqJAbMEAAEIAB0WIQT1ysFzUKRW0sIb39jLzBqyILPmRgUCZkX8LgAKCRDLzBqyILPm RtW6DACyFmJGon1x4lDDyj78YB+l5Ri5tXrYG3YoDsotrFKRKdUeivk9uUAhzajqdU/FZZdO3Ti aG6h8FX4gcYDGOU8T50JSCy6w4OsUSapAjfbrFO7dVkHZ0r0HmXXqMpbPoVjJhkB83uh7r27+DN Qk7zB55I9UXSydGGoBMvFsBCxK3yjKtxzx8PxiHeeUutmlfNa5Tgl6m5Yfsjz1HKOpaiPr7nFdJ YReCI+8pOKB/0QZ+xtzPydFgdS35X6lUIxDlwm4COvuSXq0LMJXRP4JsLivQp7pZ/XkPSP4Ngd0 J9rc86x3p5b09e/6/uOUUos2UBZCOniczYUHbpaGHLKGAh4CrioFk4bbG0YV+UEahjrkTBGOKBX b7/54bKpsKTGv311zmiN0+dyHOO6FA+XEHHncTBW/P9J3ttCy14UcoRX9rs53srs2F8SC6ZAqFm GDpBjbRjHTeugDLp/oqPIzXvUqAlpmY7kfXg23+cOkUEHYBVYl387d5b1ND4tSoUz9Atk= X-Developer-Key: i=andrea.cervesato@suse.com; a=openpgp; fpr=F5CAC17350A456D2C21BDFD8CBCC1AB220B3E646 X-Spam-Score: -4.51 X-Rspamd-Action: no action X-Rspamd-Queue-Id: 600BA5C353 X-Spam-Level: X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; 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)[]; ARC_NA(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.com:email]; DWL_DNSWL_BLOCKED(0.00)[suse.de:dkim]; RCPT_COUNT_ONE(0.00)[1]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-4.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-4.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v3 06/11] 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. --- runtest/syscalls | 2 + testcases/kernel/syscalls/statmount/.gitignore | 1 + testcases/kernel/syscalls/statmount/Makefile | 7 +++ testcases/kernel/syscalls/statmount/statmount.h | 26 +++++++++ testcases/kernel/syscalls/statmount/statmount01.c | 69 +++++++++++++++++++++++ 5 files changed, 105 insertions(+) diff --git a/runtest/syscalls b/runtest/syscalls index 8831c0aec..d36aebfd5 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -1538,6 +1538,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..ad2d8f727 --- /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 Thu May 16 12:29:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1935971 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=bM5q91Wi; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Yffb5iIS; 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=bM5q91Wi; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Yffb5iIS; 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 4Vg8YL1Kr3z1ymw for ; Thu, 16 May 2024 22:29:42 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id A99BF3CF9D5 for ; Thu, 16 May 2024 14:29:39 +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)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id B86633CF95E for ; Thu, 16 May 2024 14:29:36 +0200 (CEST) Authentication-Results: in-7.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-7.smtp.seeweb.it (Postfix) with ESMTPS id 0B3A9200AD4 for ; Thu, 16 May 2024 14:29:35 +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 757E234925 for ; Thu, 16 May 2024 12:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KD84L6CKqH9US6ZiwJGLI7FOK+OkRe/QvBOdn7fozlQ=; b=bM5q91WiWKZiK50Mkm9U+UEo0tlr3XQ9JDZ7bhEw6ZsbJHiYAzoPUYYSxPtjPUNs2m/PiI dWrnS5dDxPxqNkkFLpQhDwgOu9ZPbNyhzDYPEqX33QvjnCi9d0mx5aDlLDfCudX314Sqia XF/a88veU54sYD1hUZqa82wTCpP5X6c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KD84L6CKqH9US6ZiwJGLI7FOK+OkRe/QvBOdn7fozlQ=; b=Yffb5iISBWaKmO9suRcvzRwg+K3qrSPQZ6dbNHO4InR72XS3fMOLxqdRJa9QbcOiWwbgQo +Asl9yqUZ5MdSCDw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KD84L6CKqH9US6ZiwJGLI7FOK+OkRe/QvBOdn7fozlQ=; b=bM5q91WiWKZiK50Mkm9U+UEo0tlr3XQ9JDZ7bhEw6ZsbJHiYAzoPUYYSxPtjPUNs2m/PiI dWrnS5dDxPxqNkkFLpQhDwgOu9ZPbNyhzDYPEqX33QvjnCi9d0mx5aDlLDfCudX314Sqia XF/a88veU54sYD1hUZqa82wTCpP5X6c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KD84L6CKqH9US6ZiwJGLI7FOK+OkRe/QvBOdn7fozlQ=; b=Yffb5iISBWaKmO9suRcvzRwg+K3qrSPQZ6dbNHO4InR72XS3fMOLxqdRJa9QbcOiWwbgQo +Asl9yqUZ5MdSCDw== 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 663FC137C3 for ; Thu, 16 May 2024 12:29:35 +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 KDfAFy/8RWbOfwAAD6G6ig (envelope-from ) for ; Thu, 16 May 2024 12:29:35 +0000 From: Andrea Cervesato Date: Thu, 16 May 2024 14:29:15 +0200 MIME-Version: 1.0 Message-Id: <20240516-listmount_statmount-v3-7-2ff4ba29bba7@suse.com> References: <20240516-listmount_statmount-v3-0-2ff4ba29bba7@suse.com> In-Reply-To: <20240516-listmount_statmount-v3-0-2ff4ba29bba7@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3221; i=andrea.cervesato@suse.com; h=from:subject:message-id; bh=uBwCybHwKZr/Zok9JEnJzDiFKJeizgL+4I4h7HzZc4Q=; b=owEB7QES/pANAwAIAcvMGrIgs+ZGAcsmYgBmRfwuzpUwUeQlBHdNJZqAKspjHETWMN8g+OcoW NWdIW3WikyJAbMEAAEIAB0WIQT1ysFzUKRW0sIb39jLzBqyILPmRgUCZkX8LgAKCRDLzBqyILPm RjO2C/wOnnS1wJzmEMGjhG22AoVRtLvfjngLxUX19XoT3esHFWmtyULlJxWwWHv7/3pDRVmzwIM 5HccaqjK3Vgdr4fyvBs1jzyrJk7GwFWyPx8b6f4VwN525TbIDWqW9k6IPOmcbRQPVU5W/ZsGJ5+ W90xOnAthgl5DUA9JyrROoEc2hta12Hb/mE629C/0EwOgPQmpqJA2386lGAYcOnNezy25IvAxSg ncVRtYD0KNWSjGpcyXJShcj1HLFEGkxhDm7LSG7eiUG7ZayvgrhMk5HaNleel6McglNQZNubUSX lc27mXRLyNkC8O8wEtmQPZTzQq6em93O+B6OdWKULAZ7AClHkU8YLQKZLSGBNDyyWYQHRMeNhGl lLsQnc4GDg1UuMxsykvErXEt7b/XjnWGcQGzKIAwAep1VHbkCWG3Fv37oHuWelUCYpnwgIZP2xP KcX0L5g/h8Ky2WpORx1SMjmZSS1AyWTnZmNKnvoG1nCRI1vYJfXKsIWnfHBtsGnCnkONQ= X-Developer-Key: i=andrea.cervesato@suse.com; a=openpgp; fpr=F5CAC17350A456D2C21BDFD8CBCC1AB220B3E646 X-Spam-Level: X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,imap1.dmz-prg2.suse.org:helo] X-Spam-Score: -4.30 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-7.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-7.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v3 07/11] 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. --- runtest/syscalls | 1 + testcases/kernel/syscalls/statmount/.gitignore | 1 + testcases/kernel/syscalls/statmount/statmount02.c | 76 +++++++++++++++++++++++ 3 files changed, 78 insertions(+) diff --git a/runtest/syscalls b/runtest/syscalls index d36aebfd5..ac6ebb51d 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -1539,6 +1539,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..77cd88469 --- /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 Thu May 16 12:29:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1935980 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=Dc6OYHDs; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=c/X3Fpvz; 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=Dc6OYHDs; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=c/X3Fpvz; 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 4Vg8c02gTkz20KF for ; Thu, 16 May 2024 22:32:00 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id F0B253CFA6A for ; Thu, 16 May 2024 14:31:57 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) (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 321DD3CF982 for ; Thu, 16 May 2024 14:29:38 +0200 (CEST) Authentication-Results: in-5.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-5.smtp.seeweb.it (Postfix) with ESMTPS id 9E651600FB9 for ; Thu, 16 May 2024 14:29:37 +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 8B2145C355 for ; Thu, 16 May 2024 12:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gyFJ5TEreUyXbp0M7V2Lh2GjCSo1bh6s2ozW1fxXFWg=; b=Dc6OYHDszI55XRFEIT5QL5gJTCoS8nB3hoUc4nQdRSeEvuLv6I5wCTy7wYkaRpsa5+Jvwi uykpYFAza0Qf7C17egbhi442vEqQQw/pa0rC8qftyzCv+1Tmvn07HQpvqsdokbt7uH2P5G ZVt+/NZUhg7WjSBij3YUo+Gh/PGTFPM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gyFJ5TEreUyXbp0M7V2Lh2GjCSo1bh6s2ozW1fxXFWg=; b=c/X3Fpvzse0WfoJTmxMhNTFXmd/eg26faVY7/0UxikwxIBHIaP3LSTz3sa1Q/+Hi4dgJt8 nNa7CUfNvbyuBdAQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=Dc6OYHDs; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="c/X3Fpvz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gyFJ5TEreUyXbp0M7V2Lh2GjCSo1bh6s2ozW1fxXFWg=; b=Dc6OYHDszI55XRFEIT5QL5gJTCoS8nB3hoUc4nQdRSeEvuLv6I5wCTy7wYkaRpsa5+Jvwi uykpYFAza0Qf7C17egbhi442vEqQQw/pa0rC8qftyzCv+1Tmvn07HQpvqsdokbt7uH2P5G ZVt+/NZUhg7WjSBij3YUo+Gh/PGTFPM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gyFJ5TEreUyXbp0M7V2Lh2GjCSo1bh6s2ozW1fxXFWg=; b=c/X3Fpvzse0WfoJTmxMhNTFXmd/eg26faVY7/0UxikwxIBHIaP3LSTz3sa1Q/+Hi4dgJt8 nNa7CUfNvbyuBdAQ== 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 7C0A213991 for ; Thu, 16 May 2024 12:29:35 +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 OO4HHS/8RWbOfwAAD6G6ig (envelope-from ) for ; Thu, 16 May 2024 12:29:35 +0000 From: Andrea Cervesato Date: Thu, 16 May 2024 14:29:16 +0200 MIME-Version: 1.0 Message-Id: <20240516-listmount_statmount-v3-8-2ff4ba29bba7@suse.com> References: <20240516-listmount_statmount-v3-0-2ff4ba29bba7@suse.com> In-Reply-To: <20240516-listmount_statmount-v3-0-2ff4ba29bba7@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3908; i=andrea.cervesato@suse.com; h=from:subject:message-id; bh=ZC4ICfJAoGrDs2CjPjQ+IKz+MGVUm3eH5X3BqdSqgyg=; b=owEB7QES/pANAwAIAcvMGrIgs+ZGAcsmYgBmRfwu7yxraBk873+Z6fpts2PPfcBJ0d5ns5PdL 8I8xg4OkDOJAbMEAAEIAB0WIQT1ysFzUKRW0sIb39jLzBqyILPmRgUCZkX8LgAKCRDLzBqyILPm RuYXC/9xpWWDiC9vDe3+G+OlzpoORIAeDk/TSQIsB9r9lnTd+oHCw9L6SZyjDnXycYNH2+s/F5k onjCBsL2VwoztotDPUH7+kYwi9+NPEVOiHP8vzTB6vMGdbYNMnqRftwFOmvl6SyAKzCT+chXVVE vXPp/exDsjlJIqGTfY7EKb6WReGVdFmArXKgF/WHnSb0fLjKnwZpu7cLbX5Tz5nnzwdqWnpEVjo H6dIfUq7rTjDAGMOm+cgQ4GNwGPR0HGwBtRWhcjoU7v24m+Jv1G+ztJHus5veQUgFSdI1hEhlWz YggMx3aBxXXuyFIHgEqRqTrvZ8vB+DV3HuR/WhejXuKon5EmVpiI3GxkaJBacl0UjriJMXd2+YK gxmzxW2kKC/KVDR5XMnzQRrw77odG+malvnKIcqMhsHj/aXzBN4F6UMBas3AYd6PyR8BN9duM1M VfRFCDwcDNrFb4WULuQVjMbBOX7kQ8gUxEBrIEoJPYiB3iqg+17nWS4CRKtvP+7XEZ+2s= X-Developer-Key: i=andrea.cervesato@suse.com; a=openpgp; fpr=F5CAC17350A456D2C21BDFD8CBCC1AB220B3E646 X-Spam-Score: -4.51 X-Rspamd-Action: no action X-Rspamd-Queue-Id: 8B2145C355 X-Spam-Level: X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; 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)[]; ARC_NA(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.com:email]; DWL_DNSWL_BLOCKED(0.00)[suse.de:dkim]; RCPT_COUNT_ONE(0.00)[1]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; 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-5.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-5.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v3 08/11] 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. --- runtest/syscalls | 1 + testcases/kernel/syscalls/statmount/.gitignore | 1 + testcases/kernel/syscalls/statmount/statmount03.c | 97 +++++++++++++++++++++++ 3 files changed, 99 insertions(+) diff --git a/runtest/syscalls b/runtest/syscalls index ac6ebb51d..6eba317de 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -1540,6 +1540,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..06b17bf16 --- /dev/null +++ b/testcases/kernel/syscalls/statmount/statmount03.c @@ -0,0 +1,97 @@ +// 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", + .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 Thu May 16 12:29:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1935979 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=Vn7yKUIx; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=l901OBgO; 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=Vn7yKUIx; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=l901OBgO; 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 4Vg8bh1bKYz20KF for ; Thu, 16 May 2024 22:31:44 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id E20163CF9E3 for ; Thu, 16 May 2024 14:31:41 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 28D453CF95E for ; Thu, 16 May 2024 14:29:38 +0200 (CEST) Authentication-Results: in-6.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.de (client-ip=2a07:de40:b251:101:10:150:64:1; helo=smtp-out1.suse.de; envelope-from=andrea.cervesato@suse.de; receiver=lists.linux.it) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id F3C7F141C9A6 for ; Thu, 16 May 2024 14:29:36 +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 A211834926 for ; Thu, 16 May 2024 12:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aQQKJpbIIHsiFBfa+xkq17ZJqbUzjWrMaWql5wFCjTU=; b=Vn7yKUIxSFRO5s80nXCodRNua8h9rcgUZ4SR3ac1Ky2fexVKGna3IF+IiMkowrQOKNTyqq kOsxlmuGmsCs8qOhz+l1dnvvxQCYQPCLidkwF37WkiQwuDCAEW1Vf+G5mMsKjrI+dtq1Cu /+Thlz44EHRnpDeBsMn4qC3y+9N1dAg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aQQKJpbIIHsiFBfa+xkq17ZJqbUzjWrMaWql5wFCjTU=; b=l901OBgO7wJjQ6Nj6eN403tfOKwqcUie2eSaAWPOqpDgtcEiaE3czYrA44mA1s8IVFiQNY Frx6bTvncXIDflCg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aQQKJpbIIHsiFBfa+xkq17ZJqbUzjWrMaWql5wFCjTU=; b=Vn7yKUIxSFRO5s80nXCodRNua8h9rcgUZ4SR3ac1Ky2fexVKGna3IF+IiMkowrQOKNTyqq kOsxlmuGmsCs8qOhz+l1dnvvxQCYQPCLidkwF37WkiQwuDCAEW1Vf+G5mMsKjrI+dtq1Cu /+Thlz44EHRnpDeBsMn4qC3y+9N1dAg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aQQKJpbIIHsiFBfa+xkq17ZJqbUzjWrMaWql5wFCjTU=; b=l901OBgO7wJjQ6Nj6eN403tfOKwqcUie2eSaAWPOqpDgtcEiaE3czYrA44mA1s8IVFiQNY Frx6bTvncXIDflCg== 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 920E2137C3 for ; Thu, 16 May 2024 12:29:35 +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 GDtiIi/8RWbOfwAAD6G6ig (envelope-from ) for ; Thu, 16 May 2024 12:29:35 +0000 From: Andrea Cervesato Date: Thu, 16 May 2024 14:29:17 +0200 MIME-Version: 1.0 Message-Id: <20240516-listmount_statmount-v3-9-2ff4ba29bba7@suse.com> References: <20240516-listmount_statmount-v3-0-2ff4ba29bba7@suse.com> In-Reply-To: <20240516-listmount_statmount-v3-0-2ff4ba29bba7@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4624; i=andrea.cervesato@suse.com; h=from:subject:message-id; bh=mIFZIfORykqS/qCu70lmerKVoOvdKkK4lfxrA+MetDU=; b=owEB7QES/pANAwAIAcvMGrIgs+ZGAcsmYgBmRfwu6AWM6ZKfcObs3Sv86X2ID/s9Os0lpy49z jKxb8VZ6CiJAbMEAAEIAB0WIQT1ysFzUKRW0sIb39jLzBqyILPmRgUCZkX8LgAKCRDLzBqyILPm RksDC/9iJU2w9gx5wgEITFkSB5NbZ25YvwSdabbQ+v+Ga7jiq0j0vJ+DUxLk5pZTu1426G/c6kM eBypmJib0P3gX/az1w53uM9SSiUqlyioMFaUOk6qQ8kVWyqaNsNMWMhdRKIoDT+q2PJTcEBHRye HiS3kE7DHPPQB513pqPVfYB7PijIBXJ0NJlTjOHBmuqpzE2BURHvUeEgeEGM/F+IZhpKNNcyNol 28Yabnh9zxaHoP3JJOaT8akfd6NDlD6G2GwQwNQGUT23lt5nLtfTqQQ9oPX6OzX+TyTNDo9hTn5 bmCVIo+6rpIzdwOeAcecCs27A7LrLxjx9oN3wGQdBCR5nmTSz1iVRC5pw3c5oxn9YtiScc4c/+S PBIhjJSGPRHnBmufflQuqMSiMdxsXkZxNVRJfNLrA0hs+1Yeq7S0unJ06rbZKY+MskTm1crB+cK uSmY88dvGN7SRTsvG/zIxSYzIWrzXKBnQpSUWPthkbgpxFxGyUlE4Gj00GGxldRz7zglg= X-Developer-Key: i=andrea.cervesato@suse.com; a=openpgp; fpr=F5CAC17350A456D2C21BDFD8CBCC1AB220B3E646 X-Spam-Level: X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,imap1.dmz-prg2.suse.org:helo] X-Spam-Score: -4.30 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-6.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-6.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v3 09/11] 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. --- runtest/syscalls | 1 + testcases/kernel/syscalls/statmount/.gitignore | 1 + testcases/kernel/syscalls/statmount/statmount04.c | 131 ++++++++++++++++++++++ 3 files changed, 133 insertions(+) diff --git a/runtest/syscalls b/runtest/syscalls index 6eba317de..81c2f9740 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -1541,6 +1541,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..6ca7ab4d0 --- /dev/null +++ b/testcases/kernel/syscalls/statmount/statmount04.c @@ -0,0 +1,131 @@ +// 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", + .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 Thu May 16 12:29:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1935978 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=P9dHX94A; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=1qDXsCa5; 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=P9dHX94A; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=1qDXsCa5; 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 4Vg8bL5SNnz20KF for ; Thu, 16 May 2024 22:31:26 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id ADDD43CF9AD for ; Thu, 16 May 2024 14:31:23 +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 0D7D23CF97F for ; Thu, 16 May 2024 14:29:38 +0200 (CEST) Authentication-Results: in-3.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-3.smtp.seeweb.it (Postfix) with ESMTPS id 88EA41A0123D for ; Thu, 16 May 2024 14:29:37 +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 B8CBC5C357 for ; Thu, 16 May 2024 12:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eN4lTr1ZNgLCcs5/K3J2RfJtYxeZHwhoeH4gCpIzH2s=; b=P9dHX94AjWFP8yeYeyKhM6C7UilJ9sMOi+0b/oa9iYThhzs95QBZRUzewomAIigUgRya8f bTEXNuN+7SAGi1Ag3gxF9jaDokIZuhOrfNklAeWJqSrZHlg9MwGH37eixLYxTttIskXp7B PzIEVxifzha3rHxW8MdQCYKyEe9aEig= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eN4lTr1ZNgLCcs5/K3J2RfJtYxeZHwhoeH4gCpIzH2s=; b=1qDXsCa5lpjQCplK9btTuSd25P+2KiDnR1smbr8gXMY8AZnwvKu08pCPtiqicPt2ex6Gj8 W3TyvvWWIrh8JhCQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=P9dHX94A; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=1qDXsCa5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eN4lTr1ZNgLCcs5/K3J2RfJtYxeZHwhoeH4gCpIzH2s=; b=P9dHX94AjWFP8yeYeyKhM6C7UilJ9sMOi+0b/oa9iYThhzs95QBZRUzewomAIigUgRya8f bTEXNuN+7SAGi1Ag3gxF9jaDokIZuhOrfNklAeWJqSrZHlg9MwGH37eixLYxTttIskXp7B PzIEVxifzha3rHxW8MdQCYKyEe9aEig= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eN4lTr1ZNgLCcs5/K3J2RfJtYxeZHwhoeH4gCpIzH2s=; b=1qDXsCa5lpjQCplK9btTuSd25P+2KiDnR1smbr8gXMY8AZnwvKu08pCPtiqicPt2ex6Gj8 W3TyvvWWIrh8JhCQ== 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 A8C0213991 for ; Thu, 16 May 2024 12:29:35 +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 ABPyJy/8RWbOfwAAD6G6ig (envelope-from ) for ; Thu, 16 May 2024 12:29:35 +0000 From: Andrea Cervesato Date: Thu, 16 May 2024 14:29:18 +0200 MIME-Version: 1.0 Message-Id: <20240516-listmount_statmount-v3-10-2ff4ba29bba7@suse.com> References: <20240516-listmount_statmount-v3-0-2ff4ba29bba7@suse.com> In-Reply-To: <20240516-listmount_statmount-v3-0-2ff4ba29bba7@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4566; i=andrea.cervesato@suse.com; h=from:subject:message-id; bh=/DQLB3VToWHb6kcU3+8m//HwaL2/mHjFsY7WFdLzq9o=; b=owEB7QES/pANAwAIAcvMGrIgs+ZGAcsmYgBmRfwuRdwND/KUaa9g95iaG07hIJVyK2Xknqk3S VghQrdxNUyJAbMEAAEIAB0WIQT1ysFzUKRW0sIb39jLzBqyILPmRgUCZkX8LgAKCRDLzBqyILPm RtonC/wOoTmsllO0yGLBxZ/OcpTc4MVbk2+dexKNs8KiAJ4n+dH8eKZ2AK0de4bd+rPoePc3rn5 IazLIMyZpGZShHK+GPtldqzSJYgK96iVHiSNg2MddNBZjYP4D4nK7h2y212dWFxdRps/eJZVMur JKq5rynXzBQybzu8r6NsI9yMy5p9snXRhRECPiHRkGSmAdz01B6gYEb1Y4dp0lsxDeJfsFEQasE MY3x7Wxm488XAgdMRafUz8NdEuNdAdGi5lxjR/CkvIDYGm05/OwdT5XqWMm6II2FBmWbGrhIio+ 9O8L93bK3ZqH+IdHbNBypm2qnO//Etq3KO7bWMND9df+pmxN4NWWfAEKkQPXp871gDpSSWYhd4q OmX5qsUpaaMz3BQ4X3YUkrtdqLuihFDNWOzeOHGOIDQR8AdaRcF+74vNk6v23MWnGiGo4M4BeSz rg5IoV2Bwe7NHX8N0VOdcLQbe/gxCA9kUJTxSQJPAFArJfD6Ti4qTrQogCXQWvO/N1NFM= X-Developer-Key: i=andrea.cervesato@suse.com; a=openpgp; fpr=F5CAC17350A456D2C21BDFD8CBCC1AB220B3E646 X-Spam-Level: X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; 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)[]; ARC_NA(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; DWL_DNSWL_BLOCKED(0.00)[suse.de:dkim]; RCPT_COUNT_ONE(0.00)[1]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: B8CBC5C357 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Score: -4.51 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-3.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-3.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v3 10/11] 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(). --- runtest/syscalls | 1 + testcases/kernel/syscalls/statmount/.gitignore | 1 + testcases/kernel/syscalls/statmount/statmount05.c | 136 ++++++++++++++++++++++ 3 files changed, 138 insertions(+) diff --git a/runtest/syscalls b/runtest/syscalls index 81c2f9740..b04aabc6f 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -1542,6 +1542,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..61ac462e1 --- /dev/null +++ b/testcases/kernel/syscalls/statmount/statmount05.c @@ -0,0 +1,136 @@ +// 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", + .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 Thu May 16 12:29:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1935977 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=rc2YJZNu; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=ntPe/YpX; 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=rc2YJZNu; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=ntPe/YpX; 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 4Vg8b05lBbz20KF for ; Thu, 16 May 2024 22:31:08 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 6970A3CFA1E for ; Thu, 16 May 2024 14:31:06 +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 [IPv6:2001:4b78:1:20::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 F41D03CF981 for ; Thu, 16 May 2024 14:29:37 +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 F199D1001133 for ; Thu, 16 May 2024 14:29:36 +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 CF28834927 for ; Thu, 16 May 2024 12:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Wsrn1Mz28skBQ9t974KocbnFS1Gshe2mMfHizCv6hxQ=; b=rc2YJZNuoccVNLEnpI6XbStDweoCv444QbZ3uktz9yTo5A0W+8OJZnLQClnlWiuDYT3hbf Q3P7BT/wgIZjvjuRbiVRRRvDBrzFf+My7957FNBq7FAj3ZJJIAyrsUiJ3yIjKiTpPCCyYK /B1LIL4VQcCog7e6ALj9XhcZa2vdIkM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Wsrn1Mz28skBQ9t974KocbnFS1Gshe2mMfHizCv6hxQ=; b=ntPe/YpXyPycMKNSQVURDYR1KVcQfgwA5h8rk+ByFzlTq1O4HmlO4kYFQI9ACHgCnptgl9 RYiTWCI6j+UgPIDg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=rc2YJZNu; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="ntPe/YpX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Wsrn1Mz28skBQ9t974KocbnFS1Gshe2mMfHizCv6hxQ=; b=rc2YJZNuoccVNLEnpI6XbStDweoCv444QbZ3uktz9yTo5A0W+8OJZnLQClnlWiuDYT3hbf Q3P7BT/wgIZjvjuRbiVRRRvDBrzFf+My7957FNBq7FAj3ZJJIAyrsUiJ3yIjKiTpPCCyYK /B1LIL4VQcCog7e6ALj9XhcZa2vdIkM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715862575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Wsrn1Mz28skBQ9t974KocbnFS1Gshe2mMfHizCv6hxQ=; b=ntPe/YpXyPycMKNSQVURDYR1KVcQfgwA5h8rk+ByFzlTq1O4HmlO4kYFQI9ACHgCnptgl9 RYiTWCI6j+UgPIDg== 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 BF473137C3 for ; Thu, 16 May 2024 12:29:35 +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 CE1VLS/8RWbOfwAAD6G6ig (envelope-from ) for ; Thu, 16 May 2024 12:29:35 +0000 From: Andrea Cervesato Date: Thu, 16 May 2024 14:29:19 +0200 MIME-Version: 1.0 Message-Id: <20240516-listmount_statmount-v3-11-2ff4ba29bba7@suse.com> References: <20240516-listmount_statmount-v3-0-2ff4ba29bba7@suse.com> In-Reply-To: <20240516-listmount_statmount-v3-0-2ff4ba29bba7@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2925; i=andrea.cervesato@suse.com; h=from:subject:message-id; bh=YYtTebon1mlmlY/LLpvgcGSp2zVrLWw6tTxaB5ISSWA=; b=owEB7QES/pANAwAIAcvMGrIgs+ZGAcsmYgBmRfwuvBWgITfUgcq7RTe1lAJ1IkKw9HqcRjfym 1Fswz3+6ZiJAbMEAAEIAB0WIQT1ysFzUKRW0sIb39jLzBqyILPmRgUCZkX8LgAKCRDLzBqyILPm Rv3nC/9ekj0oFRl6/C2oifeUtKETGEhH3+1R3dYVKQQ1J3RyfLOor16jo6RzTheJIbg1vZjXtG7 /TGfm60Pg/UYX3G8nvf8+fp4rQ3aAA/3NKAA7X+lfco6gdfSa3Jn0+eD87BDMNwkuykZEWb0lVo K7XnDO114gpziBt/32l6JeMAZHMNYH4c/nEGk0hDW5b7EhslMfXMcqM1zz7ee5OhpBi1TvPacW8 LZDuC7Ecbs+DJXyfIbUIpgvRdDpQplBGg4+1H9H2dMnrPay5lvXvjf7LicYONKB97OOFi0aRwpM LlzUfGj75KOsV5dfjZUGD/osNi2eQ7OIgCY1NKGR813PnnnaJDTfuQwgy5nNn96GIXbDUWAXDko BCAqA2s4hOVmYdUrgIyoVS/hYmRdB2zQZo9R89A1/bkBQyWxU2pN9xchom5LJCDLVwvRLASudqS AvKBZegCaCZf8gr40BRQN2syd6/9NTQiZkYak3mR5ZsDNmAWTnKn7sgqTLYh6dh+sN4MI= X-Developer-Key: i=andrea.cervesato@suse.com; a=openpgp; fpr=F5CAC17350A456D2C21BDFD8CBCC1AB220B3E646 X-Spam-Score: -4.51 X-Rspamd-Action: no action X-Rspamd-Queue-Id: CF28834927 X-Spam-Level: X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; 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)[]; ARC_NA(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; DWL_DNSWL_BLOCKED(0.00)[suse.de:dkim]; RCPT_COUNT_ONE(0.00)[1]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-4.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-4.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v3 11/11] 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. --- runtest/syscalls | 1 + testcases/kernel/syscalls/statmount/.gitignore | 1 + testcases/kernel/syscalls/statmount/statmount06.c | 72 +++++++++++++++++++++++ 3 files changed, 74 insertions(+) diff --git a/runtest/syscalls b/runtest/syscalls index b04aabc6f..a3546b155 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -1543,6 +1543,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..2f5fc870f --- /dev/null +++ b/testcases/kernel/syscalls/statmount/statmount06.c @@ -0,0 +1,72 @@ +// 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", + .mount_device = 1, + .mntpoint = MNTPOINT, + .all_filesystems = 1, + .skip_filesystems = (const char *const []) { + "fuse", + NULL + }, + .bufs = (struct tst_buffers []) { + {&st_mount, .size = SM_SIZE}, + {} + } +};