From patchwork Thu Jul 25 13:51:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alexis_Lothor=C3=A9?= X-Patchwork-Id: 13741960 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A3CB13AA36; Thu, 25 Jul 2024 13:52:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721915555; cv=none; b=J0BmTKclDCXgZ44Tj+35D30hqFZn6XUQxchl4/yeJiPvYXDusFfER2l26A0Nb0n9nVORKJUO9cIMCdzlR/fwlAuN0n3cJy7+8JclkTXl/VAap9e26fiv3scNYEtAKDnuPm//oWL+jQNKbf9AbnMOr0y5OZWaofe3teLaNKilNiY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721915555; c=relaxed/simple; bh=giTGI7XO1nh0CIJ5nZ9MZTjB5lGfkvLQbaPTsufQ8Uk=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=p7mBjf5BbMijn3vgif298PWyn1D6Xjt4TlhBcSI/JTkR4O9ebUWpe8J9MpeztXXY4aZ86GfDumnlfanuxD3Y9R66Vm7pQbNASA5pHB9ZaKCOz1Fh3GkT/i9G8ShDQJjDsjfST9KbiIKiRXAHDYhcwNpeU1Yvb8ALMv3RuiTh3Es= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=KD2Wbssd; arc=none smtp.client-ip=217.70.183.200 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="KD2Wbssd" Received: by mail.gandi.net (Postfix) with ESMTPSA id 68DEC20003; Thu, 25 Jul 2024 13:52:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1721915550; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9j+NUVOZqbq7AKXur7drZsIDicYamchs6FdoIYC9EB0=; b=KD2WbssdSwA24JVC8+Otb18wIabxwZkk925WSyMWV64e57lZvlR6F7t3bqtiBjd8QxeEr4 YSIDL+94K+NP/Px+a3rqW17fZ4Q2oTGHTszVrEbE9c+iPSDS6QwXS6JXptdrmwmYBkRQAw FDZFDsv5w8+ZOuiZcrcIaME1G/R6Y2wZw966w1TF343OJXrvdVrZdbn+RN2nj7CnNTzOY+ 5SshXxEwfSzaa/hsMULmNS3+5MIqOuGrJOXm82YtJhY5eWBbaBY3CaHR0ri9DkgHGKAupu 6585FH4rpzm1a0WoQOtiS0JunTNXJ2NRi9Q//rSx/P/riR1fOgueFvMRKWksLQ== From: =?utf-8?q?Alexis_Lothor=C3=A9_=28eBPF_Foundation=29?= Subject: [PATCH 0/3] selftests/bpf: convert test_dev_cgroup to test_progs Date: Thu, 25 Jul 2024 15:51:08 +0200 Message-Id: <20240725-convert_dev_cgroup-v1-0-2c8cbd487c44@bootlin.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAExYomYC/x3MQQqAIBBA0avIrBPMpKCrREjpVLPRGEuC8O5Jy 7f4/4WETJhgFC8wZkoUQ0XbCHDHEnaU5KtBK23UoDvpYsjIl/WYrds53qfsTW9W5bthaxeo4cm 40fNPp7mUD/y/1YhkAAAA To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Mykola Lysenko , Shuah Khan Cc: ebpf@linuxfoundation.org, Thomas Petazzoni , bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?A?= =?utf-8?q?lexis_Lothor=C3=A9_=28eBPF_Foundation=29?= X-Mailer: b4 0.13.0 X-GND-Sasl: alexis.lothore@bootlin.com Hello, this small series aims to integrate test_dev_cgroup in test_progs so it could be run automatically in CI. The new version brings a few differences with the current one: - test now uses directly syscalls instead of wrapping commandline tools into system() calls - test_progs manipulates /dev/null (eg: redirecting test logs into it), so disabling access to it in the bpf program confuses the tests. To fix this, the first commit modifies the bpf program to allow access to char devices 1:3 (/dev/null), and disable access to char devices 1:5 (/dev/zero) - once test is converted, add a small subtest to also check for device type interpretation (char or block) - paths used in mknod tests are now in /dev instead of /tmp: due to the CI runner organisation and mountpoints manipulations, trying to create nodes in /tmp leads to errors unrelated to the test (ie, mknod calls refused by kernel, not the bpf program). I don't understand exactly the root cause at the deepest point (all I see in CI is an -ENXIO error on mknod when trying to create the node in tmp, and I can not make sense out of it neither replicate it locally), so I would gladly take inputs from anyone more educated than me about this. The new test_progs part has been tested in a local qemu environment as well as in upstream CI: ./test_progs -a cgroup_dev 47/1 cgroup_dev/deny-mknod:OK 47/2 cgroup_dev/allow-mknod:OK 47/3 cgroup_dev/deny-mknod-wrong-type:OK 47/4 cgroup_dev/allow-read:OK 47/5 cgroup_dev/allow-write:OK 47/6 cgroup_dev/deny-read:OK 47/7 cgroup_dev/deny-write:OK 47 cgroup_dev:OK Summary: 1/7 PASSED, 0 SKIPPED, 0 FAILED --- Alexis Lothoré (eBPF Foundation) (3): selftests/bpf: do not disable /dev/null device access in cgroup dev test selftests/bpf: convert test_dev_cgroup to test_progs selftests/bpf: add wrong type test to cgroup dev tools/testing/selftests/bpf/.gitignore | 1 - tools/testing/selftests/bpf/Makefile | 2 - .../testing/selftests/bpf/prog_tests/cgroup_dev.c | 123 +++++++++++++++++++++ tools/testing/selftests/bpf/progs/dev_cgroup.c | 4 +- tools/testing/selftests/bpf/test_dev_cgroup.c | 85 -------------- 5 files changed, 125 insertions(+), 90 deletions(-) --- base-commit: c90e2d4a7738a24fbb3657092dbd1ca20c040ed1 change-id: 20240723-convert_dev_cgroup-6464b0d37f1a Best regards,