Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Yafang Shao <laoar.shao@gmail.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Sasha Levin <sashal@kernel.org>,
	daniel@iogearbox.net, andrii@kernel.org, shuah@kernel.org,
	bpf@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: [PATCH AUTOSEL 6.6 008/104] selftests/bpf: Fix issues in setup_classid_environment()
Date: Tue, 16 Jan 2024 14:45:34 -0500	[thread overview]
Message-ID: <20240116194908.253437-8-sashal@kernel.org> (raw)
In-Reply-To: <20240116194908.253437-1-sashal@kernel.org>

From: Yafang Shao <laoar.shao@gmail.com>

[ Upstream commit 4849775587844e44d215289c425bcd70f315efe7 ]

If the net_cls subsystem is already mounted, attempting to mount it again
in setup_classid_environment() will result in a failure with the error code
EBUSY. Despite this, tmpfs will have been successfully mounted at
/sys/fs/cgroup/net_cls. Consequently, the /sys/fs/cgroup/net_cls directory
will be empty, causing subsequent setup operations to fail.

Here's an error log excerpt illustrating the issue when net_cls has already
been mounted at /sys/fs/cgroup/net_cls prior to running
setup_classid_environment():

- Before that change

  $ tools/testing/selftests/bpf/test_progs --name=cgroup_v1v2
  test_cgroup_v1v2:PASS:server_fd 0 nsec
  test_cgroup_v1v2:PASS:client_fd 0 nsec
  test_cgroup_v1v2:PASS:cgroup_fd 0 nsec
  test_cgroup_v1v2:PASS:server_fd 0 nsec
  run_test:PASS:skel_open 0 nsec
  run_test:PASS:prog_attach 0 nsec
  test_cgroup_v1v2:PASS:cgroup-v2-only 0 nsec
  (cgroup_helpers.c:248: errno: No such file or directory) Opening Cgroup Procs: /sys/fs/cgroup/net_cls/cgroup.procs
  (cgroup_helpers.c:540: errno: No such file or directory) Opening cgroup classid: /sys/fs/cgroup/net_cls/cgroup-test-work-dir/net_cls.classid
  run_test:PASS:skel_open 0 nsec
  run_test:PASS:prog_attach 0 nsec
  (cgroup_helpers.c:248: errno: No such file or directory) Opening Cgroup Procs: /sys/fs/cgroup/net_cls/cgroup-test-work-dir/cgroup.procs
  run_test:FAIL:join_classid unexpected error: 1 (errno 2)
  test_cgroup_v1v2:FAIL:cgroup-v1v2 unexpected error: -1 (errno 2)
  (cgroup_helpers.c:248: errno: No such file or directory) Opening Cgroup Procs: /sys/fs/cgroup/net_cls/cgroup.procs
  #44      cgroup_v1v2:FAIL
  Summary: 0/0 PASSED, 0 SKIPPED, 1 FAILED

- After that change
  $ tools/testing/selftests/bpf/test_progs --name=cgroup_v1v2
  #44      cgroup_v1v2:OK
  Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Link: https://lore.kernel.org/r/20231111090034.4248-3-laoar.shao@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 tools/testing/selftests/bpf/cgroup_helpers.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/bpf/cgroup_helpers.c b/tools/testing/selftests/bpf/cgroup_helpers.c
index 2caee8423ee0..f68fbc6c3f52 100644
--- a/tools/testing/selftests/bpf/cgroup_helpers.c
+++ b/tools/testing/selftests/bpf/cgroup_helpers.c
@@ -499,10 +499,20 @@ int setup_classid_environment(void)
 		return 1;
 	}
 
-	if (mount("net_cls", NETCLS_MOUNT_PATH, "cgroup", 0, "net_cls") &&
-	    errno != EBUSY) {
-		log_err("mount cgroup net_cls");
-		return 1;
+	if (mount("net_cls", NETCLS_MOUNT_PATH, "cgroup", 0, "net_cls")) {
+		if (errno != EBUSY) {
+			log_err("mount cgroup net_cls");
+			return 1;
+		}
+
+		if (rmdir(NETCLS_MOUNT_PATH)) {
+			log_err("rmdir cgroup net_cls");
+			return 1;
+		}
+		if (umount(CGROUP_MOUNT_DFLT)) {
+			log_err("umount cgroup base");
+			return 1;
+		}
 	}
 
 	cleanup_classid_environment();
-- 
2.43.0


  parent reply	other threads:[~2024-01-16 19:49 UTC|newest]

Thread overview: 105+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-16 19:45 [PATCH AUTOSEL 6.6 001/104] wifi: rtw89: fix timeout calculation in rtw89_roc_end() Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 002/104] wifi: rt2x00: restart beacon queue when hardware reset Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 003/104] selftests/bpf: fix RELEASE=1 build for tc_opts Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 004/104] selftests/bpf: satisfy compiler by having explicit return in btf test Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 005/104] libbpf: Fix potential uninitialized tail padding with LIBBPF_OPTS_RESET Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 006/104] selftests/bpf: Fix pyperf180 compilation failure with clang18 Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 007/104] wifi: rt2x00: correct wrong BBP register in RxDCOC calibration Sasha Levin
2024-01-16 19:45 ` Sasha Levin [this message]
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 009/104] ARM: dts: qcom: strip prefix from PMIC files Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 010/104] ARM: dts: qcom: apq8064: fix PMIC node labels Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 011/104] ARM: dts: qcom: mdm9615: " Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 012/104] ARM: dts: qcom: msm8660: " Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 013/104] ARM: dts: qcom: msm8960: " Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 014/104] soc: xilinx: Fix for call trace due to the usage of smp_processor_id() Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 015/104] soc: xilinx: fix unhandled SGI warning message Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 016/104] scsi: lpfc: Fix possible file string name overflow when updating firmware Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 017/104] ARM: dts: samsung: exynos4: fix camera unit addresses/ranges Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 018/104] ARM: dts: samsung: s5pv210: " Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 019/104] net: phy: micrel: fix ts_info value in case of no phc Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 020/104] PCI: Add no PM reset quirk for NVIDIA Spectrum devices Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 021/104] r8169: improve RTL8411b phy-down fixup Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 022/104] bonding: return -ENOMEM instead of BUG in alb_upper_dev_walk Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 023/104] net: usb: ax88179_178a: avoid two consecutive device resets Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 024/104] wifi: ieee80211: fix PV1 frame control field name Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 025/104] scsi: mpi3mr: Add support for SAS5116 PCI IDs Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 026/104] scsi: mpi3mr: Add PCI checks where SAS5116 diverges from SAS4116 Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 027/104] scsi: arcmsr: Support new PCI device IDs 1883 and 1886 Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 028/104] ARM: dts: imx7d: Fix coresight funnel ports Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 029/104] ARM: dts: imx7s: Fix lcdif compatible Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 030/104] ARM: dts: imx7s: Fix nand-controller #size-cells Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 031/104] bpf: Fix a few selftest failures due to llvm18 change Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 032/104] wifi: ath9k: Fix potential array-index-out-of-bounds read in ath9k_htc_txstatus() Sasha Levin
2024-01-16 19:45 ` [PATCH AUTOSEL 6.6 033/104] wifi: ath11k: fix race due to setting ATH11K_FLAG_EXT_IRQ_ENABLED too early Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 034/104] wifi: rtw89: fix misbehavior of TX beacon in concurrent mode Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 035/104] bnxt_en: Add 5760X (P7) PCI IDs Sasha Levin
2024-01-16 20:17   ` Michael Chan
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 036/104] bpf: Check rcu_read_lock_trace_held() before calling bpf map helpers Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 037/104] bpf: Add map and need_defer parameters to .map_fd_put_ptr() Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 038/104] bpf: Set need_defer as false when clearing fd array during map free Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 039/104] wifi: ath12k: fix and enable AP mode for WCN7850 Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 040/104] scsi: libfc: Don't schedule abort twice Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 041/104] scsi: libfc: Fix up timeout error in fc_fcp_rec_error() Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 042/104] net: mvmdio: Avoid excessive sleeps in polled mode Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 043/104] usb: typec: ucsi: fix UCSI on buggy Qualcomm devices Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 044/104] arm64: dts: qcom: sm8550: fix soundwire controllers node name Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 045/104] arm64: dts: qcom: sm8450: " Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 046/104] arm64: dts: qcom: sm8350: Fix remoteproc interrupt type Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 047/104] wifi: mt76: connac: fix EHT phy mode check Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 048/104] wifi: mt76: mt7996: add PCI IDs for mt7992 Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 049/104] net: wangxun: fix changing mac failed when running Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 050/104] bpf: Guard stack limits against 32bit overflow Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 051/104] bpf: Set uattr->batch.count as zero before batched update or deletion Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 052/104] wifi: wfx: fix possible NULL pointer dereference in wfx_set_mfp_ap() Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 053/104] wifi: ath12k: fix the issue that the multicast/broadcast indicator is not read correctly for WCN7850 Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 054/104] ARM: dts: rockchip: fix rk3036 hdmi ports node Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 055/104] ARM: dts: imx25/27-eukrea: Fix RTC node name Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 056/104] ARM: dts: imx: Use flash@0,0 pattern Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 057/104] ARM: dts: imx27: Fix sram node Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 058/104] ARM: dts: imx1: " Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 059/104] net: phy: at803x: fix passing the wrong reference for config_intr Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 060/104] ionic: pass opcode to devcmd_wait Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 061/104] ionic: bypass firmware cmds when stuck in reset Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 062/104] block/rnbd-srv: Check for unlikely string overflow Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 063/104] arm64: zynqmp: Move fixed clock to / for kv260 Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 064/104] arm64: zynqmp: Fix clock node name in kv260 cards Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 065/104] selftests/bpf: fix compiler warnings in RELEASE=1 mode Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 066/104] ARM: dts: imx25: Fix the iim compatible string Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 067/104] ARM: dts: imx25/27: Pass timing0 Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 068/104] ARM: dts: imx27-apf27dev: Fix LED name Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 069/104] ARM: dts: imx23-sansa: Use preferred i2c-gpios properties Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 070/104] ARM: dts: imx23/28: Fix the DMA controller node name Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 071/104] scsi: lpfc: Reinitialize an NPIV's VMID data structures after FDISC Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 072/104] scsi: lpfc: Move determination of vmid_flag after VMID reinitialization completes Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 073/104] scsi: hisi_sas: Set .phy_attached before notifing phyup event HISI_PHYE_PHY_UP_PM Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 074/104] ice: fix ICE_AQ_VSI_Q_OPT_RSS_* register values Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 075/104] net: atlantic: eliminate double free in error handling logic Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 076/104] net: dsa: mv88e6xxx: Fix mv88e6352_serdes_get_stats error path Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 077/104] ARM: dts: marvell: Fix some common switch mistakes Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 078/104] ARM64: " Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 079/104] block: prevent an integer overflow in bvec_try_merge_hw_page Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 080/104] md: Whenassemble the array, consult the superblock of the freshest device Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 081/104] cfi: Add CFI_NOSEAL() Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 082/104] arm64: dts: qcom: msm8996: Fix 'in-ports' is a required property Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 083/104] arm64: dts: qcom: msm8998: Fix 'out-ports' " Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 084/104] arm64: dts: qcom: Fix coresight warnings in in-ports and out-ports Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 085/104] ice: fix pre-shifted bit usage Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 086/104] arm64: dts: amlogic: fix format for s4 uart node Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 087/104] wifi: rtl8xxxu: Add additional USB IDs for RTL8192EU devices Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 088/104] wifi: rtw89: coex: Fix wrong Wi-Fi role info and FDDT parameter members Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 089/104] libbpf: Fix NULL pointer dereference in bpf_object__collect_prog_relos Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 090/104] wifi: rtlwifi: add calculate_bit_shift() Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 091/104] wifi: rtlwifi: rtl8723{be,ae}: using calculate_bit_shift() Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 092/104] wifi: cfg80211: free beacon_ies when overridden from hidden BSS Sasha Levin
2024-01-16 19:46 ` [PATCH AUTOSEL 6.6 093/104] Bluetooth: qca: Set both WIDEBAND_SPEECH and LE_STATES quirks for QCA2066 Sasha Levin
2024-01-16 19:47 ` [PATCH AUTOSEL 6.6 094/104] Bluetooth: ISO: Avoid creating child socket if PA sync is terminating Sasha Levin
2024-01-16 19:47 ` [PATCH AUTOSEL 6.6 095/104] Bluetooth: hci_sync: fix BR/EDR wakeup bug Sasha Levin
2024-01-16 19:47 ` [PATCH AUTOSEL 6.6 096/104] Bluetooth: L2CAP: Fix possible multiple reject send Sasha Levin
2024-01-16 19:47 ` [PATCH AUTOSEL 6.6 097/104] net/smc: disable SEID on non-s390 archs where virtual ISM may be used Sasha Levin
2024-01-16 19:47 ` [PATCH AUTOSEL 6.6 098/104] bridge: cfm: fix enum typo in br_cc_ccm_tx_parse Sasha Levin
2024-01-16 19:47 ` [PATCH AUTOSEL 6.6 099/104] arm64: dts: sprd: Add clock reference for pll2 on UMS512 Sasha Levin
2024-01-16 19:47 ` [PATCH AUTOSEL 6.6 100/104] arm64: dts: sprd: Change UMS512 idle-state nodename to match bindings Sasha Levin
2024-01-16 19:47 ` [PATCH AUTOSEL 6.6 101/104] i40e: Fix VF disable behavior to block all traffic Sasha Levin
2024-01-16 19:47 ` [PATCH AUTOSEL 6.6 102/104] octeontx2-af: Fix max NPC MCAM entry check while validating ref_entry Sasha Levin
2024-01-16 19:47 ` [PATCH AUTOSEL 6.6 103/104] net: kcm: fix direct access to bv_len Sasha Levin
2024-01-16 19:47 ` [PATCH AUTOSEL 6.6 104/104] net: dsa: qca8k: put MDIO bus OF node on qca8k_mdio_register() failure Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240116194908.253437-8-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=laoar.shao@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox