Hi Arnout, On Tue, Dec 9, 2025 at 3:37 AM Arnout Engelen <[email protected]> wrote: > > Hello Aaron, > > On Tue, Dec 9, 2025, at 02:56, Aaron Merey wrote: > > On Fri, Dec 5, 2025 at 9:53 AM Arnout Engelen <[email protected]> wrote: > > > > Previously, the 'second' test would test the `RESOLVE_IN_ROOT` feature > > when the current libc supports it, even when the currently running > > kernel did not yet support it. > > > > Signed-off-by: Arnout Engelen <[email protected]> > > --- > > tests/run-sysroot.sh | 13 +++++++++---- > > 1 file changed, 9 insertions(+), 4 deletions(-) > > > > diff --git a/tests/run-sysroot.sh b/tests/run-sysroot.sh > > index fe302446..d2041e8a 100755 > > --- a/tests/run-sysroot.sh > > +++ b/tests/run-sysroot.sh > > @@ -46,10 +46,14 @@ TID 431185: > > #8 0x0000aaaae56127f0 _start > > EOF > > > > -HAVE_OPENAT2=$(grep '^#define HAVE_OPENAT2_RESOLVE_IN_ROOT' \ > > - ${abs_builddir}/../config.h | awk '{print $3}') > > +libc_has_openat2_resolve_in_root() { > > + grep '^#define HAVE_OPENAT2_RESOLVE_IN_ROOT' ${abs_builddir}/../config.h > > | awk '{print $3}' > > +} > > +kernel_has_openat2_resolve_in_root() { > > + printf "%s\n%s" "5.6.0" "$(uname -r)" | sort -V -C > > +} > > > > -if [[ "$HAVE_OPENAT2" = 1 ]]; then > > +if libc_has_openat2_resolve_in_root && kernel_has_openat2_resolve_in_root; > > then > > # Change the layout of files in sysroot to test symlink escape scenario > > rm -f "${tmpdir}/sysroot/bin" > > mkdir "${tmpdir}/sysroot/bin" > > @@ -57,7 +61,8 @@ if [[ "$HAVE_OPENAT2" = 1 ]]; then > > ln -s /bin/bash "${tmpdir}/sysroot/usr/bin/bash" > > > > # Check that stack with --sysroot generates correct backtrace even if > > target > > - # binary is actually absolute symlink pointing outside of sysroot > > directory > > + # binary is actually absolute symlink to be interpreted relative to > > the sysroot > > + # directory > > testrun "${abs_top_builddir}"/src/stack --core "${tmpdir}/core.bash" \ > > --sysroot "${tmpdir}/sysroot" >"${tmpdir}/stack.out" > > > > -- > > 2.51.2 > > > > I think this fix works > > > Thanks for having a look! > > but it would be better to just define > HAVE_OPENAT2_RESOLVE_IN_ROOT when both libc and kernel support are > present. This approach has the advantage of not including the eu-stack > --sysroot option when glibc supports RESOLVE_IN_ROOT but the kernel > doesn't. > > I posted a small patch that tweaks configure.ac so that libc and > kernel RESOLVE_IN_ROOT support is verified at build time. Does this > work for you: > https://sourceware.org/pipermail/elfutils-devel/2025q4/008838.html > > > While I love how short and sweet that patch is, I'd prefer the 'old' > behavior: it's possible the build happens on a kernel that doesn't have > openat2, while it targets a system that does have it. In fact that's exactly > the scenario where I ran into this issue: I was checking if I could rebuild > something (bit-by-bit) without relying on recent binaries (hence running on > that older kernel), and saw the elfutils tests fail. With your proposed > change the elfutils tests wouldn't fail anymore, but also would produce a > different result than the one I was trying to verify.
Ok let's keep the build time behavior as-is then. I've merged this patch as commit 7a51b50ba5a4b. Thanks for the patch. Aaron
