From: Shuah Khan <skhan@linuxfoundation.org>
To: Hisam Mehboob <hisamshar@gmail.com>
Cc: kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, Aqib Faruqui <aqibaf@amazon.com>,
shuah@kernel.org, Shuah Khan <skhan@linuxfoundation.org>,
pbonzini@redhat.com, seanjc@google.com
Subject: Re: [PATCH] KVM: selftests: Guard execinfo.h inclusion for non-glibc builds
Date: Wed, 25 Mar 2026 12:03:31 -0600 [thread overview]
Message-ID: <137f63af-a993-4b1c-a9e9-931718a47343@linuxfoundation.org> (raw)
In-Reply-To: <091f264f-21f1-464d-913a-1500643728c7@linuxfoundation.org>
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 <aqibaf@amazon.com>
>> Signed-off-by: Hisam Mehboob <hisamshar@gmail.com>
>> ---
>> 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 <execinfo.h>
>> +#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?
+#ifdef __GLIBC__
#include <execinfo.h>
+#endif
Also check tools/testing/selftests/bpf/test_progs.c - I think backtrace()
stub needs be defined only for the !__GLIBC__ case
thanks,
-- Shuah
next prev parent reply other threads:[~2026-03-25 18:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 0:08 Hisam Mehboob
2026-03-24 18:02 ` Shuah Khan
2026-03-25 18:03 ` Shuah Khan [this message]
2026-03-25 18:47 ` Hisam Mehboob
2026-03-31 23:09 ` Shuah Khan
2026-04-01 14:01 ` Sean Christopherson
2026-04-09 11:53 ` Hisam Mehboob
2026-04-09 15:38 ` [PATCH v2] " Hisam Mehboob
2026-05-19 0:40 ` Sean Christopherson
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=137f63af-a993-4b1c-a9e9-931718a47343@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=aqibaf@amazon.com \
--cc=hisamshar@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=shuah@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
all inboxes | Powered by JetHome®