From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f44.google.com (mail-oo1-f44.google.com [209.85.161.44]) (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 272F72DB794 for ; Tue, 31 Mar 2026 23:09:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774998588; cv=none; b=hnHnF3S3yF8yRvysGk+vP/QBoaK1RPWh6eNwNnYRwe9R3qRvTf87zAd+X7JSYuow0lydDMZ8fwfoH2yLOwx/6XDJdPaXP6IpfJ8LrmErwP7zafRwpN3Q1SAV3biUex9RUiIa+xrGsR1+uBJy00rFI9fCebUuOs0DHwSxrCOwJ9s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774998588; c=relaxed/simple; bh=LcwrEE/Su6MqZg1BVVUXTgS+hDQtivNXll3DuxETR5E=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=KT8mNqb4e7N7j4GsTw3VymSg5ACqKNOWY4RLhCiH6vdwutsmVFx92KPwT07l/nLU9Ewz60PW+PilvoJOoS6Uauc6erzF00DM4AMSbSeK1xwJWoBsZ4O8ZIDKUOijEIYjjyEneAqwkjNxNi+1w8xMa8sW3TB2yw0LQL0i3PCd5h0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=WpLq93JW; arc=none smtp.client-ip=209.85.161.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="WpLq93JW" Received: by mail-oo1-f44.google.com with SMTP id 006d021491bc7-67cf1bfc73eso2170266eaf.2 for ; Tue, 31 Mar 2026 16:09:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1774998585; x=1775603385; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=cAxWk+l9wnHigA07/m15Z7FRvAHJCuXF+wjFvuQTo7w=; b=WpLq93JW1LhcDqYBATrkbc/fP5BwgszTYjHTA3FXUN1LOsuQJot7TD0HRvUVli1J/S vz89CzQT7EHzaHrVzxI59BFstRbAp3sdQjjqhvLjzee16e344e115X5WWBURKvbLTYlV N3Ju1z+DHTPVC47nnOttAyrL6Nb28EyoeVawU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774998585; x=1775603385; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cAxWk+l9wnHigA07/m15Z7FRvAHJCuXF+wjFvuQTo7w=; b=P35dA0g3Nca122p7qQfgjALHPt4toQLu+7Y+7oq0NNZ6hn0c7Lpaxcwk5Xqq1tfdWA Z3wPsmrxZoVfcD2xbuxPGpI3YPGhiyppnP9qi0XobLUYt2Z7p/bI74otBQ3R/VZ2sE0X D2QJuMyAfsFllRg5NT3AKq46N8MC96WHB4GBcvlQbKqw77bSZlLlLzUGFWl8JWsy1Nsz F8PMR4rq1bwiNURAAF/0P4sNqsTDQFzaLYUZquN0Yn6AOC0TC2OhY3jlVsGyC6Lm6iiL d7xOftZ3awyFyIe4mFsXRiH2XCz3CBUu8cOglFig2sr/5MOYfHBOYqRWcYyqDyjjJy6m uDxA== X-Forwarded-Encrypted: i=1; AJvYcCUVf718qX6aSdsw43JujBlUIeOiS3U/liXAKp5NLoY68UjTWw/2iyzw/DaRzR/jC9mAuPaSSQegmZM16zw=@vger.kernel.org X-Gm-Message-State: AOJu0YyxvVMoQ2RXbmP8p9S/S7M1etfcOoo50NeUFPIzBbVDKn0LpreX p/m1WnwExZSCxF+sXmbA7nlmueuICRI5zcztQf6IbG1nezCtAiRv5uKhi3EZAR9Xq+E= X-Gm-Gg: ATEYQzxKt8ZviqWmiWwxejsvegE79NYGnxJxBwxhviWzxrEg0M3HZRe8quHJrIn5ZQl oaeaAkic07PmkZYIYYkvQ7Ejdt8eeIdKjaQn0SLtqUE5lyd4My8vTnZ6bhttxueyrK1DLiGby5f qLSMe5Xz+E9GZAcw6MFDzXD7Am4q5Y3NMw1oeP+t20h5BeUdTB1lleOUn1XLMm8IwnBFpybp5rI I8ETweVjSVgD5xETotsBAtCnkijCq8BBCrVzhpXkFzTdDRJyUMOAMPLLHquJyrOr67lPf/soXa8 +z4OvgQR5joog/crgn8t1IfjRajj7BGtmB+DC3rS0fWtUApsxgol1hR+w55tJZj/veyNKnN+0Og z0ITtT2UO8S4Hm0aI427cQz0VBTm+6d7wg9xr0w9IjUEVnehMqyV+YFK0UXyq72F7fGPyLBdsQB xcpVFSIBs8TTChzjczLNnHM/RdBpHNHtEqeb4= X-Received: by 2002:a05:6820:4c12:b0:67e:160c:369b with SMTP id 006d021491bc7-67fabcd99b7mr657522eaf.49.1774998585004; Tue, 31 Mar 2026 16:09:45 -0700 (PDT) Received: from [192.168.1.14] ([38.175.187.108]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-67e231ea41dsm7828492eaf.15.2026.03.31.16.09.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 31 Mar 2026 16:09:44 -0700 (PDT) Message-ID: <4334432d-982e-4450-9281-de739c25ebfd@linuxfoundation.org> Date: Tue, 31 Mar 2026 17:09:43 -0600 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] KVM: selftests: Guard execinfo.h inclusion for non-glibc builds To: Hisam Mehboob Cc: kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Aqib Faruqui , shuah@kernel.org, pbonzini@redhat.com, seanjc@google.com, Shuah Khan References: <20260319000842.1213426-2-hisamshar@gmail.com> <091f264f-21f1-464d-913a-1500643728c7@linuxfoundation.org> <137f63af-a993-4b1c-a9e9-931718a47343@linuxfoundation.org> Content-Language: en-US From: Shuah Khan In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 3/25/26 12:47, Hisam Mehboob wrote: > On 3/25/26 23:03, Shuah Khan wrote: >> On 3/24/26 12:02, Shuah Khan wrote: >>> On 3/18/26 18:08, Hisam Mehboob wrote: >>>> The backtrace() function and execinfo.h are GNU extensions available >>>> in glibc but not in non-glibc C libraries such as musl. Building KVM >>>> selftests with musl-gcc fails with: >>>> >>>>    lib/assert.c:9:10: fatal error: execinfo.h: No such file or directory >>>> >>>> Guard the inclusion of execinfo.h under #ifdef __GLIBC__, and wrap >>>> all backtrace() usage under the same guard with a fallback message >>>> for non-glibc builds indicating that stack traces are not available. >>>> >>>> Unlike the approach of adding a weak stub for backtrace(), this >>>> explicitly handles the non-glibc case rather than silently providing >>>> an empty implementation. >>>> >>>> Link: https://lore.kernel.org/kvm/20250829142556.72577-7- aqibaf@amazon.com/ >>>> >>>> Suggested-by: Aqib Faruqui >>>> Signed-off-by: Hisam Mehboob >>>> --- >>>>   tools/testing/selftests/kvm/lib/assert.c | 7 +++++++ >>>>   1 file changed, 7 insertions(+) >>>> >>>> diff --git a/tools/testing/selftests/kvm/lib/assert.c b/tools/ testing/selftests/kvm/lib/assert.c >>>> index b49690658c60..3442b80c37c1 100644 >>>> --- a/tools/testing/selftests/kvm/lib/assert.c >>>> +++ b/tools/testing/selftests/kvm/lib/assert.c >>>> @@ -6,7 +6,9 @@ >>>>    */ >>>>   #include "test_util.h" >>>> +#ifdef __GLIBC__ >>>>   #include >>>> +#endif >>> > Is __GLIBC__ defined in musl-gcc? Looks like that is the case with the >>> error? >> >> If __GLIBC__ isn't there you shouldn't see this error because the include >> is in - this error doesn't make sense if __GLIBC__ isn't defined. What >> am I missing? >> > > To clarify the compiler error you mentioned: the error log in the commit message shows the failure that occurs before this patch is applied. Because musl-gcc doesn't define __GLIBC__, the original unconditional inclusion causes the build to fail. The #ifdef in my patch was intended to fix that exact failure. > >> +#ifdef __GLIBC__ >>   #include >> +#endif >> >> Also check tools/testing/selftests/bpf/test_progs.c - I think backtrace() >> stub needs be defined only for the !__GLIBC__ case >> > > Looking at how bpf/test_progs.c handles it, I agree the weak stub approach is much cleaner. I will implement it so that it still prints an explicit warning message when a trace is unavailable. > > If you are okay with this, I will move forward with a v2 patch. > Ultimately kvm maintainers make the call - send v2 patch thanks, -- Shuah