From patchwork Fri Oct 13 07:47:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1847891 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=YIoX5nWd; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=LVktR8Gr; 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 4S6JXJ5JpCz1yqn for ; Fri, 13 Oct 2023 18:48:16 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id A7EE63CD3A2 for ; Fri, 13 Oct 2023 09:48:13 +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 (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id AC45E3C8767 for ; Fri, 13 Oct 2023 09:48:11 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) (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 1C05C1A0237F for ; Fri, 13 Oct 2023 09:48:10 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 08A07219B3; Fri, 13 Oct 2023 07:48:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1697183289; 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=Q17GhFVieFWg1wBEVZOTURESZnAlA7z73tONCbkfgAI=; b=YIoX5nWdslcfDGAOzbt9bOmpnUtn9t9iZRpJIB0t9Hx4EFwIw1Aa7Euk5KHG/okfcdocUE mQRFv9VEmWMRs4j/q61mQdtcljJjZalk78GwhSUToeO6ftGBXsATOVkiwRqP2L163DKo2D wRweRS/9fSNJTozuXQreCyoo0z8dCKQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1697183289; 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=Q17GhFVieFWg1wBEVZOTURESZnAlA7z73tONCbkfgAI=; b=LVktR8GrcXPsPB8r6HnrHbk8Xg8dQphyDn7yPFZBg+deHhLrsqT8sLrjsm3b3w4p7AvGUY 25vrvriTdDwMbqCw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E3861139ED; Fri, 13 Oct 2023 07:48:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id GDmRNjj2KGVqXwAAMHmgww (envelope-from ); Fri, 13 Oct 2023 07:48:08 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Fri, 13 Oct 2023 09:47:44 +0200 Message-ID: <20231013074748.702214-2-pvorel@suse.cz> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231013074748.702214-1-pvorel@suse.cz> References: <20231013074748.702214-1-pvorel@suse.cz> MIME-Version: 1.0 Authentication-Results: smtp-out1.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)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWO(0.00)[2]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.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_SOFTFAIL 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 1/4] tst_kernel: Add safe_check_driver() 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" And use it in tst_test.c. It will be more reused in the next commit. Signed-off-by: Petr Vorel --- include/tst_kernel.h | 9 +++++++++ lib/tst_kernel.c | 6 ++++++ lib/tst_test.c | 3 +-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/include/tst_kernel.h b/include/tst_kernel.h index 9d3a8d315..8caf3f733 100644 --- a/include/tst_kernel.h +++ b/include/tst_kernel.h @@ -30,4 +30,13 @@ int tst_check_builtin_driver(const char *driver); */ int tst_check_driver(const char *driver); +/* + * Checks support for the kernel module (both built-in and loadable) + * and exit with TCONF if driver not available. + * + * @param driver The name of the driver. + * On Android it *always* passes (always expect the driver is available). + */ +void safe_check_driver(const char *driver); + #endif /* TST_KERNEL_H__ */ diff --git a/lib/tst_kernel.c b/lib/tst_kernel.c index 4b75ceadb..de4c28308 100644 --- a/lib/tst_kernel.c +++ b/lib/tst_kernel.c @@ -198,3 +198,9 @@ int tst_check_driver(const char *driver) return -1; } + +void safe_check_driver(const char *driver) +{ + if (tst_check_driver(driver)) + tst_brkm(TCONF, NULL, "%s driver not available", driver); +} diff --git a/lib/tst_test.c b/lib/tst_test.c index c2f8f503f..087c62a16 100644 --- a/lib/tst_test.c +++ b/lib/tst_test.c @@ -1191,8 +1191,7 @@ static void do_setup(int argc, char *argv[]) int i; for (i = 0; (name = tst_test->needs_drivers[i]); ++i) - if (tst_check_driver(name)) - tst_brk(TCONF, "%s driver not available", name); + safe_check_driver(name); } if (tst_test->mount_device) From patchwork Fri Oct 13 07:47:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1847894 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=ZRJzyRX1; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=O5mtDbnA; 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 4S6JXx0wkGz1yqn for ; Fri, 13 Oct 2023 18:48:49 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 279B13CF033 for ; Fri, 13 Oct 2023 09:48:47 +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 (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id BE3A53C8767 for ; Fri, 13 Oct 2023 09:48:10 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (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 3A28123799C for ; Fri, 13 Oct 2023 09:48:09 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 22205219BA; Fri, 13 Oct 2023 07:48:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1697183289; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xh5KHpj/ZbQsjJ1kWKm4Rikd6Fngd9XkwjPQdzrHsHA=; b=ZRJzyRX1oulqvR861zn4SvyJEYdslzixt4bByh1acnvkt9QWHGuk81PeiKuXKgxbfEF9oS se38QojFuWXaUEMsobMOpB71PMMzqPOVpwHFs7bHPQzENr998ExpYpUAn2RbZh1P4iUMzd MYt+Gpn1Ypez2e6J2FEmHTm4iAZ/Wmo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1697183289; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xh5KHpj/ZbQsjJ1kWKm4Rikd6Fngd9XkwjPQdzrHsHA=; b=O5mtDbnAgpJhjW5hZINGNvKYpIKOKKOtBKCshMtboir3cLcAuZB3/HJGG4D8uFZIdKbAuO wypMwMUYClxqlTBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 0C92E13A00; Fri, 13 Oct 2023 07:48:09 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SMMQAjn2KGVqXwAAMHmgww (envelope-from ); Fri, 13 Oct 2023 07:48:09 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Fri, 13 Oct 2023 09:47:45 +0200 Message-ID: <20231013074748.702214-3-pvorel@suse.cz> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231013074748.702214-1-pvorel@suse.cz> References: <20231013074748.702214-1-pvorel@suse.cz> MIME-Version: 1.0 Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spam-Score: -6.10 X-Spamd-Result: default: False [-6.10 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWO(0.00)[2]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.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.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 Subject: [LTP] [PATCH 2/4] lib: Add .modprobe 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" Signed-off-by: Petr Vorel --- doc/C-Test-API.asciidoc | 5 +++ doc/Test-Writing-Guidelines.asciidoc | 1 + include/tst_test.h | 5 ++- lib/tst_test.c | 53 ++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 1 deletion(-) diff --git a/doc/C-Test-API.asciidoc b/doc/C-Test-API.asciidoc index dab811564..f2ba302e2 100644 --- a/doc/C-Test-API.asciidoc +++ b/doc/C-Test-API.asciidoc @@ -1609,6 +1609,11 @@ first missing driver. The detection is based on reading 'modules.dep' and 'modules.builtin' files generated by kmod. The check is skipped on Android. +NULL terminated array '.modprobe' of kernel module names are tried to be loaded +with 'modprobe' unless they are builtin or already loaded. Test exits with +'TCONF' on first 'modprobe' non-zero exit. During cleanup are the modules +loaded by the test unloaded with 'rmmod'. + 1.27 Saving & restoring /proc|sys values ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/Test-Writing-Guidelines.asciidoc b/doc/Test-Writing-Guidelines.asciidoc index 0db852ae6..19487816e 100644 --- a/doc/Test-Writing-Guidelines.asciidoc +++ b/doc/Test-Writing-Guidelines.asciidoc @@ -371,6 +371,7 @@ https://github.com/linux-test-project/ltp/wiki/Shell-Test-API[Shell Test API]. | '.min_mem_avail' | not applicable | '.mnt_flags' | 'TST_MNT_PARAMS' | '.min_swap_avail' | not applicable +| '.modprobe' | – | '.mntpoint', '.mnt_data' | 'TST_MNTPOINT' | '.mount_device' | 'TST_MOUNT_DEVICE' | '.needs_cgroup_ctrls' | – diff --git a/include/tst_test.h b/include/tst_test.h index 75c2109b9..6b4fac985 100644 --- a/include/tst_test.h +++ b/include/tst_test.h @@ -297,9 +297,12 @@ struct tst_test { /* NULL terminated array of resource file names */ const char *const *resource_files; - /* NULL terminated array of needed kernel drivers */ + /* NULL terminated array of needed kernel drivers to be checked */ const char * const *needs_drivers; + /* NULL terminated array of needed kernel drivers to be loaded with modprobe */ + const char * const *modprobe; + /* * {NULL, NULL} terminated array of (/proc, /sys) files to save * before setup and restore after cleanup diff --git a/lib/tst_test.c b/lib/tst_test.c index 087c62a16..ccbaa4c02 100644 --- a/lib/tst_test.c +++ b/lib/tst_test.c @@ -49,6 +49,7 @@ const char *TCID __attribute__((weak)); #define CVE_DB_URL "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-" #define DEFAULT_TIMEOUT 30 +#define MODULES_MAX_LEN 10 struct tst_test *tst_test; @@ -83,6 +84,8 @@ const char *tst_ipc_path = ipc_path; static char shm_path[1024]; +static int modules_loaded[MODULES_MAX_LEN]; + int TST_ERR; int TST_PASS; long TST_RET; @@ -1135,6 +1138,29 @@ static void do_cgroup_requires(void) tst_cg_init(); } +/* + * Search kernel driver in /proc/modules. + * + * @param driver The name of the driver. + * @return 1 if driver is found, otherwise 0. + */ +static int module_loaded(const char *driver) +{ + char line[4096]; + int found = 0; + FILE *file = SAFE_FOPEN("/proc/modules", "r"); + + while (fgets(line, sizeof(line), file)) { + if (strstr(line, driver)) { + found = 1; + break; + } + } + SAFE_FCLOSE(file); + + return found; +} + static void do_setup(int argc, char *argv[]) { if (!tst_test) @@ -1194,6 +1220,20 @@ static void do_setup(int argc, char *argv[]) safe_check_driver(name); } + if (tst_test->modprobe) { + const char *name; + int i; + + for (i = 0; (name = tst_test->modprobe[i]); ++i) { + /* only load module if not already loaded */ + if (!module_loaded(name) && tst_check_builtin_driver(name)) { + const char *const cmd_modprobe[] = {"modprobe", name, NULL}; + SAFE_CMD(cmd_modprobe, NULL, NULL); + modules_loaded[i] = 1; + } + } + } + if (tst_test->mount_device) tst_test->format_device = 1; @@ -1362,6 +1402,19 @@ static void do_cleanup(void) tst_sys_conf_restore(0); + if (tst_test->modprobe) { + const char *name; + int i; + + for (i = 0; (name = tst_test->modprobe[i]); ++i) { + if (!modules_loaded[i]) + continue; + + const char *const cmd_rmmod[] = {"rmmod", name, NULL}; + SAFE_CMD(cmd_rmmod, NULL, NULL); + } + } + if (tst_test->restore_wallclock) tst_wallclock_restore(); From patchwork Fri Oct 13 07:47:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1847892 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=ytoCp9hu; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=DFfEKPx9; 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 4S6JXV4rPWz1yqn for ; Fri, 13 Oct 2023 18:48:26 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 7CBD23CB4C9 for ; Fri, 13 Oct 2023 09:48:24 +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 (P-384) server-digest SHA384) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id C22693C8DBE for ; Fri, 13 Oct 2023 09:48:11 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (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 12C2D14088EC for ; Fri, 13 Oct 2023 09:48:10 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 46B061FD81; Fri, 13 Oct 2023 07:48:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1697183289; 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=rYrFtcGjDBRzzLXM2dPhmbJGCleL4m974Qcz4pE3tnI=; b=ytoCp9huFG2Eyq37HUEC7EDjh0WoLGou4E44nHru5/I9zhQo0SvLexMxl4IgUKCwD7Sc9Q JC54BIkYkCueuU7Z2YuNNfWLxa8O3zvWYkHGkY6GucydhkbjxV+pzZlKtKX81HSezqr5xa tbxaKzwH16uwyQmanCfRs/YDKMbHx5E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1697183289; 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=rYrFtcGjDBRzzLXM2dPhmbJGCleL4m974Qcz4pE3tnI=; b=DFfEKPx9HPu8mGXk2VuFh17/NwDWwN7WXsQNZ+jqOvBRuABvS5WpUVkF2sXbY/5LV/v5WR kt7U9UfTKbDZBLDg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 265E113AA5; Fri, 13 Oct 2023 07:48:09 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id uLBwCDn2KGVqXwAAMHmgww (envelope-from ); Fri, 13 Oct 2023 07:48:09 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Fri, 13 Oct 2023 09:47:46 +0200 Message-ID: <20231013074748.702214-4-pvorel@suse.cz> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231013074748.702214-1-pvorel@suse.cz> References: <20231013074748.702214-1-pvorel@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)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWO(0.00)[2]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.00)[17.23%] X-Virus-Scanned: clamav-milter 1.0.1 at in-6.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_SOFTFAIL 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 Subject: [LTP] [PATCH 3/4] madvise11: Replace .needs_drivers with .modprobe 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" Signed-off-by: Petr Vorel --- testcases/kernel/syscalls/madvise/madvise11.c | 36 +------------------ 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/testcases/kernel/syscalls/madvise/madvise11.c b/testcases/kernel/syscalls/madvise/madvise11.c index 3cde85ef5..68f801610 100644 --- a/testcases/kernel/syscalls/madvise/madvise11.c +++ b/testcases/kernel/syscalls/madvise/madvise11.c @@ -47,7 +47,6 @@ static pthread_mutex_t sigbus_received_mtx = PTHREAD_MUTEX_INITIALIZER; static long pagesize; static char beginning_tag[BUFSIZ]; -static int hwpoison_probe; static void my_yield(void) { @@ -266,22 +265,6 @@ static int populate_from_klog(char *begin_tag, unsigned long *pfns, int max) * Read the given file to search for the key. * Return 1 if the key is found. */ -static int find_in_file(char *path, char *key) -{ - char line[4096]; - int found = 0; - FILE *file = SAFE_FOPEN(path, "r"); - - while (fgets(line, sizeof(line), file)) { - if (strstr(line, key)) { - found = 1; - break; - } - } - SAFE_FCLOSE(file); - return found; -} - static void unpoison_this_pfn(unsigned long pfn, int fd) { char pfn_str[19]; @@ -294,18 +277,10 @@ static void unpoison_this_pfn(unsigned long pfn, int fd) static int open_unpoison_pfn(void) { char *added_file_path = "/hwpoison/unpoison-pfn"; - const char *const cmd_modprobe[] = {"modprobe", HW_MODULE, NULL}; char debugfs_fp[4096]; struct mntent *mnt; FILE *mntf; - if (!find_in_file("/proc/modules", HW_MODULE) && tst_check_builtin_driver(HW_MODULE)) - hwpoison_probe = 1; - - /* probe hwpoison only if it isn't already there */ - if (hwpoison_probe) - SAFE_CMD(cmd_modprobe, NULL, NULL); - /* debugfs mount point */ mntf = setmntent("/etc/mtab", "r"); if (!mntf) { @@ -349,7 +324,6 @@ static int open_unpoison_pfn(void) static void unpoison_pfn(char *begin_tag) { unsigned long *pfns; - const char *const cmd_rmmod[] = {"rmmod", HW_MODULE, NULL}; int found_pfns, fd; pfns = SAFE_MALLOC(sizeof(pfns) * maximum_pfns * run_iterations); @@ -365,9 +339,6 @@ static void unpoison_pfn(char *begin_tag) SAFE_CLOSE(fd); } - /* remove hwpoison only if we probed it */ - if (hwpoison_probe) - SAFE_CMD(cmd_rmmod, NULL, NULL); } /* @@ -417,15 +388,10 @@ static void cleanup(void) static struct tst_test test = { .needs_root = 1, - .needs_drivers = (const char *const []) { + .modprobe = (const char *const []) { HW_MODULE, NULL }, - .needs_cmds = (const char *[]) { - "modprobe", - "rmmod", - NULL - }, .max_runtime = 30, .needs_checkpoints = 1, .setup = setup, From patchwork Fri Oct 13 07:47:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1847895 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=t87b8W59; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=hgWVZZG0; 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 4S6JYB13xXz1yqn for ; Fri, 13 Oct 2023 18:49:02 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 23FF83CEE47 for ; Fri, 13 Oct 2023 09:48:59 +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 (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id CAF963C8DBE for ; Fri, 13 Oct 2023 09:48:10 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (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 40BA11A02368 for ; Fri, 13 Oct 2023 09:48:09 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 64297219C0; Fri, 13 Oct 2023 07:48:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1697183289; 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=qR/hHNWoqXVpuClSz6a6F1Bnh/g35klcKFUaDRVwv1g=; b=t87b8W595tqs/dhVTqlQGiFaPdlPY4HBOhaRTxMdo+b9/DNNyoPmYEFsffQzCuNUzGcfJy poUtgDBeKRztBZQRnEuyYfisW3pyCyguBLFcB2t7hJPRIeMs+4x9B132kwwDPIiOxh62u2 EVqaM+ideu8lA7ziuLG0f3etn1VYf78= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1697183289; 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=qR/hHNWoqXVpuClSz6a6F1Bnh/g35klcKFUaDRVwv1g=; b=hgWVZZG0chp/AhUwNjSMJ+Qjk7xBn5lh+1aOGS/r2gE+oMkXyvMQxvmxO5kGUr0QgPydLR jSxNam3ByIpG8gDA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 40E4213ADB; Fri, 13 Oct 2023 07:48:09 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id GEHZDjn2KGVqXwAAMHmgww (envelope-from ); Fri, 13 Oct 2023 07:48:09 +0000 From: Petr Vorel To: ltp@lists.linux.it Date: Fri, 13 Oct 2023 09:47:47 +0200 Message-ID: <20231013074748.702214-5-pvorel@suse.cz> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231013074748.702214-1-pvorel@suse.cz> References: <20231013074748.702214-1-pvorel@suse.cz> MIME-Version: 1.0 Authentication-Results: smtp-out1.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)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWO(0.00)[2]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.00)[42.60%] 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 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 4/4] can_bcm01: Move vcan to .modprobe 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" Signed-off-by: Petr Vorel --- testcases/network/can/cve/can_bcm01.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/testcases/network/can/cve/can_bcm01.c b/testcases/network/can/cve/can_bcm01.c index d9a835b03..ec98db133 100644 --- a/testcases/network/can/cve/can_bcm01.c +++ b/testcases/network/can/cve/can_bcm01.c @@ -41,14 +41,6 @@ static void setup(void) { struct sockaddr_can addr = { .can_family = AF_CAN }; - /* - * Older kernels require explicit modprobe of vcan. Newer kernels - * will load the modules automatically and support CAN in network - * namespace which would eliminate the need for running the test - * with root privileges. - */ - tst_cmd((const char*[]){"modprobe", "vcan", NULL}, NULL, NULL, 0); - NETDEV_ADD_DEVICE(LTP_DEVICE, "vcan"); NETDEV_SET_STATE(LTP_DEVICE, 1); addr.can_ifindex = NETDEV_INDEX_BY_NAME(LTP_DEVICE); @@ -143,10 +135,19 @@ static struct tst_test test = { .skip_in_compat = 1, .max_runtime = 30, .needs_drivers = (const char *const[]) { - "vcan", "can-bcm", NULL }, + /* + * Older kernels require explicit modprobe of vcan. Newer kernels + * will load the modules automatically and support CAN in network + * namespace which would eliminate the need for running the test + * with root privileges. + */ + .modprobe = (const char *const[]) { + "vcan", + NULL + }, .tags = (const struct tst_tag[]) { {"linux-git", "d5f9023fa61e"}, {"CVE", "2021-3609"},