Bug 382034 - Testcases build fixes for musl
Summary: Testcases build fixes for musl
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
: 453929 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-07-06 00:45 UTC by Khem Raj
Modified: 2023-05-16 06:41 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
aarch64 fix (893 bytes, patch)
2017-07-06 00:45 UTC, Khem Raj
Details
x86 fix (867 bytes, patch)
2017-07-06 00:46 UTC, Khem Raj
Details
syscall fix (1.96 KB, patch)
2017-07-06 00:46 UTC, Khem Raj
Details
Add missing includes to avoid 'SYS_modify_ldt is undefined' errors (776 bytes, text/plain)
2023-05-09 12:06 UTC, Alexander Kanavin
Details
Some more changes for musl x86 (1.03 KB, patch)
2023-05-15 20:18 UTC, Paul Floyd
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Khem Raj 2017-07-06 00:45:58 UTC
Created attachment 106454 [details]
aarch64 fix

While building tests on x86/aarch64 it fails to build few tests. Attached patches solve the problem, hopefully in a portable way, while keeping the functionality intact.
Comment 1 Khem Raj 2017-07-06 00:46:25 UTC
Created attachment 106455 [details]
x86 fix
Comment 2 Khem Raj 2017-07-06 00:46:57 UTC
Created attachment 106456 [details]
syscall fix
Comment 3 Julian Seward 2018-07-24 16:57:57 UTC
What is MUSL?
Comment 4 Khem Raj 2018-07-24 17:22:56 UTC
musl is an alternative system C library implementation for linux, like glibc or uclibc and others.

see https://www.musl-libc.org/
Comment 5 Paul Floyd 2023-01-11 09:26:35 UTC
These might fix building but they will also break the tests themselves. For instance there is no update to the scalar expected even though the line numbers will have changed.
Comment 6 Paul Floyd 2023-01-11 09:27:42 UTC
Could you update the patches with expecteds that won't break glibc Linux?
Comment 7 Bug Janitor Service 2023-01-26 05:05:31 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 8 Khem Raj 2023-01-26 05:54:03 UTC
(In reply to Paul Floyd from comment #6)
> Could you update the patches with expecteds that won't break glibc Linux?

Paul, I do not understand what 'expecteds' you are refrerring to here. If I understand it better, I will be able to make the needed change
Comment 9 Paul Floyd 2023-01-26 07:03:14 UTC
*** Bug 453929 has been marked as a duplicate of this bug. ***
Comment 10 Paul Floyd 2023-01-26 07:04:26 UTC
In order for there to be no breakage you need all of the following to add no new problems:
make [builds Valgrind]
make check [builds the testcases]
make regtest [runs the regtest]

regtest uses one ore more expected like [testcase].stderr.exp to capture and compare the Valgrind output.

Looking again at the diffs I don't think that the expected need updating. I'd still rather not see any change for glibc in the syscall patch.

Could you update that patch to do something like this

#include "./../../config..h"

#if defined(MUSL_LIBC)
#define MODIFY_LDT(func, ptr, bytecount) syscall(SYS_modify_ldt, (func), (ptr), (bytecount) );
#else
#define MODIFY_LDT(func, ptr, bytecount) __modify_ldt((func), (ptr), (bytecount) );
#endif
Comment 11 Paul Floyd 2023-01-26 13:55:19 UTC
If you don't beat me to it I'll probably go ahead and try this tonight.
Comment 12 Khem Raj 2023-01-26 17:11:41 UTC
(In reply to Paul Floyd from comment #11)
> If you don't beat me to it I'll probably go ahead and try this tonight.

OK. I wont get to this till weekend.
Comment 13 Bug Janitor Service 2023-02-10 03:51:51 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 14 Bug Janitor Service 2023-02-25 03:45:37 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!
Comment 15 Paul Floyd 2023-02-25 08:06:00 UTC
Memory like a sieve. I did apply the __THROW patches and changed the __modify_ldt patch so that it doesn't affect glibc in any way.

commit f7e4bb4af294575432b629de4869812fdfee6feb
Author: Paul Floyd <pjfloyd@wanadoo.fr>
Date:   Fri Jan 27 08:42:06 2023 +0100

    Bug 382034 - Testcases build fixes for musl
Comment 16 Alexander Kanavin 2023-05-09 12:06:09 UTC
Created attachment 158792 [details]
Add missing includes to avoid 'SYS_modify_ldt is undefined' errors
Comment 17 Alexander Kanavin 2023-05-09 12:06:50 UTC
There's one more fix needed (add needed includes on musl), I've attached the patch for it. Hope you don't mind reusing this ticket, which I'll reopen.
Comment 18 Paul Floyd 2023-05-09 20:20:07 UTC
commit 306232d40e037274160de417f21fdb957e30fc73 (HEAD -> master, origin/master, origin/HEAD)
Author: Paul Floyd <pjfloyd@wanadoo.fr>
Date:   Tue May 9 22:13:28 2023 +0200

    musl: another fix for building testcases

I'll try to do some musl testing before closing this.
Comment 19 Paul Floyd 2023-05-11 07:00:54 UTC
> I'll try to do some musl testing before closing this.

Did you use an x86 install of Alpine?

Or is there way to add an x86 subsystem to amd64?
Comment 20 Alexander Kanavin 2023-05-11 09:29:24 UTC
(In reply to Paul Floyd from comment #19)
> > I'll try to do some musl testing before closing this.
> 
> Did you use an x86 install of Alpine?
> 
> Or is there way to add an x86 subsystem to amd64?

I build valgrind using yocto set to use musl and 32bit x86. If you want to try that, do it on the most powerful (cpu cores wise) computer you have.
Comment 21 Paul Floyd 2023-05-11 09:34:57 UTC
(In reply to Alexander Kanavin from comment #20)

> I build valgrind using yocto set to use musl and 32bit x86. If you want to
> try that, do it on the most powerful (cpu cores wise) computer you have.

That would be my macbook ;-)

I'll try installing Alpine x86 in VirtualBox.
Comment 22 Paul Floyd 2023-05-15 20:18:58 UTC
Created attachment 158982 [details]
Some more changes for musl x86

make check succeeds with this patch.

Need to check that there is no impact on other platforms.
Comment 23 Paul Floyd 2023-05-16 06:41:26 UTC
Should build now.

Still around 100 regtest failures.