From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3EE7242848A for ; Thu, 30 Apr 2026 14:09:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777558161; cv=none; b=R6AYaRweAX0KkkM9GmUkpHe71OaiK0WoB7EXsdyM9pJjXRP0wjfD0RCozGkfbwrz7IZCJVCynqftYK7LhRT9rhxOPsWwBp7IBzknabo+EELDq8sek2Dff5KwWbOFqPy0+UIp1mj0P7AhtwG1DpcWAv+30M3nQ84bS4mWs+BELxs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777558161; c=relaxed/simple; bh=1qjZmmrF3I85CBh0a1JI7hHwk45mME8Vo8LYhHDlh9E=; h=Mime-Version:Content-Type:Date:Message-Id:From:Subject:Cc:To: References:In-Reply-To; b=LKNSxI9osr43Lscqcv7YvjMNR6+1SNsQH60v6rop5O3g03Ai+C6+Mu3p47r+pNMqpVZc5/FWZM030/PokuRNC1eB1DjAYn2SHTWz1dcCs6CdaJru2xNcfY1mL46a0Xt7a/CuRABzu6VrzlpfDM7pIBpO+6tDCUqoSm51/EmXcEE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=UXyVrVnn; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="UXyVrVnn" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-48a7fe4f40bso10047705e9.0 for ; Thu, 30 Apr 2026 07:09:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1777558159; x=1778162959; darn=vger.kernel.org; h=in-reply-to:references:to:cc:subject:from:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Z9EL5be0hYDO4pBoXs2Ff2eHS7rc0zYolDGqpnGuRlY=; b=UXyVrVnncE8QNLzp9VL/vLZwsewI6gKBwFRNrow35ZaxLdtajYxZ1f8CYLX6ut+YDR 2YuzJBOofJfhSM9AbhJp6ovkdFnN7dA51YS5Ig/3cLC2Pi3j3PJq6VTsTSfXD+ZDkK/R vD8d1eO/zeHvUh7wLjYfgJl1uP/XU1+Qe/06vI3lPgH0q4UNk7R5925V32wHz8ea/tkq 6gRY/4e4uL6MnUph2VzXS3+j/ACQe8AMPSCuNTKEElyr1gizBAh5Vb2DgKLw/FjCzn2c QV0syrnlFJI2dFx1onRKapzQ+UVL6mz2ksh5Fut3bsplzBo9674Jqp4A0rrbSLUtaUrS rHMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777558159; x=1778162959; h=in-reply-to:references:to:cc:subject:from:message-id:date :content-transfer-encoding:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Z9EL5be0hYDO4pBoXs2Ff2eHS7rc0zYolDGqpnGuRlY=; b=YjNtDAlqQU/a9+JeK24+NuHQZQQGFysRNlLPI9W3NSWfdPg5/rOYsZXQ4oTQKnnCC2 ggNw4hjddvVfi6oJsbLkUzClKE1wCcVmc7bltQHVQxpEheSkWczoZUGwXKzzHpdBZr4q zZQWnEXPH3cjSAPVWjEfER4POGRN8eA0RNG00OTa7YvDGWkgjC/lqnJwoztjdKKsCZXp G+2Qoqhw1M8pyhtYjgF9USI23+HXnE6GyLmiFzRLBW/Tulh8W+7sfXJ//dOq/fQZQAre kuDYIDCsUSs+nTFvMyziMXfWh0MXndx2lncWnoMOGqai5sbACW5gzPVfrCoXqahcKLgt kqKA== X-Forwarded-Encrypted: i=1; AFNElJ/j3Zqdr8ahd/Z52Xv8yiRvIuzwwreuPA9zWQqEnV9lRJbChl++Gs379vxohAuNmqPk4PrEnyrmLIJ6bkU=@vger.kernel.org X-Gm-Message-State: AOJu0YxyAa3ZsKGos7fN4Mnv9oMVEQglgTmXYCvjKp5HwXlMxHbsahoZ 7IqUUYGUwrDA+UaiY91lh/YrUjPntw7RF8EY9vtGK5hkbjhZjsYaUOqTZHlmEdnNYT4= X-Gm-Gg: AeBDievfgev5tKAyLgoyeELKnzBBn+S0PBMUVoiRPJyCZeoqao9bryXcwRDvjrPKn6r kSitiAZnAqgw3yxEd16muwGWlErLvxLgBEewEGlCx+z5ng/WHBhfb8OUQtG6LfhzBm/6otyMQAD QPRZ2hwiUXtzBZerf0F+jTclYKCTncu312F/0ERAswEphqjXJo/dYnxE1EB00gbtiiZjekMO5V1 UnTazXrInrrIbPbsoVJX2xM6bOWiKYIpS/w/Ipj8c+cY4qbnvV8kopG4be6lfFeFbDbhiSPaCMG 3I07EoC9NenoMpPTfp/GVNDrc+nX6fsf+9yKJnCYSOQIVUxSeyJB209SkNJSR+q8wvNbBlVxZcs YH3iKHd61hBDDRAVSyPXlAssDFgZmxuLU/jXEcZzT/jLDgWXMw1Zz4ZBCjzrh4o0faqY/aSzKT8 xmY/aVptaqM8uN4ANzH4D7U1g= X-Received: by 2002:a05:600c:8b22:b0:485:3a03:ceca with SMTP id 5b1f17b1804b1-48a844582c3mr54963025e9.23.1777558158451; Thu, 30 Apr 2026 07:09:18 -0700 (PDT) Received: from localhost ([2804:7f0:b765:105d:2ecf:67ff:fe81:9da0]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-12de31ab65fsm7755291c88.0.2026.04.30.07.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 07:09:16 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 30 Apr 2026 11:09:14 -0300 Message-Id: From: =?utf-8?b?UmljYXJkbyBCLiBNYXJsacOocmU=?= Subject: Re: [PATCH bpf-next v10 02/11] selftests/bpf: Fix test_kmods KDIR to honor O= and distro kernels Cc: , , , , , , , To: , , , , , , , , , , , , , , , X-Mailer: aerc 0.21.0-120-g22b95d38161f References: <20260430-selftests-bpf_misconfig-v10-2-cd302a31af16@suse.com> In-Reply-To: On Thu Apr 30, 2026 at 10:30 AM -03, bot+bpf-ci wrote: >> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selfte= sts/bpf/Makefile >> index 6094fe99b5f6..cc6ee7a2df93 100644 >> --- a/tools/testing/selftests/bpf/Makefile >> +++ b/tools/testing/selftests/bpf/Makefile > > [ ... ] > >> diff --git a/tools/testing/selftests/bpf/test_kmods/Makefile b/tools/tes= ting/selftests/bpf/test_kmods/Makefile >> index 63c4d3f6a12f..031c7454ce65 100644 >> --- a/tools/testing/selftests/bpf/test_kmods/Makefile >> +++ b/tools/testing/selftests/bpf/test_kmods/Makefile >> @@ -1,5 +1,16 @@ >> TEST_KMOD_DIR :=3D $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIS= T))))) >> -KDIR ?=3D $(abspath $(TEST_KMOD_DIR)/../../../../..) >> +SRCTREE_KDIR :=3D $(abspath $(TEST_KMOD_DIR)/../../../../..) >> +# Honor O=3D/KBUILD_OUTPUT only if they point at a prepared kernel buil= d >> +# directory (one containing Module.symvers); otherwise treat the value = as a >> +# selftests-only output directory and fall back to in-tree or distro he= aders. >> +# The parent bpf/Makefile resolves O=3D/KBUILD_OUTPUT to absolute paths= before >> +# invoking this sub-make so relative paths still anchor to the user's >> +# invocation directory. >> +KMOD_O :=3D $(or $(O),$(KBUILD_OUTPUT)) >> +KMOD_O_VALID :=3D $(if $(KMOD_O),$(if $(wildcard $(KMOD_O)/Module.symve= rs),$(KMOD_O))) >> +KDIR ?=3D $(if $(KMOD_O_VALID),$(SRCTREE_KDIR), \ >> + $(if $(wildcard $(SRCTREE_KDIR)/Module.symvers),$(SRCTREE_KDIR), \ >> + /lib/modules/$(shell uname -r)/build)) > > Will falling back to the host kernel headers cause compilation errors > when building in-tree test modules like bpf_testmod? > > Since bpf_testmod relies heavily on internal BPF structures, > experimental macros, and kfuncs that change frequently between kernel > releases, compiling it against /lib/modules/$(uname -r)/build on a > system where the running kernel does not exactly match the upstream > source tree will likely fail. This is only the fallback case (inspired by livepatch collection which uses this KDIR as default), the targeted invocation for this series is something like: make -C /lib/modules/$(uname -r)/source/tools/testing/selftests \ O=3D/lib/modules/$(uname -r)/build SKIP_TARGETS=3D TARGETS=3Dbpf \ BPF_STRICT_BUILD=3D0 The usual in-tree way of building vmlinux and then the selftests strictly would keep the same current behavior. > > If the host headers are present, the permissive skip check further down > in the file will pass since the directory exists. Because the > compilation failure is not ignored by the parent bpf/Makefile, won't > this abort the entire BPF selftests build with confusing C compilation > errors instead of silently skipping the unconfigured kernel tree? > > Should in-tree test modules avoid falling back to host distro headers to > prevent these version mismatches? Without the fallback, a user running from a tree matched to their installed kernel but without a prior in-tree build would lose bpf_testmod. Small niche, but the workaround (O=3D/lib/modules/$(uname -r)/build) might not be obvious. The fallback covers them at zero cost to everyone else, so I think it should stay. > > This was raised by Sashiko AI reviewer in v9: > > https://lore.kernel.org/bpf/20260429194107.806B7C19425@smtp.kernel.or= g/ > > The issue was acknowledged in v9 but has not been addressed in v10. > > [ ... ] > > > --- > AI reviewed your patch. Please fix the bug or email reply why it's not a = bug. > See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/READM= E.md > > CI run summary: https://github.com/kernel-patches/bpf/actions/runs/251670= 06036