Bug 31402 - clone (NULL, NULL, ...) clobbers %r7 register on s390{,x}
Summary: clone (NULL, NULL, ...) clobbers %r7 register on s390{,x}
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.37
: P2 normal
Target Milestone: 2.40
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-19 14:58 UTC by Jakub Jelinek
Modified: 2024-02-27 10:16 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2024-02-19 14:58:57 UTC
Initially filed in https://gcc.gnu.org/PR113991, but it looks like a glibc bug to me.
vsftpd for some strange reason does:
int ret = clone(NULL, NULL, CLONE_NEWPID | CLONE_NEWIPC | SIGCHLD, NULL);
My reading of glibc sources is that this results always in -1/EINVAL without invoking the syscall.
Anyway, since https://sourceware.org/git/?p=glibc.git;a=commit;h=e57d8fc97b90127de4ed3e3a9cdf663667580935
if the first or second clone argument is NULL, it will return -1/EINVAL, but clobber the call-saved %r7 register.
I think error: label should either lm{,g} %r6,%7 or l{,g} %r7.
Comment 1 Andreas Schwab 2024-02-19 15:12:32 UTC
Introduced in commit e57d8fc97b.
Comment 2 Stefan Liebler 2024-02-20 06:50:31 UTC
Yes, you are right, this is broken. I'll take care of it. Thanks for figuring out and reporting to me.
Comment 4 Stefan Liebler 2024-02-26 12:45:18 UTC
Committed to master:
"S390: Do not clobber r7 in clone [BZ #31402]"
https://sourceware.org/git/?p=glibc.git;a=commit;h=02782fd12849b6673cb5c2728cb750e8ec295aa3

I will backport this commit to the release branches and will then close this bugzilla.