You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm wondering if there are any plans to upgrade the MUSL libc version? There are a number of printf bugs that have been fixed since 1.1.15.
I tried upgrading it myself but it's non-trivial and there is very little information about the steps needed to do so. I would be willing to try again if I can be provided with a little direction.
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.
I wonder, I see that @kripken has updated many of the MUSL in #11215, yet I'm still getting the same buffer overrun issue mentioned in #7279 (comment) when using asan with strncpy.
Would someone know more about this ?
The overrun happens for this code, for instance:
chartest[] ="12345";
auto target= (char*)malloc(150);
strncpy(target, test, 150);
as the destination size is larger, forcing the aligned copy loop to read out of bounds of the test buffer.
A workaround can be to define a method that will override the weak alias of strncpy, without the aligned copy behavior:
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant.
Activity
kripken commentedon Oct 14, 2018
I added some docs for how to do that now, see #7286. Let me know if that helps or if anything still isn't clear.
stale commentedon Oct 14, 2019
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.
sbc100 commentedon Oct 14, 2019
We should do this.
nhooyr commentedon Mar 3, 2020
Please do.
emscripten/system/lib/libc/musl/src/string/strlcpy.c
Line 19 in 46df50c
Update strlcpy from musl to 1.2.0 to fix #7279 (comment)
Update strlcpy from musl to 1.2.0 (#10910)
kripken commentedon Apr 14, 2020
@nhooyr we updated that file specifically now to fix that issue.
A full update of musl is still very important to do, hopefully someone volunteers to take the time soon!
kleisauke commentedon Apr 22, 2020
+1 for full update of musl. fwiw, it looks like
stpncpyis also affected for the above mentioned bug.Details
(
memccpy,memchr,memmove,stpcpy,strchrnulandstrlenare probably also affected. See this commit)Fix aliasing-based undefined behavior in string functions. (#11215)
jeromelaban commentedon Nov 27, 2020
I wonder, I see that @kripken has updated many of the MUSL in #11215, yet I'm still getting the same buffer overrun issue mentioned in #7279 (comment) when using asan with
strncpy.Would someone know more about this ?
The overrun happens for this code, for instance:
as the destination size is larger, forcing the aligned copy loop to read out of bounds of the
testbuffer.A workaround can be to define a method that will override the weak alias of
strncpy, without the aligned copy behavior:sbc100 commentedon Nov 28, 2020
Does your example repro under asan? if not how have your been detecting it? It would be good to have failing test so we can be sure we've fixed it.
jeromelaban commentedon Nov 28, 2020
Yes it does with asan enabled, here's how I reproduced it:
emcc \ test.cpp \ -fsanitize=address -s TOTAL_MEMORY=393216000 \ -s DISABLE_EXCEPTION_CATCHING=0 \ --profiling \ -o index.htmlWith the following error:
Where would be the best location to add this repro in tests ?
sbc100 commentedon Nov 28, 2020
I think you could add this alongside
test_strndup.cintest_core.py.In order to run that test with asan you would run
./tests/runner.py asan.test_strndup.jeromelaban commentedon Nov 28, 2020
#12905 should do. It fails when running the test locally.
kleisauke commentedon Dec 10, 2020
I started working to update musl to version 1.2.1 (i.e. latest version as the time of writing), see:
master...kleisauke:musl-1.2.1
It already passes the test suite locally, so expect a PR soon.
sbc100 commentedon Dec 10, 2020
I also had a go at the musl upgrade last week: #13006. Happy to go with your version if they are basically equivalent.
Add generic musl arch headers. NFC.
Add generic musl arch headers. NFC.
Add generic musl arch headers. NFC.
Add generic musl arch headers. NFC.
Add generic musl arch headers. NFC. (#13280)
stale commentedon Apr 17, 2022
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant.