From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 B163731B837 for ; Wed, 25 Mar 2026 18:47:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774464469; cv=none; b=fCX0tiji5aD7VzLMB1PzeMyMKCXRCdUIyTDL5kS9H48hVd/v7PnzMn2g8vUvc9A+47i7jwclcUxSoItm7ahNC6dTJgndL5hlKXP/Ws+DJxuPvQnfCnYub1DlMLS+Dj/lNqpYwg/WVJk5C1L0vibH77aBIGDti6jL3x8F2WHiwDc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774464469; c=relaxed/simple; bh=4NQg+jm6R4DvQVeWzwiik6zXgZ3a5nsPLM2cLEdlp7Y=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Vxs0IiAtcQ8MdZI3eSzVKieaL5tMBuo4IcEseWz5qmd64GXNoZyA4Tj8T7ohGwL9oIK6n7F8yQqU6osOR4OUuDmzUxTnmrUqvs6f1wcjf4GU3cPgufIbyFNvvqjzhDsleiex2KJ7FB7sAAe9PQt/AeWaFAFexsH4RyFXADQ6p8U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bn50l2Kt; arc=none smtp.client-ip=209.85.221.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bn50l2Kt" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-439bc14dcf4so1000263f8f.1 for ; Wed, 25 Mar 2026 11:47:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774464466; x=1775069266; 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=dAkZBM8A9CwSt7dU1hFM05HktIG4hf4BJ0KGo2YHnpU=; b=bn50l2KtxDTKVi/wPLZTXS5rbN3vS01t6Yp0w2/HAj/LFggpadRbHQV+HZO1wGy/ZS vmElsBewL4L5ugM2DyuFytFUeeOrOQlEPuguLk2wjthHGnRUq9lXH3IU52xCQoM3+xV/ EeNsNuYMKJ6j9+78y3MYLJ/F+5SWSKc3Jqmz7QYA6L0U8pRGSD8q3tSPn+xo+OR1zJqZ 3O4qq6C/kF9XuHOR0oDXsxnmsZbTItPG4ry2XkDfP3ikGeaqQ0X3udnWYPQtf5N9hKdb pe7x/ypTrvmv8afx8w3tbggiEu4HVpa+F5+zQt9uu9IxJQ4EdNXVthSF0+ncObz33/ce o/xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774464466; x=1775069266; 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=dAkZBM8A9CwSt7dU1hFM05HktIG4hf4BJ0KGo2YHnpU=; b=NEmzguFfrIifmAX+DtjD8GRkI4sIxO4V61IjWeuT5a8wbP+A15fnYeZmY00CE6KVFs 1aHQUwC8YZkHtfB/UXK0Fu3lk7J01b3KsRKOZpJNOOeKl+r6UImBMjOnQpEl7UQdR2Fg gPrOEAiTLHrYlhKQEDPd/nVxNtU1KfDSnasL1HfZQjLiNqBvabd4r5jbJYElTRJIrzQY RCRCzfkRSIxoEdkkG4aQrbawAZ5pZYmY95yQncn0FizhwNrZugmi/eUmbRcDnclmqmu/ 6WDanIofw4ofKA7xXgVrlUSKJ4B1UJSt0NLnSqlBrrN/H7Q6iSwkfFVTe6PX4xLDu5Uy qatw== X-Forwarded-Encrypted: i=1; AJvYcCX+RkV4EopW5TOkIv8UnWHbFfyzWlB2afxHWkMEQI2L1If6XOgBGdAXefvlMHmba+RQg6rwlEmZWAHeDZY=@vger.kernel.org X-Gm-Message-State: AOJu0YwU12BLU80TyM7ryBg0HNfPZLL6d3dk6kWrbXRFtPX7Ey+YJFHY 2vSOP5z57OOEVK/s7JIk6yPCNNUn+dneAlVdRbSbXWVjgKs82N/qeZZV X-Gm-Gg: ATEYQzyh+8r/Fg1KQp2a5do6eOOwLQaHL8xsSPsx9zRyQGGzql2AnwRfKu+8L8oBPHK izFMzDFJ51+cqsSVeChzcR//BItV9XoAAyPd68a6ZfTIteTHWv5YwwS4eZPISYE+XaHrh+17dkf MbxJyVT0f2Y6DaMlPzX0pORF6vewjysPu9JHQOEyrq384yoAtplvRBHRiVy3S8oR/HK9e0sXGyu 212xIBtABnriFonFXKFtHBu0BuP3tG8qO4MdEmSAPyiz/nAqCd1pS1yIqjTbrEMZiOxY/jgohcD WFJzmFR3qLWiKqMJqkcuxS27jVJcN5upYt2awo7BKqer7ewubyJnyIo6FMKJYW7ncfPbtm8Flex uQxQvikwWYc6ttYugfUUu+ebJ2i7JWLSJGl3PE31ETOF6izAjpFo5ioIMeHS7phYeBQlwPns6Cy mrMQ+tXZZE73CdwYZq7g+vU93HZ5iGon+Eme7Uf6OvGeYOWnXPbOhLjxjTYoL2ovsfXxlS4+tjj CJtm14= X-Received: by 2002:a5d:64ed:0:b0:43b:46b0:fc3d with SMTP id ffacd0b85a97d-43b80526457mr12653785f8f.5.1774464465866; Wed, 25 Mar 2026 11:47:45 -0700 (PDT) Received: from ?IPV6:2402:ad80:11e:183:2828:2ade:18de:c75f? ([2402:ad80:11e:183:2828:2ade:18de:c75f]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43b919df7dcsm1967329f8f.27.2026.03.25.11.47.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 Mar 2026 11:47:45 -0700 (PDT) Message-ID: Date: Wed, 25 Mar 2026 23:47:41 +0500 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: Shuah Khan 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, hisamshar@gmail.com 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: Hisam Mehboob In-Reply-To: <137f63af-a993-4b1c-a9e9-931718a47343@linuxfoundation.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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.