* [PATCH] powerpc: Add missing registers to clobbers list for syscalls [BZ #27623]
@ 2021-03-22 14:20 Matheus Castanho
2021-03-22 14:42 ` Andreas Schwab
0 siblings, 1 reply; 3+ messages in thread
From: Matheus Castanho @ 2021-03-22 14:20 UTC (permalink / raw)
To: libc-alpha; +Cc: npiggin, tuliom
Some registers that can be clobbered by the kernel during a syscall are not
listed on the clobbers list in sysdeps/unix/sysv/linux/powerpc/sysdep.h.
For syscalls using sc:
- XER is zeroed by the kernel on exit
For syscalls using scv:
- XER is zeroed by the kernel on exit
- Different from the sc case, most CR fields can be clobbered (according to
the ELF ABI and the Linux kernel's syscall ABI for powerpc
(linux/Documentation/powerpc/syscall64-abi.rst)
These are likely not causing issues today, but they should be added to the
clobbers list just in case things change on the kernel side in the future.
Reported-by: Nicholas Piggin <npiggin@gmail.com>
---
sysdeps/unix/sysv/linux/powerpc/sysdep.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/powerpc/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/sysdep.h
index 6b99464e61..d15e80d610 100644
--- a/sysdeps/unix/sysv/linux/powerpc/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/sysdep.h
@@ -86,7 +86,8 @@
"=&r" (r6), "=&r" (r7), "=&r" (r8) \
: ASM_INPUT_##nr \
: "r9", "r10", "r11", "r12", \
- "lr", "ctr", "memory"); \
+ "cr0", "cr1", "cr5", "cr6", "cr7", \
+ "xer", "lr", "ctr", "memory"); \
r3; \
})
@@ -101,7 +102,7 @@
"=&r" (r6), "=&r" (r7), "=&r" (r8) \
: ASM_INPUT_##nr \
: "r9", "r10", "r11", "r12", \
- "cr0", "ctr", "memory"); \
+ "xer", "cr0", "ctr", "memory"); \
r0 & (1 << 28) ? -r3 : r3; \
})
--
2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc: Add missing registers to clobbers list for syscalls [BZ #27623]
2021-03-22 14:20 [PATCH] powerpc: Add missing registers to clobbers list for syscalls [BZ #27623] Matheus Castanho
@ 2021-03-22 14:42 ` Andreas Schwab
2021-03-29 13:27 ` Matheus Castanho
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2021-03-22 14:42 UTC (permalink / raw)
To: Matheus Castanho via Libc-alpha; +Cc: Matheus Castanho, tuliom, npiggin
On Mär 22 2021, Matheus Castanho via Libc-alpha wrote:
> Some registers that can be clobbered by the kernel during a syscall are not
> listed on the clobbers list in sysdeps/unix/sysv/linux/powerpc/sysdep.h.
>
> For syscalls using sc:
> - XER is zeroed by the kernel on exit
>
> For syscalls using scv:
> - XER is zeroed by the kernel on exit
> - Different from the sc case, most CR fields can be clobbered (according to
> the ELF ABI and the Linux kernel's syscall ABI for powerpc
> (linux/Documentation/powerpc/syscall64-abi.rst)
>
> These are likely not causing issues today, but they should be added to the
> clobbers list just in case things change on the kernel side in the future.
What about INTERNAL_VSYSCALL_CALL_TYPE? Doesn't that clobber XER[CA]
and CR1/5/6/7 like ordinary function calls?
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc: Add missing registers to clobbers list for syscalls [BZ #27623]
2021-03-22 14:42 ` Andreas Schwab
@ 2021-03-29 13:27 ` Matheus Castanho
0 siblings, 0 replies; 3+ messages in thread
From: Matheus Castanho @ 2021-03-29 13:27 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Matheus Castanho via Libc-alpha, tuliom, npiggin
Andreas Schwab <schwab@linux-m68k.org> writes:
> On Mär 22 2021, Matheus Castanho via Libc-alpha wrote:
>
>> Some registers that can be clobbered by the kernel during a syscall are not
>> listed on the clobbers list in sysdeps/unix/sysv/linux/powerpc/sysdep.h.
>>
>> For syscalls using sc:
>> - XER is zeroed by the kernel on exit
>>
>> For syscalls using scv:
>> - XER is zeroed by the kernel on exit
>> - Different from the sc case, most CR fields can be clobbered (according to
>> the ELF ABI and the Linux kernel's syscall ABI for powerpc
>> (linux/Documentation/powerpc/syscall64-abi.rst)
>>
>> These are likely not causing issues today, but they should be added to the
>> clobbers list just in case things change on the kernel side in the future.
>
> What about INTERNAL_VSYSCALL_CALL_TYPE? Doesn't that clobber XER[CA]
> and CR1/5/6/7 like ordinary function calls?
>
> Andreas.
Yes, looks like they should be added to the clobbers list there too. I'll send
a v2 shortly.
--
Matheus Castanho
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-29 13:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22 14:20 [PATCH] powerpc: Add missing registers to clobbers list for syscalls [BZ #27623] Matheus Castanho
2021-03-22 14:42 ` Andreas Schwab
2021-03-29 13:27 ` Matheus Castanho
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).