From patchwork Tue Mar 1 12:23:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Palethorpe X-Patchwork-Id: 1599344 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=susede1 header.b=Bn52LHxM; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4K7GlZ2w8Lz9sFh for ; Tue, 1 Mar 2022 23:29:30 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id A20953CA08D for ; Tue, 1 Mar 2022 13:29:27 +0100 (CET) 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 RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 937063C0487 for ; Tue, 1 Mar 2022 13:29:26 +0100 (CET) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (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 D047214012A9 for ; Tue, 1 Mar 2022 13:29:25 +0100 (CET) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id E56751F39D; Tue, 1 Mar 2022 12:29:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1646137764; 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; bh=nlkGJzp2bkcGGWbHNKpWTL+K9sPifN3Dq1MELoeR4Bs=; b=Bn52LHxMby2OW2a8Qr+DeRBWL0AvDlpcKrQ2i9e+jTu1RGh+1hNk+HgcW6s+OMsxJsl+0e woutOsqB+DTxtYnPp/bPpDlRP/7SJmE0LUMWgtTE6WFYp7yR/ncqPWIk7NwSrPzTqF0KKr 5fy45k6Wk1qf7QjbE6K2kOZfoA8NS1A= Received: from g78.suse.de (unknown [10.163.24.138]) by relay2.suse.de (Postfix) with ESMTP id 9D66FA3B85; Tue, 1 Mar 2022 12:29:24 +0000 (UTC) To: ltp@lists.linux.it Date: Tue, 1 Mar 2022 12:23:53 +0000 Message-Id: <20220301122353.16137-1-rpalethorpe@suse.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 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_PASS, T_SCC_BODY_TEXT_LINE autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH] API/cgroup: Try to mount V2 with memory_recursiveprot 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: , X-Patchwork-Original-From: Richard Palethorpe via ltp From: Richard Palethorpe Reply-To: Richard Palethorpe Cc: Richard Palethorpe Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Moving forwards system managers should always mount with memory_recursiveprot. So we should test with this by default when it is available. This change will only effect SUTs which do not already have CGroups mounted. Signed-off-by: Richard Palethorpe Reviewed-by: Li Wang --- lib/tst_cgroup.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c index dc090b70a..8cca0654d 100644 --- a/lib/tst_cgroup.c +++ b/lib/tst_cgroup.c @@ -471,6 +471,7 @@ void tst_cg_scan(void) static void cgroup_mount_v2(void) { + int ret; char mnt_path[PATH_MAX]; sprintf(mnt_path, "%s%s", cgroup_mount_ltp_prefix, cgroup_v2_ltp_mount); @@ -494,7 +495,13 @@ static void cgroup_mount_v2(void) return; mount: - if (!mount("cgroup2", mnt_path, "cgroup2", 0, NULL)) { + ret = mount("cgroup2", mnt_path, "cgroup2", + 0, "memory_recursiveprot"); + + if (ret && errno == EINVAL) + ret = mount("cgroup2", mnt_path, "cgroup2", 0, NULL); + + if (!ret) { tst_res(TINFO, "Mounted V2 CGroups on %s", mnt_path); tst_cg_scan(); roots[0].we_mounted_it = 1;