From patchwork Thu Nov 30 09:37:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 1870009 X-Patchwork-Delegate: petr.vorel@gmail.com 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.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=oiYB930J; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=DIHL6SdU; 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 4SgrhW3l8tz1ySd for ; Thu, 30 Nov 2023 20:37:47 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 3FC6D3CD759 for ; Thu, 30 Nov 2023 10:37:45 +0100 (CET) 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 (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id B25D03CD5A6 for ; Thu, 30 Nov 2023 10:37:13 +0100 (CET) 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-3.smtp.seeweb.it (Postfix) with ESMTPS id C12181A027B7 for ; Thu, 30 Nov 2023 10:37:12 +0100 (CET) Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [10.150.64.98]) (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 CFAF521AB5; Thu, 30 Nov 2023 09:37:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1701337031; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v2YYp8qHsFTO33Hh/wm4VIZV5A+16yX+DzxLsqCg6t4=; b=oiYB930JbFMoL5FVzDjqAm7Kw6WMpMr06lWv8qj3stNNS/y13kt368DCpmkFTJi4K3fI9w mkz24UeMcg5uiB6YhpQjaslw+jIF67v7vawl/FuuJIocsnx8hDzIK0hFWqHdFPVXDoQhWf bREqdipDA49UXqFvI47+8ZQmbyGuEAc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1701337031; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v2YYp8qHsFTO33Hh/wm4VIZV5A+16yX+DzxLsqCg6t4=; b=DIHL6SdUH91zgZX1lads1tTrPGtk/BaQmFSdEeqzv2Bp3JNsnCSfsaBOX0tmVZDQQUTthZ yyFH/WbHFjd5qYBA== Received: from imap2.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 imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id BED3413B3E; Thu, 30 Nov 2023 09:37:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id O+mRLsdXaGVVKAAAn2gu4w (envelope-from ); Thu, 30 Nov 2023 09:37:11 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 49A2AA07E5; Thu, 30 Nov 2023 10:37:11 +0100 (CET) From: Jan Kara To: ltp@lists.linux.it Date: Thu, 30 Nov 2023 10:37:04 +0100 Message-Id: <20231130093711.20171-1-jack@suse.cz> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231130093533.10036-1-jack@suse.cz> References: <20231130093533.10036-1-jack@suse.cz> MIME-Version: 1.0 Authentication-Results: smtp-out1.suse.de; none X-Spam-Score: 3.90 X-Spamd-Result: default: False [3.90 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; TO_DN_SOME(0.00)[]; NEURAL_SPAM_SHORT(3.00)[1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_CC(0.00)[gmail.com,suse.cz]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] X-Virus-Scanned: clamav-milter 1.0.1 at in-3.smtp.seeweb.it X-Virus-Status: Clean 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, T_SCC_BODY_TEXT_LINE 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 Subject: [LTP] [PATCH v2 1/7] fanotify: Generalize helper fanotify_flags_supported_on_fs() 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: , Cc: Jan Kara Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Amir Goldstein The helper fanotify_init_flags_supported_on_fs() is used to check if fanotify init flags (usually FAN_REPORT_FID) are supported by kernel and on a specific filesystem. The helper fanotify_mark_supported_by_kernel() does not check for support on a specific filesystem. There are now specific filesystems (e.g. overlayfs, fuse) that do not support FAN_REPORT_FID, but not with filesystem and mount mark types. Generelize the helper fanotify_init_flags_supported_on_fs() to be used to check also support for mark flags and event flags on a specific filesystem. The helper fanotify_init_flags_err_msg() was also renamed to reflect the fact that it is already used to report an error message for mark flags and handle flags, not only init flags. Signed-off-by: Amir Goldstein Signed-off-by: Jan Kara --- testcases/kernel/syscalls/fanotify/fanotify.h | 55 +++++++++++-------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h index 32b510cdc178..f34440e0bd41 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify.h +++ b/testcases/kernel/syscalls/fanotify/fanotify.h @@ -176,35 +176,38 @@ static inline int fanotify_events_supported_by_kernel(uint64_t mask, } /* - * @return 0: fanotify supported both in kernel and on tested filesystem - * @return -1: @flags not supported in kernel - * @return -2: @flags not supported on tested filesystem (tested if @fname is not NULL) - * @return -3: @flags not supported on overlayfs (tested if @fname == OVL_MNT) + * @return 0: fanotify flags supported both in kernel and on tested filesystem + * @return -1: @init_flags not supported in kernel + * @return -2: @mark_flags not supported on tested filesystem (tested if @fname is not NULL) + * @return -3: @mark_flags not supported on overlayfs (tested if @fname == OVL_MNT) */ -static inline int fanotify_init_flags_supported_on_fs(unsigned int flags, const char *fname) +static inline int fanotify_flags_supported_on_fs(unsigned int init_flags, + unsigned int mark_flags, + uint64_t event_flags, + const char *fname) { int fd; int rval = 0; - fd = fanotify_init(flags, O_RDONLY); + fd = fanotify_init(init_flags, O_RDONLY); if (fd < 0) { if (errno == ENOSYS) tst_brk(TCONF, "fanotify not configured in kernel"); - - if (errno == EINVAL) - return -1; - - tst_brk(TBROK | TERRNO, "fanotify_init() failed"); + if (errno != EINVAL) + tst_brk(TBROK | TERRNO, "fanotify_init() failed"); + return -1; } - if (fname && fanotify_mark(fd, FAN_MARK_ADD, FAN_ACCESS, AT_FDCWD, fname) < 0) { + if (fname && fanotify_mark(fd, FAN_MARK_ADD | mark_flags, event_flags, AT_FDCWD, fname) < 0) { if (errno == ENODEV || errno == EOPNOTSUPP || errno == EXDEV) { rval = strcmp(fname, OVL_MNT) ? -2 : -3; - } else { + } else if (errno != EINVAL) { tst_brk(TBROK | TERRNO, "fanotify_mark (%d, FAN_MARK_ADD, ..., AT_FDCWD, %s) failed", fd, fname); + } else { + rval = -1; } } @@ -213,6 +216,11 @@ static inline int fanotify_init_flags_supported_on_fs(unsigned int flags, const return rval; } +static inline int fanotify_init_flags_supported_on_fs(unsigned int flags, const char *fname) +{ + return fanotify_flags_supported_on_fs(flags, FAN_MARK_INODE, FAN_ACCESS, fname); +} + static inline int fanotify_init_flags_supported_by_kernel(unsigned int flags) { return fanotify_init_flags_supported_on_fs(flags, NULL); @@ -264,7 +272,7 @@ static inline unsigned int fanotify_get_supported_init_flags(unsigned int flags, typedef void (*tst_res_func_t)(const char *file, const int lineno, int ttype, const char *fmt, ...); -static inline void fanotify_init_flags_err_msg(const char *flags_str, +static inline void fanotify_flags_err_msg(const char *flags_str, const char *file, const int lineno, tst_res_func_t res_func, int fail) { if (fail == -1) @@ -278,14 +286,17 @@ static inline void fanotify_init_flags_err_msg(const char *flags_str, } #define FANOTIFY_INIT_FLAGS_ERR_MSG(flags, fail) \ - fanotify_init_flags_err_msg(#flags, __FILE__, __LINE__, tst_res_, (fail)) + fanotify_flags_err_msg(#flags, __FILE__, __LINE__, tst_res_, (fail)) + +#define FANOTIFY_MARK_FLAGS_ERR_MSG(mark, fail) \ + fanotify_flags_err_msg((mark)->name, __FILE__, __LINE__, tst_res_, (fail)) #define REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_ON_FS(flags, fname) \ - fanotify_init_flags_err_msg(#flags, __FILE__, __LINE__, tst_brk_, \ + fanotify_flags_err_msg(#flags, __FILE__, __LINE__, tst_brk_, \ fanotify_init_flags_supported_on_fs(flags, fname)) #define REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_BY_KERNEL(flags) \ - fanotify_init_flags_err_msg(#flags, __FILE__, __LINE__, tst_brk_, \ + fanotify_flags_err_msg(#flags, __FILE__, __LINE__, tst_brk_, \ fanotify_init_flags_supported_by_kernel(flags)) static inline int fanotify_mark_supported_by_kernel(uint64_t flag) @@ -323,19 +334,19 @@ static inline int fanotify_handle_supported_by_kernel(int flag) } #define REQUIRE_MARK_TYPE_SUPPORTED_BY_KERNEL(mark_type) \ - fanotify_init_flags_err_msg(#mark_type, __FILE__, __LINE__, tst_brk_, \ - fanotify_mark_supported_by_kernel(mark_type)) + fanotify_flags_err_msg(#mark_type, __FILE__, __LINE__, tst_brk_, \ + fanotify_mark_supported_by_kernel(mark_type)) #define REQUIRE_HANDLE_TYPE_SUPPORTED_BY_KERNEL(handle_type) \ - fanotify_init_flags_err_msg(#handle_type, __FILE__, __LINE__, tst_brk_, \ - fanotify_handle_supported_by_kernel(handle_type)) + fanotify_flags_err_msg(#handle_type, __FILE__, __LINE__, tst_brk_, \ + fanotify_handle_supported_by_kernel(handle_type)) #define REQUIRE_FANOTIFY_EVENTS_SUPPORTED_ON_FS(init_flags, mark_type, mask, fname) do { \ if (mark_type) \ REQUIRE_MARK_TYPE_SUPPORTED_BY_KERNEL(mark_type); \ if (init_flags) \ REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_ON_FS(init_flags, fname); \ - fanotify_init_flags_err_msg(#mask, __FILE__, __LINE__, tst_brk_, \ + fanotify_flags_err_msg(#mask, __FILE__, __LINE__, tst_brk_, \ fanotify_events_supported_by_kernel(mask, init_flags, mark_type)); \ } while (0) From patchwork Thu Nov 30 09:37:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 1870006 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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 4Sgrgy0BKVz1ySd for ; Thu, 30 Nov 2023 20:37:18 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id E1F0C3CD73E for ; Thu, 30 Nov 2023 10:37:14 +0100 (CET) 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 (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 4B8F03C8960 for ; Thu, 30 Nov 2023 10:37:13 +0100 (CET) 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 C4C96207CD4 for ; Thu, 30 Nov 2023 10:37:12 +0100 (CET) Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (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 D94471FCDC; Thu, 30 Nov 2023 09:37:11 +0000 (UTC) Received: from imap2.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 imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id C41A113B4A; Thu, 30 Nov 2023 09:37:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id FxemL8dXaGVYKAAAn2gu4w (envelope-from ); Thu, 30 Nov 2023 09:37:11 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 50F33A07E6; Thu, 30 Nov 2023 10:37:11 +0100 (CET) From: Jan Kara To: ltp@lists.linux.it Date: Thu, 30 Nov 2023 10:37:05 +0100 Message-Id: <20231130093711.20171-2-jack@suse.cz> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231130093533.10036-1-jack@suse.cz> References: <20231130093533.10036-1-jack@suse.cz> MIME-Version: 1.0 X-Spam-Level: Authentication-Results: smtp-out2.suse.de; none X-Rspamd-Server: rspamd2 X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Spam-Score: -4.00 X-Rspamd-Queue-Id: D94471FCDC X-Virus-Scanned: clamav-milter 1.0.1 at in-7.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Subject: [LTP] [PATCH v2 2/7] fanotify: Print more details on error from fanotify_flags_supported_on_fs() 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: , Cc: Jan Kara Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Print more details about failing calls from fanotify_flags_supported_on_fs(). Signed-off-by: Jan Kara Reviewed-by: Amir Goldstein --- testcases/kernel/syscalls/fanotify/fanotify.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h index f34440e0bd41..3b8838e8dd68 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify.h +++ b/testcases/kernel/syscalls/fanotify/fanotify.h @@ -195,7 +195,9 @@ static inline int fanotify_flags_supported_on_fs(unsigned int init_flags, if (errno == ENOSYS) tst_brk(TCONF, "fanotify not configured in kernel"); if (errno != EINVAL) - tst_brk(TBROK | TERRNO, "fanotify_init() failed"); + tst_brk(TBROK | TERRNO, + "fanotify_init(%x, O_RDONLY) failed", + init_flags); return -1; } @@ -204,8 +206,9 @@ static inline int fanotify_flags_supported_on_fs(unsigned int init_flags, rval = strcmp(fname, OVL_MNT) ? -2 : -3; } else if (errno != EINVAL) { tst_brk(TBROK | TERRNO, - "fanotify_mark (%d, FAN_MARK_ADD, ..., AT_FDCWD, %s) failed", - fd, fname); + "fanotify_mark (%d, FAN_MARK_ADD | %x, %llx, AT_FDCWD, %s) failed", + fd, mark_flags, (unsigned long long)event_flags, + fname); } else { rval = -1; } From patchwork Thu Nov 30 09:37:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 1870013 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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 4SgrjM5Rj2z1ySd for ; Thu, 30 Nov 2023 20:38:31 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 43FE53CF633 for ; Thu, 30 Nov 2023 10:38:29 +0100 (CET) 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 [IPv6:2001:4b78:1:20::5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 252763CD5EF for ; Thu, 30 Nov 2023 10:37:13 +0100 (CET) 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-5.smtp.seeweb.it (Postfix) with ESMTPS id B4ED4603445 for ; Thu, 30 Nov 2023 10:37:12 +0100 (CET) Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (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 D290F1FCDA; Thu, 30 Nov 2023 09:37:11 +0000 (UTC) Received: from imap2.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 imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id C338613B49; Thu, 30 Nov 2023 09:37:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id NxdXL8dXaGVXKAAAn2gu4w (envelope-from ); Thu, 30 Nov 2023 09:37:11 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 57D91A07EA; Thu, 30 Nov 2023 10:37:11 +0100 (CET) From: Jan Kara To: ltp@lists.linux.it Date: Thu, 30 Nov 2023 10:37:06 +0100 Message-Id: <20231130093711.20171-3-jack@suse.cz> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231130093533.10036-1-jack@suse.cz> References: <20231130093533.10036-1-jack@suse.cz> MIME-Version: 1.0 X-Spam-Level: Authentication-Results: smtp-out2.suse.de; none X-Rspamd-Server: rspamd2 X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Spam-Score: -4.00 X-Rspamd-Queue-Id: D290F1FCDA X-Virus-Scanned: clamav-milter 1.0.1 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Subject: [LTP] [PATCH v2 3/7] fanotify: Provide fanotify_mark_supported_on_fs() 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: , Cc: Jan Kara Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Provide helper checking whether a mark is supported on a filesystem since some marks need not be available on all filesystems (e.g. btrfs subvolumes). Also convert REQUIRE_MARK_TYPE_SUPPORTED_BY_KERNEL() and its only user to use this new function. Signed-off-by: Jan Kara Reviewed-by: Amir Goldstein --- testcases/kernel/syscalls/fanotify/fanotify.h | 11 ++++++++--- testcases/kernel/syscalls/fanotify/fanotify23.c | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h index 3b8838e8dd68..597ed96e0313 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify.h +++ b/testcases/kernel/syscalls/fanotify/fanotify.h @@ -229,6 +229,11 @@ static inline int fanotify_init_flags_supported_by_kernel(unsigned int flags) return fanotify_init_flags_supported_on_fs(flags, NULL); } +static inline int fanotify_mark_supported_on_fs(uint64_t flag, const char *fname) +{ + return fanotify_flags_supported_on_fs(FAN_CLASS_NOTIF, flag, FAN_ACCESS, fname); +} + #define TST_FANOTIFY_INIT_KNOWN_FLAGS \ (FAN_REPORT_DFID_NAME_TARGET | FAN_REPORT_TID | FAN_REPORT_PIDFD | \ FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | FAN_CLASS_PRE_CONTENT) @@ -336,9 +341,9 @@ static inline int fanotify_handle_supported_by_kernel(int flag) return 0; } -#define REQUIRE_MARK_TYPE_SUPPORTED_BY_KERNEL(mark_type) \ +#define REQUIRE_MARK_TYPE_SUPPORTED_ON_FS(mark_type, fname) \ fanotify_flags_err_msg(#mark_type, __FILE__, __LINE__, tst_brk_, \ - fanotify_mark_supported_by_kernel(mark_type)) + fanotify_mark_supported_on_fs(mark_type, fname)) #define REQUIRE_HANDLE_TYPE_SUPPORTED_BY_KERNEL(handle_type) \ fanotify_flags_err_msg(#handle_type, __FILE__, __LINE__, tst_brk_, \ @@ -346,7 +351,7 @@ static inline int fanotify_handle_supported_by_kernel(int flag) #define REQUIRE_FANOTIFY_EVENTS_SUPPORTED_ON_FS(init_flags, mark_type, mask, fname) do { \ if (mark_type) \ - REQUIRE_MARK_TYPE_SUPPORTED_BY_KERNEL(mark_type); \ + REQUIRE_MARK_TYPE_SUPPORTED_ON_FS(mark_type, fname); \ if (init_flags) \ REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_ON_FS(init_flags, fname); \ fanotify_flags_err_msg(#mask, __FILE__, __LINE__, tst_brk_, \ diff --git a/testcases/kernel/syscalls/fanotify/fanotify23.c b/testcases/kernel/syscalls/fanotify/fanotify23.c index fb812c51e34e..5a03503e952a 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify23.c +++ b/testcases/kernel/syscalls/fanotify/fanotify23.c @@ -230,7 +230,7 @@ static void setup(void) { SAFE_TOUCH(TEST_FILE, 0666, NULL); - REQUIRE_MARK_TYPE_SUPPORTED_BY_KERNEL(FAN_MARK_EVICTABLE); + REQUIRE_MARK_TYPE_SUPPORTED_ON_FS(FAN_MARK_EVICTABLE, "."); REQUIRE_FANOTIFY_EVENTS_SUPPORTED_ON_FS(FAN_CLASS_NOTIF|FAN_REPORT_FID, FAN_MARK_FILESYSTEM, FAN_ATTRIB, "."); From patchwork Thu Nov 30 09:37:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 1870011 X-Patchwork-Delegate: petr.vorel@gmail.com 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.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=zi/DpdrK; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=pthU+Qh5; 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 4Sgrhw1vqDz1ySd for ; Thu, 30 Nov 2023 20:38:08 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 08AE53CF62E for ; Thu, 30 Nov 2023 10:38:06 +0100 (CET) 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 (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id ED39F3CD5A6 for ; Thu, 30 Nov 2023 10:37:13 +0100 (CET) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id C21571002036 for ; Thu, 30 Nov 2023 10:37:12 +0100 (CET) Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [10.150.64.98]) (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 CBDCA1FC83; Thu, 30 Nov 2023 09:37:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1701337031; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QW/0asDtyyUGCyXSjPDL14AFKR5FMaqtCrxrlS3v8cI=; b=zi/DpdrK2fnDD4BPWtm2bO+BcIlSnRRLslgUwMfJSKL4sjbbWfzqWj0zTwX0Kb+1WS6IGb 5Vd1bv4hs9ysIdK+ry+sAxr7mc6l6FLCEtpn8be30DMJRM7ygKehmG/XhPsqMnB4iymRdG W9M4e2H3O4QTxVEDkUXrZgYD8KqN9pc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1701337031; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QW/0asDtyyUGCyXSjPDL14AFKR5FMaqtCrxrlS3v8cI=; b=pthU+Qh51bvcMZm97sWwp47a1f7mp6X7/nqjvErKi5CxEXiPfxDhFfcsbFxMuMOwDD+fcz Rm7YhWH4I2Cde/Dw== Received: from imap2.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 imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id BBC5113AE2; Thu, 30 Nov 2023 09:37:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id R8CKLcdXaGVTKAAAn2gu4w (envelope-from ); Thu, 30 Nov 2023 09:37:11 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 5F0A0A07EB; Thu, 30 Nov 2023 10:37:11 +0100 (CET) From: Jan Kara To: ltp@lists.linux.it Date: Thu, 30 Nov 2023 10:37:07 +0100 Message-Id: <20231130093711.20171-4-jack@suse.cz> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231130093533.10036-1-jack@suse.cz> References: <20231130093533.10036-1-jack@suse.cz> MIME-Version: 1.0 Authentication-Results: smtp-out2.suse.de; none X-Spam-Level: X-Spam-Score: 0.90 X-Spamd-Result: default: False [0.90 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_MISSING_CHARSET(2.50)[]; BROKEN_CONTENT_TYPE(1.50)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_CC(0.00)[gmail.com,suse.cz]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] X-Virus-Scanned: clamav-milter 1.0.1 at in-4.smtp.seeweb.it X-Virus-Status: Clean 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, T_SCC_BODY_TEXT_LINE 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 Subject: [LTP] [PATCH v2 4/7] fanotify: Switch event and mark tests to *_on_fs() variant 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: , Cc: Jan Kara Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Switch event availability and mark type availability tests to be performed on the filesystem actually used for testing instead of on the current directory. This is more reliable as not all filesystems support the same set of features. Reviewed-by: Amir Goldstein Signed-off-by: Jan Kara --- testcases/kernel/syscalls/fanotify/fanotify.h | 2 +- testcases/kernel/syscalls/fanotify/fanotify01.c | 2 +- testcases/kernel/syscalls/fanotify/fanotify03.c | 7 ++++--- testcases/kernel/syscalls/fanotify/fanotify09.c | 3 ++- testcases/kernel/syscalls/fanotify/fanotify10.c | 13 ++++++++----- testcases/kernel/syscalls/fanotify/fanotify11.c | 2 +- testcases/kernel/syscalls/fanotify/fanotify12.c | 5 ++--- testcases/kernel/syscalls/fanotify/fanotify13.c | 3 ++- testcases/kernel/syscalls/fanotify/fanotify14.c | 3 ++- testcases/kernel/syscalls/fanotify/fanotify16.c | 3 ++- 10 files changed, 25 insertions(+), 18 deletions(-) diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h index 597ed96e0313..1c30a0bcab2a 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify.h +++ b/testcases/kernel/syscalls/fanotify/fanotify.h @@ -355,7 +355,7 @@ static inline int fanotify_handle_supported_by_kernel(int flag) if (init_flags) \ REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_ON_FS(init_flags, fname); \ fanotify_flags_err_msg(#mask, __FILE__, __LINE__, tst_brk_, \ - fanotify_events_supported_by_kernel(mask, init_flags, mark_type)); \ + fanotify_flags_supported_on_fs(init_flags, mark_type, mask, fname)); \ } while (0) static inline struct fanotify_event_info_header *get_event_info( diff --git a/testcases/kernel/syscalls/fanotify/fanotify01.c b/testcases/kernel/syscalls/fanotify/fanotify01.c index 3538335c9ab0..5ce1dc76ac8c 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify01.c +++ b/testcases/kernel/syscalls/fanotify/fanotify01.c @@ -341,7 +341,7 @@ static void setup(void) SAFE_FILE_PRINTF(fname, "1"); fan_report_fid_unsupported = fanotify_init_flags_supported_on_fs(FAN_REPORT_FID, fname); - filesystem_mark_unsupported = fanotify_mark_supported_by_kernel(FAN_MARK_FILESYSTEM); + filesystem_mark_unsupported = fanotify_mark_supported_on_fs(FAN_MARK_FILESYSTEM, fname); } static void cleanup(void) diff --git a/testcases/kernel/syscalls/fanotify/fanotify03.c b/testcases/kernel/syscalls/fanotify/fanotify03.c index 0bd61587a9eb..343ba857e1ae 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify03.c +++ b/testcases/kernel/syscalls/fanotify/fanotify03.c @@ -322,12 +322,13 @@ static void setup(void) { require_fanotify_access_permissions_supported_by_kernel(); - filesystem_mark_unsupported = fanotify_mark_supported_by_kernel(FAN_MARK_FILESYSTEM); - exec_events_unsupported = fanotify_events_supported_by_kernel(FAN_OPEN_EXEC_PERM, - FAN_CLASS_CONTENT, 0); sprintf(fname, MOUNT_PATH"/fname_%d", getpid()); SAFE_FILE_PRINTF(fname, "1"); + filesystem_mark_unsupported = fanotify_mark_supported_on_fs(FAN_MARK_FILESYSTEM, fname); + exec_events_unsupported = fanotify_flags_supported_on_fs(FAN_CLASS_CONTENT, + 0, FAN_OPEN_EXEC_PERM, fname); + SAFE_CP(TEST_APP, FILE_EXEC_PATH); } diff --git a/testcases/kernel/syscalls/fanotify/fanotify09.c b/testcases/kernel/syscalls/fanotify/fanotify09.c index 3f2db47093c8..6bb1b9e7036f 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify09.c +++ b/testcases/kernel/syscalls/fanotify/fanotify09.c @@ -482,7 +482,8 @@ static void setup(void) { fan_report_dfid_unsupported = fanotify_init_flags_supported_on_fs(FAN_REPORT_DFID_NAME, MOUNT_PATH); - ignore_mark_unsupported = fanotify_mark_supported_by_kernel(FAN_MARK_IGNORE_SURV); + ignore_mark_unsupported = fanotify_mark_supported_on_fs(FAN_MARK_IGNORE_SURV, + MOUNT_PATH); SAFE_MKDIR(MOUNT_NAME, 0755); SAFE_MOUNT(MOUNT_PATH, MOUNT_NAME, "none", MS_BIND, NULL); diff --git a/testcases/kernel/syscalls/fanotify/fanotify10.c b/testcases/kernel/syscalls/fanotify/fanotify10.c index d0e9194e7a58..f30eba9ecbfb 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify10.c +++ b/testcases/kernel/syscalls/fanotify/fanotify10.c @@ -874,11 +874,14 @@ static void setup(void) { int i; - exec_events_unsupported = fanotify_events_supported_by_kernel(FAN_OPEN_EXEC, - FAN_CLASS_CONTENT, 0); - filesystem_mark_unsupported = fanotify_mark_supported_by_kernel(FAN_MARK_FILESYSTEM); - evictable_mark_unsupported = fanotify_mark_supported_by_kernel(FAN_MARK_EVICTABLE); - ignore_mark_unsupported = fanotify_mark_supported_by_kernel(FAN_MARK_IGNORE_SURV); + exec_events_unsupported = fanotify_flags_supported_on_fs(FAN_CLASS_CONTENT, + 0, FAN_OPEN_EXEC, MOUNT_PATH); + filesystem_mark_unsupported = fanotify_mark_supported_on_fs(FAN_MARK_FILESYSTEM, + MOUNT_PATH); + evictable_mark_unsupported = fanotify_mark_supported_on_fs(FAN_MARK_EVICTABLE, + MOUNT_PATH); + ignore_mark_unsupported = fanotify_mark_supported_on_fs(FAN_MARK_IGNORE_SURV, + MOUNT_PATH); fan_report_dfid_unsupported = fanotify_init_flags_supported_on_fs(FAN_REPORT_DFID_NAME, MOUNT_PATH); if (fan_report_dfid_unsupported) { diff --git a/testcases/kernel/syscalls/fanotify/fanotify11.c b/testcases/kernel/syscalls/fanotify/fanotify11.c index 03583d84be9b..ce46913b179e 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify11.c +++ b/testcases/kernel/syscalls/fanotify/fanotify11.c @@ -94,7 +94,7 @@ static void test01(unsigned int i) static void setup(void) { - fan_report_tid_unsupported = fanotify_init_flags_supported_by_kernel(FAN_REPORT_TID); + fan_report_tid_unsupported = fanotify_init_flags_supported_on_fs(FAN_REPORT_TID, "."); } static struct tst_test test = { diff --git a/testcases/kernel/syscalls/fanotify/fanotify12.c b/testcases/kernel/syscalls/fanotify/fanotify12.c index 7f8e97b178bc..42ba08800ccf 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify12.c +++ b/testcases/kernel/syscalls/fanotify/fanotify12.c @@ -222,11 +222,10 @@ cleanup: static void do_setup(void) { - exec_events_unsupported = fanotify_events_supported_by_kernel(FAN_OPEN_EXEC, - FAN_CLASS_NOTIF, 0); - sprintf(fname, "fname_%d", getpid()); SAFE_FILE_PRINTF(fname, "1"); + exec_events_unsupported = fanotify_flags_supported_on_fs(FAN_CLASS_NOTIF, + 0, FAN_OPEN_EXEC, fname); } static void do_cleanup(void) diff --git a/testcases/kernel/syscalls/fanotify/fanotify13.c b/testcases/kernel/syscalls/fanotify/fanotify13.c index 421a3636f834..fdde3b10d1dd 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify13.c +++ b/testcases/kernel/syscalls/fanotify/fanotify13.c @@ -325,7 +325,8 @@ static void do_setup(void) SAFE_MOUNT(mnt, MOUNT_PATH, "none", MS_BIND, NULL); bind_mounted = 1; - filesystem_mark_unsupported = fanotify_mark_supported_by_kernel(FAN_MARK_FILESYSTEM); + filesystem_mark_unsupported = fanotify_mark_supported_on_fs(FAN_MARK_FILESYSTEM, + MOUNT_PATH); nofid_fd = SAFE_FANOTIFY_INIT(FAN_CLASS_NOTIF, O_RDONLY); diff --git a/testcases/kernel/syscalls/fanotify/fanotify14.c b/testcases/kernel/syscalls/fanotify/fanotify14.c index 0bb78918824b..0e24e0335ae3 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify14.c +++ b/testcases/kernel/syscalls/fanotify/fanotify14.c @@ -325,7 +325,8 @@ static void do_setup(void) supported_init_flags = fanotify_get_supported_init_flags(all_init_flags, MNTPOINT); - ignore_mark_unsupported = fanotify_mark_supported_by_kernel(FAN_MARK_IGNORE_SURV); + ignore_mark_unsupported = fanotify_mark_supported_on_fs(FAN_MARK_IGNORE_SURV, + MNTPOINT); /* Create temporary test file to place marks on */ SAFE_FILE_PRINTF(FILE1, "0"); diff --git a/testcases/kernel/syscalls/fanotify/fanotify16.c b/testcases/kernel/syscalls/fanotify/fanotify16.c index d45270a9a06e..dfa4edf0319e 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify16.c +++ b/testcases/kernel/syscalls/fanotify/fanotify16.c @@ -766,7 +766,8 @@ static void setup(void) fan_report_target_fid_unsupported = fanotify_init_flags_supported_on_fs(FAN_REPORT_DFID_NAME_TARGET, MOUNT_PATH); rename_events_unsupported = - fanotify_events_supported_by_kernel(FAN_RENAME, FAN_REPORT_DFID_NAME, 0); + fanotify_flags_supported_on_fs(FAN_REPORT_DFID_NAME, 0, + FAN_RENAME, MOUNT_PATH); SAFE_MKDIR(TEMP_DIR, 0755); sprintf(dname1, "%s/%s", MOUNT_PATH, DIR_NAME1); From patchwork Thu Nov 30 09:37:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 1870007 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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 4Sgrh76YXDz1ySd for ; Thu, 30 Nov 2023 20:37:27 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 7CD863CD93C for ; Thu, 30 Nov 2023 10:37:25 +0100 (CET) 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 (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 680D43CD5A6 for ; Thu, 30 Nov 2023 10:37:13 +0100 (CET) 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 BC13E603449 for ; Thu, 30 Nov 2023 10:37:12 +0100 (CET) Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (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 26C1A1FCDE; Thu, 30 Nov 2023 09:37:12 +0000 (UTC) Received: from imap2.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 imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 1ACB013A5C; Thu, 30 Nov 2023 09:37:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id DkGJBshXaGVlKAAAn2gu4w (envelope-from ); Thu, 30 Nov 2023 09:37:12 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 66CD1A07EF; Thu, 30 Nov 2023 10:37:11 +0100 (CET) From: Jan Kara To: ltp@lists.linux.it Date: Thu, 30 Nov 2023 10:37:08 +0100 Message-Id: <20231130093711.20171-5-jack@suse.cz> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231130093533.10036-1-jack@suse.cz> References: <20231130093533.10036-1-jack@suse.cz> MIME-Version: 1.0 X-Spam-Level: Authentication-Results: smtp-out2.suse.de; none X-Rspamd-Server: rspamd2 X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Spam-Score: -4.00 X-Rspamd-Queue-Id: 26C1A1FCDE X-Virus-Scanned: clamav-milter 1.0.1 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Subject: [LTP] [PATCH v2 5/7] fanotify: Drop unused feature test macros 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: , Cc: Jan Kara Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Drop now unused feature test macros fanotify_events_supported_by_kernel() and fanotify_mark_supported_by_kernel(). Reviewed-by: Amir Goldstein Signed-off-by: Jan Kara --- testcases/kernel/syscalls/fanotify/fanotify.h | 44 ------------------- 1 file changed, 44 deletions(-) diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h index 1c30a0bcab2a..d49966810381 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify.h +++ b/testcases/kernel/syscalls/fanotify/fanotify.h @@ -152,29 +152,6 @@ static inline void require_fanotify_access_permissions_supported_by_kernel(void) SAFE_CLOSE(fd); } -static inline int fanotify_events_supported_by_kernel(uint64_t mask, - unsigned int init_flags, - unsigned int mark_flags) -{ - int fd; - int rval = 0; - - fd = SAFE_FANOTIFY_INIT(init_flags, O_RDONLY); - - if (fanotify_mark(fd, FAN_MARK_ADD | mark_flags, mask, AT_FDCWD, ".") < 0) { - if (errno == EINVAL) { - rval = -1; - } else { - tst_brk(TBROK | TERRNO, - "fanotify_mark (%d, FAN_MARK_ADD, ..., AT_FDCWD, \".\") failed", fd); - } - } - - SAFE_CLOSE(fd); - - return rval; -} - /* * @return 0: fanotify flags supported both in kernel and on tested filesystem * @return -1: @init_flags not supported in kernel @@ -307,27 +284,6 @@ static inline void fanotify_flags_err_msg(const char *flags_str, fanotify_flags_err_msg(#flags, __FILE__, __LINE__, tst_brk_, \ fanotify_init_flags_supported_by_kernel(flags)) -static inline int fanotify_mark_supported_by_kernel(uint64_t flag) -{ - int fd; - int rval = 0; - - fd = SAFE_FANOTIFY_INIT(FAN_CLASS_CONTENT, O_RDONLY); - - if (fanotify_mark(fd, FAN_MARK_ADD | flag, FAN_ACCESS, AT_FDCWD, ".") < 0) { - if (errno == EINVAL) { - rval = -1; - } else { - tst_brk(TBROK | TERRNO, - "fanotify_mark (%d, FAN_MARK_ADD, ..., FAN_ACCESS, AT_FDCWD, \".\") failed", fd); - } - } - - SAFE_CLOSE(fd); - - return rval; -} - static inline int fanotify_handle_supported_by_kernel(int flag) { /* From patchwork Thu Nov 30 09:37:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 1870012 X-Patchwork-Delegate: petr.vorel@gmail.com 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.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=JJAOOxnB; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Zyb4nmZa; 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 4Sgrj96XCzz1ySd for ; Thu, 30 Nov 2023 20:38:21 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id C046E3CF62B for ; Thu, 30 Nov 2023 10:38:19 +0100 (CET) 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 [IPv6:2001:4b78:1:20::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 0A0C73C8960 for ; Thu, 30 Nov 2023 10:37:13 +0100 (CET) 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-2.smtp.seeweb.it (Postfix) with ESMTPS id 1EDAB60135E for ; Thu, 30 Nov 2023 10:37:13 +0100 (CET) Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [10.150.64.98]) (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 27C2E21A9A; Thu, 30 Nov 2023 09:37:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1701337032; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fPpZqdy8WmkwRUH7L2mYE9vU9NZ9C+P0M1NFAywlK8g=; b=JJAOOxnBlQ+vFXztiX1svWxUAd4hzRCTYP3n9ELnZRg3Si95JUjzkh40DtS+uWvO7xfJJi 6f/SO4WLQ63BCimQ2/CJBkiZbIq1Jas93fW8twEQHslGkA/iHuusF4Dohlygi13hbHJ4lk OCaOktXqI8Jn7RR7A+hM2/GwT9rQdDQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1701337032; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fPpZqdy8WmkwRUH7L2mYE9vU9NZ9C+P0M1NFAywlK8g=; b=Zyb4nmZaVnM4C5MOSTMnrHh6UUSCsBFAaul0ex6Yx42DOhxy0u8VvNQg6brWvLvRIAilz/ XzwfK/bibEirIzAw== Received: from imap2.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 imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 1AD3313AE2; Thu, 30 Nov 2023 09:37:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id pKGZBshXaGVmKAAAn2gu4w (envelope-from ); Thu, 30 Nov 2023 09:37:12 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 6EA2BA07F7; Thu, 30 Nov 2023 10:37:11 +0100 (CET) From: Jan Kara To: ltp@lists.linux.it Date: Thu, 30 Nov 2023 10:37:09 +0100 Message-Id: <20231130093711.20171-6-jack@suse.cz> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231130093533.10036-1-jack@suse.cz> References: <20231130093533.10036-1-jack@suse.cz> MIME-Version: 1.0 Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spam-Score: -3.10 X-Spamd-Result: default: False [-3.10 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_MISSING_CHARSET(2.50)[]; REPLY(-4.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_CC(0.00)[gmail.com,suse.cz]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] X-Virus-Scanned: clamav-milter 1.0.1 at in-2.smtp.seeweb.it X-Virus-Status: Clean 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, T_SCC_BODY_TEXT_LINE 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 Subject: [LTP] [PATCH v2 6/7] fanotify: Convert remaining init_flags tests to be performed on target fs 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: , Cc: Jan Kara Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Convert remaining tests using REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_BY_KERNEL to be performed on target filesystem using REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_ON_FS and remove the now unused macro and functions. Reviewed-by: Amir Goldstein Signed-off-by: Jan Kara --- testcases/kernel/syscalls/fanotify/fanotify.h | 9 --------- testcases/kernel/syscalls/fanotify/fanotify20.c | 3 ++- testcases/kernel/syscalls/fanotify/fanotify21.c | 3 ++- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h index d49966810381..66b1b5e4141a 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify.h +++ b/testcases/kernel/syscalls/fanotify/fanotify.h @@ -201,11 +201,6 @@ static inline int fanotify_init_flags_supported_on_fs(unsigned int flags, const return fanotify_flags_supported_on_fs(flags, FAN_MARK_INODE, FAN_ACCESS, fname); } -static inline int fanotify_init_flags_supported_by_kernel(unsigned int flags) -{ - return fanotify_init_flags_supported_on_fs(flags, NULL); -} - static inline int fanotify_mark_supported_on_fs(uint64_t flag, const char *fname) { return fanotify_flags_supported_on_fs(FAN_CLASS_NOTIF, flag, FAN_ACCESS, fname); @@ -280,10 +275,6 @@ static inline void fanotify_flags_err_msg(const char *flags_str, fanotify_flags_err_msg(#flags, __FILE__, __LINE__, tst_brk_, \ fanotify_init_flags_supported_on_fs(flags, fname)) -#define REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_BY_KERNEL(flags) \ - fanotify_flags_err_msg(#flags, __FILE__, __LINE__, tst_brk_, \ - fanotify_init_flags_supported_by_kernel(flags)) - static inline int fanotify_handle_supported_by_kernel(int flag) { /* diff --git a/testcases/kernel/syscalls/fanotify/fanotify20.c b/testcases/kernel/syscalls/fanotify/fanotify20.c index 71310fb86e9e..1d249ac9cfcc 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify20.c +++ b/testcases/kernel/syscalls/fanotify/fanotify20.c @@ -50,7 +50,8 @@ static void do_setup(void) * An explicit check for FAN_REPORT_PIDFD is performed early on in the * test initialization as it's a prerequisite for all test cases. */ - REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_BY_KERNEL(FAN_REPORT_PIDFD); + REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_ON_FS(FAN_REPORT_PIDFD, + MOUNT_PATH); } static void do_test(unsigned int i) diff --git a/testcases/kernel/syscalls/fanotify/fanotify21.c b/testcases/kernel/syscalls/fanotify/fanotify21.c index 8a1028086237..d54930f05161 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify21.c +++ b/testcases/kernel/syscalls/fanotify/fanotify21.c @@ -119,7 +119,8 @@ static void do_setup(void) * on in the test initialization as it's a prerequisite for * all test cases. */ - REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_BY_KERNEL(FAN_REPORT_PIDFD); + REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_ON_FS(FAN_REPORT_PIDFD, + TEST_FILE); fanotify_fd = SAFE_FANOTIFY_INIT(FAN_REPORT_PIDFD, O_RDONLY); SAFE_FANOTIFY_MARK(fanotify_fd, FAN_MARK_ADD, FAN_OPEN, AT_FDCWD, From patchwork Thu Nov 30 09:37:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 1870010 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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 4Sgrhj63Xxz1ySd for ; Thu, 30 Nov 2023 20:37:57 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id B055E3CD73E for ; Thu, 30 Nov 2023 10:37:55 +0100 (CET) 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 (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id CDAC03C8960 for ; Thu, 30 Nov 2023 10:37:13 +0100 (CET) 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 B7339207CCC for ; Thu, 30 Nov 2023 10:37:12 +0100 (CET) Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (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 288EA1FCE0; Thu, 30 Nov 2023 09:37:12 +0000 (UTC) Received: from imap2.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 imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 1CEBB13B3E; Thu, 30 Nov 2023 09:37:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id DJQQB8hXaGVnKAAAn2gu4w (envelope-from ); Thu, 30 Nov 2023 09:37:12 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 74A6CA07F9; Thu, 30 Nov 2023 10:37:11 +0100 (CET) From: Jan Kara To: ltp@lists.linux.it Date: Thu, 30 Nov 2023 10:37:10 +0100 Message-Id: <20231130093711.20171-7-jack@suse.cz> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231130093533.10036-1-jack@suse.cz> References: <20231130093533.10036-1-jack@suse.cz> MIME-Version: 1.0 X-Spam-Level: X-Rspamd-Server: rspamd1 Authentication-Results: smtp-out2.suse.de; none X-Rspamd-Queue-Id: 288EA1FCE0 X-Spam-Score: -4.00 X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Virus-Scanned: clamav-milter 1.0.1 at in-7.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Subject: [LTP] [PATCH v2 7/7] fanotify: Convert permission events feature check to be performed on fs 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: , Cc: Jan Kara Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Convert feature check for availability of permission events to be performed on the tested filesystem. Reviewed-by: Amir Goldstein Signed-off-by: Jan Kara --- testcases/kernel/syscalls/fanotify/fanotify.h | 5 +++-- testcases/kernel/syscalls/fanotify/fanotify03.c | 3 +-- testcases/kernel/syscalls/fanotify/fanotify07.c | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h index 66b1b5e4141a..e0d178bcc7b3 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify.h +++ b/testcases/kernel/syscalls/fanotify/fanotify.h @@ -133,13 +133,14 @@ static inline int fanotify_save_fid(const char *path, #define INIT_FANOTIFY_MARK_TYPE(t) \ { FAN_MARK_ ## t, "FAN_MARK_" #t } -static inline void require_fanotify_access_permissions_supported_by_kernel(void) +static inline void require_fanotify_access_permissions_supported_on_fs( + const char *fname) { int fd; fd = SAFE_FANOTIFY_INIT(FAN_CLASS_CONTENT, O_RDONLY); - if (fanotify_mark(fd, FAN_MARK_ADD, FAN_ACCESS_PERM, AT_FDCWD, ".") < 0) { + if (fanotify_mark(fd, FAN_MARK_ADD, FAN_ACCESS_PERM, AT_FDCWD, fname) < 0) { if (errno == EINVAL) { tst_brk(TCONF | TERRNO, "CONFIG_FANOTIFY_ACCESS_PERMISSIONS not configured in kernel?"); diff --git a/testcases/kernel/syscalls/fanotify/fanotify03.c b/testcases/kernel/syscalls/fanotify/fanotify03.c index 343ba857e1ae..028da742c76c 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify03.c +++ b/testcases/kernel/syscalls/fanotify/fanotify03.c @@ -320,11 +320,10 @@ static void test_fanotify(unsigned int n) static void setup(void) { - require_fanotify_access_permissions_supported_by_kernel(); - sprintf(fname, MOUNT_PATH"/fname_%d", getpid()); SAFE_FILE_PRINTF(fname, "1"); + require_fanotify_access_permissions_supported_on_fs(fname); filesystem_mark_unsupported = fanotify_mark_supported_on_fs(FAN_MARK_FILESYSTEM, fname); exec_events_unsupported = fanotify_flags_supported_on_fs(FAN_CLASS_CONTENT, 0, FAN_OPEN_EXEC_PERM, fname); diff --git a/testcases/kernel/syscalls/fanotify/fanotify07.c b/testcases/kernel/syscalls/fanotify/fanotify07.c index 396c8490eeda..34aa810c7dac 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify07.c +++ b/testcases/kernel/syscalls/fanotify/fanotify07.c @@ -189,10 +189,9 @@ static void test_fanotify(void) static void setup(void) { - require_fanotify_access_permissions_supported_by_kernel(); - sprintf(fname, "fname_%d", getpid()); SAFE_FILE_PRINTF(fname, "%s", fname); + require_fanotify_access_permissions_supported_on_fs(fname); } static void cleanup(void)