Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testsuite: test/elf/mold-wrapper.sh fails since eb7433f3ac004b6b12c783bbc9ea88ca6223de96 #495

Closed
marxin opened this issue May 4, 2022 · 7 comments

Comments

@marxin
Copy link
Contributor

marxin commented May 4, 2022

Fails on x86_64-linux-gnu with:

$ ./test/elf/mold-wrapper.sh
Testing mold-wrapper ... execl: Bad address
$ 

valgrind tells:

--18102-- WARNING: unhandled amd64-linux syscall: 334
--18102-- You may be able to write your own handler.
--18102-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--18102-- Nevertheless we consider this a bug.  Please report
--18102-- it at http://valgrind.org/support/bug_reports.html.
==18102== Syscall param execve(argv) points to uninitialised byte(s)
==18102==    at 0x49803EB: execve (syscall-template.S:120)
==18102==    by 0x4858603: execl (in /home/marxin/Programming/mold/mold-wrapper.so)
==18102==    by 0x4011FE: main (in /home/marxin/Programming/mold/out/test/elf/mold-wrapper/exe)
==18102==  Address 0x1ffefff8d0 is on thread 1's stack
==18102==  in frame #1, created by execl (???:)
==18102== 
==18102== Syscall param execve(argv[i]) points to unaddressable byte(s)
==18102==    at 0x49803EB: execve (syscall-template.S:120)
==18102==    by 0x4858603: execl (in /home/marxin/Programming/mold/mold-wrapper.so)
==18102==    by 0x4011FE: main (in /home/marxin/Programming/mold/out/test/elf/mold-wrapper/exe)
==18102==  Address 0x40000 is not stack'd, malloc'd or (recently) free'd
@Alcaro
Copy link

Alcaro commented May 4, 2022

For the record, 334 is rseq(), and is unrelated to the exec issue. Ignore it, or upgrade to Valgrind 3.19 (released three weeks ago). https://bugs.kde.org/show_bug.cgi?id=405377

@marxin
Copy link
Contributor Author

marxin commented May 4, 2022

Correct, new valgrind does not show that syscall error. Thanks.

@rui314
Copy link
Owner

rui314 commented May 4, 2022

It looks like it's resolved, so I'm closing this bug.

@rui314 rui314 closed this as completed May 4, 2022
@marxin
Copy link
Contributor Author

marxin commented May 4, 2022

Sorry, I was unclear. It's still present:

$ LD_PRELOAD=/home/marxin/Programming/mold/mold-wrapper.so MOLD_PATH=out/test/elf/mold-wrapper/a.sh MOLD_PATH=out/test/elf/mold-wrapper/a.sh valgrind out/test/elf/mold-wrapper/exe execl
==3517== Memcheck, a memory error detector
==3517== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==3517== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
==3517== Command: out/test/elf/mold-wrapper/exe execl
==3517== 
==3517== Syscall param execve(argv) points to uninitialised byte(s)
==3517==    at 0x49833EB: execve (syscall-template.S:120)
==3517==    by 0x485B603: execl (in /home/marxin/Programming/mold/mold-wrapper.so)
==3517==    by 0x4011FE: main (in /home/marxin/Programming/mold/out/test/elf/mold-wrapper/exe)
==3517==  Address 0x1ffefff870 is on thread 1's stack
==3517==  in frame #1, created by execl (???:)
==3517== 
==3517== Syscall param execve(argv[i]) points to unaddressable byte(s)
==3517==    at 0x49833EB: execve (syscall-template.S:120)
==3517==    by 0x485B603: execl (in /home/marxin/Programming/mold/mold-wrapper.so)
==3517==    by 0x4011FE: main (in /home/marxin/Programming/mold/out/test/elf/mold-wrapper/exe)
==3517==  Address 0x40000 is not stack'd, malloc'd or (recently) free'd
==3517== 
==3517== execve(0x1ffeffff49(out/test/elf/mold-wrapper/a.sh), 0x1ffefff860, 0x1ffefffb00) failed, errno 14
==3517== EXEC FAILED: I can't recover from execve() failing, so I'm dying.
==3517== Add more stringent tests in PRE(sys_execve), or work out how to recover.

@rui314 rui314 reopened this May 4, 2022
@rui314
Copy link
Owner

rui314 commented May 5, 2022

I believe it's a false positive. We pass an environment variable to execve as a first argument, and Valgrind seems to complain that the environment variable is not initialized. From the Valgrind's view, it's no surprise that the variable looks like uninitialized because no one wrote to that memory area holding the environment variable. But it's actually initialized by the kernel before the program starts.

@marxin
Copy link
Contributor Author

marxin commented May 5, 2022

I don't care much about valgrind, but the test crashes when I run it natively! Please see the very first message execl: Bad address.

@rui314 rui314 closed this as completed in 3694ffe May 5, 2022
@rui314
Copy link
Owner

rui314 commented May 5, 2022

Ah, I missed that failure. I fixed it in the above commit. Thank you for your report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants