From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (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 D355535AC12 for ; Thu, 12 Mar 2026 14:07:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773324476; cv=none; b=Apsry6BrN1YCItr7gJos5gSUsdf7HUOnD5WZWFDx9FQVjl6OlI9Xbhfa0lxDsHtVg88QY4tdl76R9uwb7vj6aN3lCJ4BZCJP6edULYl9kM760hVNM2Nhag+Azx/VR0cI00GCFQJ9zbptG2Acwpg/RazuWkePU35jGMhiN+JLwFU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773324476; c=relaxed/simple; bh=je2Su01mUc5JDXpVVT4CNHVYbw70OhSPnxJmGcuocjc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gB714/ivP/eaHrOvRkVXmDzrYnlI579koUf29OU4lZCzfH7LaqSHzwLJeYxyHVA+E6Md7gJx6ku7vWfWIV1oXPHm8XapdKfM+Dg1MsWxMZgP5I5s8JKEjX8AI2qxdsJrDKFQbOBn4skRbNjkzrP/vjesXE+dun8phbuZ6XKrRvY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=sN1pHa05; arc=none smtp.client-ip=209.85.221.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="sN1pHa05" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-439b9b1900bso722815f8f.1 for ; Thu, 12 Mar 2026 07:07:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1773324471; x=1773929271; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=viC1gPLlOGctSWu83HWjGEsXF70NJAe1D+sqpq58byY=; b=sN1pHa05bancSNtzCRPbfa3qfyBL3zKcUSAefgMNrnrmrxpN980dACzQt9a2Ss4Ys5 ANMZzzllyr6V4EDXBP+OVZc75YbKo6d4J+Skl2tAD1hWYNswN+bYml/Nimyu7pC8NMdv jtoIefLPQwLcYXbVvne2k91TI/oH1cv3oSW8SB1pXO0YqwEV+2XPpCmGi/Gof4m4n1ni ucB5miiY6LWdOvF9oFFmiyiLVTzROJdFvsScfibdIyipVNufR54hnE+CdNA5ivf+KLX/ C/ECDrxxXP2mtdqaQ7KvwGe+kkYzBQ+0bNqBCfHoSwMar5uLb1rlMkJoiipJCPXrHals g38w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773324471; x=1773929271; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=viC1gPLlOGctSWu83HWjGEsXF70NJAe1D+sqpq58byY=; b=Y8U2vYYbBf1LxT/zcmPNT5zGWs8Ecbbh3fr/gKErv2ohPdm7hEhze88/KEpDpT1Lnq y4MHCb6fZXUGJH6DOydl9LxtuPXlC4qnm5//ovOVs9clEBPtOiBrfv6TJNslSd9qPOMf eX/GMcV/mv8Mnabm6hq3iOW3trYFOjjVmev817Sai5Spc0K+NMbtvEQtl9xzQ7AYlkCU 2IZhc+MN+1m/BOttQRFVxb0Ij48v5NPvFf4/wCG9435QBWGe361O1PR8fRWABsZ/sbl6 x/O9UydQgm/fpSpDEnIsh1EQuTO7UlkU/gRYWcgH94deNdJZyFURaG7YsvNA7yASPOke WnxA== X-Forwarded-Encrypted: i=1; AJvYcCXB0q4W5yMEbXM3fEBJ2OvbJKE72DhETBgb2ocbnQInw8I/J6fPA6NAaDyyIeEDg9QfiAWLC6TbrC4Z9/E=@vger.kernel.org X-Gm-Message-State: AOJu0Yx/TXdKLCS65p9dUWBwlG3V1maq/RsPVUPsW6yWAlL2giulu/9c HzKbCKuG2X+M9feTjnp9Oc9ZVEDuLby8+Mh21cSYna2xaftzmnOcJjWgJhw3Ti6qzg== X-Gm-Gg: ATEYQzyt5F3fiL1nQNb/v9apUUiwoiK59kij9MH5QOWE8h/N2EYlMzm49clUB9MYor2 3va/E5ABRQ+CsL88C5Ms/c4m1+4LXD8p9UlSNMdAr7himoDcIPbBiXYBkDibDco1hL5T5QVrotM 3Vvwuo3NJjko77BN+pKQskdGf34cSUdCGF9QsWow7deeoAh+IP/B9oP23k9iUAXEvm7woyCoCiL STtBwGedqfkLqcGMk//+TXU29/WCvnAVw+GIgfgQX/FngR7W9U2y6WNkY24SeKIEMSMZwjxyE2+ Jx278jJRik1LYYaeUb5yh1CowFXf3QD1MXJgQhafG6/ppdcX7TW8ujBFwoRiUIutltLyuWyNj+T B0qKzPinDglXnkJeVa4gqKzfb9PviTlSnH3eRaYZLFUMGfdDe6C1yS4ZUVpVmInYukHkLTxufw7 bUAZL8PoVCU1rqyW5ntMsDwv6uPPllO51NvNCqaO0pvm4GxifEzjmcjx1CdGHV79CzyM3O1z0+Q 9TeYw== X-Received: by 2002:a05:6000:2012:b0:439:cb20:f30c with SMTP id ffacd0b85a97d-439f81c77c9mr13119179f8f.23.1773324470601; Thu, 12 Mar 2026 07:07:50 -0700 (PDT) Received: from google.com (198.115.140.34.bc.googleusercontent.com. [34.140.115.198]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439fe1a76e5sm8108613f8f.12.2026.03.12.07.07.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2026 07:07:50 -0700 (PDT) Date: Thu, 12 Mar 2026 14:07:46 +0000 From: Vincent Donnefort To: Nathan Chancellor Cc: rostedt@goodmis.org, mhiramat@kernel.org, mathieu.desnoyers@efficios.com, linux-trace-kernel@vger.kernel.org, maz@kernel.org, oliver.upton@linux.dev, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, jstultz@google.com, qperret@google.com, will@kernel.org, aneesh.kumar@kernel.org, kernel-team@android.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v14 18/30] tracing: Check for undefined symbols in simple_ring_buffer Message-ID: References: <20260309162516.2623589-1-vdonnefort@google.com> <20260309162516.2623589-19-vdonnefort@google.com> <20260311221816.GA316631@ax162> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Mar 12, 2026 at 08:55:14AM +0000, Vincent Donnefort wrote: > On Wed, Mar 11, 2026 at 03:18:16PM -0700, Nathan Chancellor wrote: > > Hi Vincent, > > > > On Mon, Mar 09, 2026 at 04:25:04PM +0000, Vincent Donnefort wrote: > > > The simple_ring_buffer implementation must remain simple enough to be > > > used by the pKVM hypervisor. Prevent the object build if unresolved > > > symbols are found. > > > > > > Reviewed-by: Steven Rostedt (Google) > > > Signed-off-by: Vincent Donnefort > > > > > > diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile > > > index d106beca8d7f..3182e1bc1cf7 100644 > > > --- a/kernel/trace/Makefile > > > +++ b/kernel/trace/Makefile > > > @@ -132,4 +132,20 @@ obj-$(CONFIG_TRACE_REMOTE) += trace_remote.o > > > obj-$(CONFIG_SIMPLE_RING_BUFFER) += simple_ring_buffer.o > > > obj-$(CONFIG_TRACE_REMOTE_TEST) += remote_test.o > > > > > > +# > > > +# simple_ring_buffer is used by the pKVM hypervisor which does not have access > > > +# to all kernel symbols. Fail the build if forbidden symbols are found. > > > +# > > > +UNDEFINED_ALLOWLIST := memset alt_cb_patch_nops __x86 __ubsan __asan __kasan __gcov __aeabi_unwind > > > +UNDEFINED_ALLOWLIST += __stack_chk_fail stackleak_track_stack __ref_stack __sanitizer > > > +UNDEFINED_ALLOWLIST := $(addprefix -e , $(UNDEFINED_ALLOWLIST)) > > > + > > > +quiet_cmd_check_undefined = NM $< > > > + cmd_check_undefined = test -z "`$(NM) -u $< | grep -v $(UNDEFINED_ALLOWLIST)`" > > > > This check triggers when building allmodconfig targeting arm, arm64, > > powerpc, and x86_64 (at least, I did not test more at the moment) with > > clang. If this is a hard failure, this really needs to print something > > out to the developer/user to help them debug off the bat, versus having > > to manually dig the $(NM) command out from the .cmd file or V=1. I came > > up with > > > > diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile > > index 3182e1bc1cf7..c725b06876bc 100644 > > --- a/kernel/trace/Makefile > > +++ b/kernel/trace/Makefile > > @@ -141,7 +141,13 @@ UNDEFINED_ALLOWLIST += __stack_chk_fail stackleak_track_stack __ref_stack __sani > > UNDEFINED_ALLOWLIST := $(addprefix -e , $(UNDEFINED_ALLOWLIST)) > > > > quiet_cmd_check_undefined = NM $< > > - cmd_check_undefined = test -z "`$(NM) -u $< | grep -v $(UNDEFINED_ALLOWLIST)`" > > + cmd_check_undefined = \ > > + undefsyms=$$($(NM) -u $< | grep -v $(UNDEFINED_ALLOWLIST) || true); \ > > + if [ -n "$$undefsyms" ]; then \ > > + echo "Unexpected symbols in $<:" >&2; \ > > + echo "$$undefsyms" >&2; \ > > + false; \ > > + fi > > > > $(obj)/%.o.checked: $(obj)/%.o FORCE > > $(call if_changed,check_undefined) > > -- > > > > which prints > > > > Unexpected symbols in kernel/trace/simple_ring_buffer.o: > > U llvm_gcda_emit_arcs > > U llvm_gcda_emit_function > > U llvm_gcda_end_file > > U llvm_gcda_start_file > > U llvm_gcda_summary_info > > U llvm_gcov_init > > > > for arm64, which makes sense since these are LLVM specific GCOV symbols, > > so they should probably get the same treatment as the other ones: > > > > diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile > > index c725b06876bc..d464e3aa5bdd 100644 > > --- a/kernel/trace/Makefile > > +++ b/kernel/trace/Makefile > > @@ -136,8 +136,8 @@ obj-$(CONFIG_TRACE_REMOTE_TEST) += remote_test.o > > # simple_ring_buffer is used by the pKVM hypervisor which does not have access > > # to all kernel symbols. Fail the build if forbidden symbols are found. > > # > > -UNDEFINED_ALLOWLIST := memset alt_cb_patch_nops __x86 __ubsan __asan __kasan __gcov __aeabi_unwind > > -UNDEFINED_ALLOWLIST += __stack_chk_fail stackleak_track_stack __ref_stack __sanitizer > > +UNDEFINED_ALLOWLIST := memset alt_cb_patch_nops __x86 __ubsan __asan __kasan __gcov llvm_gcda llvm_gcov > > +UNDEFINED_ALLOWLIST += __aeabi_unwind __stack_chk_fail stackleak_track_stack __ref_stack __sanitizer > > UNDEFINED_ALLOWLIST := $(addprefix -e , $(UNDEFINED_ALLOWLIST)) > > > > quiet_cmd_check_undefined = NM $< > > -- > > > > For x86_64, I see > > > > Unexpected symbols in kernel/trace/simple_ring_buffer.o: > > U __clear_pages_unrolled > > U __memmove > > U copy_page > > > > which comes from the use of KCFI_ADDRESSABLE(), since allmodconfig has > > CONFIG_CFI=y. > > > > For powerpc (with both clang and GCC), I see > > > > Unexpected symbols in kernel/trace/simple_ring_buffer.o: > > U .TOC. > > > > For arm (with both clang and GCC), I see > > > > Unexpected symbols in kernel/trace/simple_ring_buffer.o: > > U __stack_chk_guard > > U warn_slowpath_fmt > > > > Presumably adding all of those should be fine as well? > > > > diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile > > index d464e3aa5bdd..4f120cb8c79c 100644 > > --- a/kernel/trace/Makefile > > +++ b/kernel/trace/Makefile > > @@ -137,7 +137,8 @@ obj-$(CONFIG_TRACE_REMOTE_TEST) += remote_test.o > > # to all kernel symbols. Fail the build if forbidden symbols are found. > > # > > UNDEFINED_ALLOWLIST := memset alt_cb_patch_nops __x86 __ubsan __asan __kasan __gcov llvm_gcda llvm_gcov > > -UNDEFINED_ALLOWLIST += __aeabi_unwind __stack_chk_fail stackleak_track_stack __ref_stack __sanitizer > > +UNDEFINED_ALLOWLIST += __aeabi_unwind __stack_chk_fail __stack_chk_guard stackleak_track_stack __ref_stack __sanitizer > > +UNDEFINED_ALLOWLIST += \.TOC\. __clear_pages_unrolled __memmove copy_page warn_slowpath_fmt > > UNDEFINED_ALLOWLIST := $(addprefix -e , $(UNDEFINED_ALLOWLIST)) > > > > quiet_cmd_check_undefined = NM $< > > -- > > > > I don't mind sending a series for these, I just wanted to make sure I > > was reasoning about everything correctly. > > Yes this is all fine. If you have something already, please send it. Meanwhile, I'll try > something a bit more durable. > > Thanks, > Vincent In the end to unblock linux-next I have already sent an updated list of symbols. However feel free to send the logging bit, that is surely useful. > > > > > Cheers, > > Nathan