ltp.lists.linux.it archive mirror
 help / color / mirror / Atom feed
* [LTP] [PATCH v3] syscalls/signal06: loop being clobbered by syscall on clang
@ 2022-08-19 23:27 Edward Liaw via ltp
  2022-08-24  8:25 ` Cyril Hrubis
  0 siblings, 1 reply; 2+ messages in thread
From: Edward Liaw via ltp @ 2022-08-19 23:27 UTC (permalink / raw)
  To: ltp; +Cc: vmartensson, kernel-team

Indicate to the compiler that the syscall will modify registers rcx
and r11 to prevent loop from getting clobbered.

Signed-off-by: Edward Liaw <edliaw@google.com>

---
I added an output operand for the result so that the compiler would know
that rax is clobbered as well.
---
 testcases/kernel/syscalls/signal/signal06.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/signal/signal06.c b/testcases/kernel/syscalls/signal/signal06.c
index 64f886ee3..cf0706ea4 100644
--- a/testcases/kernel/syscalls/signal/signal06.c
+++ b/testcases/kernel/syscalls/signal/signal06.c
@@ -72,8 +72,8 @@ void test(void)
 	while (D == VALUE && loop < LOOPS) {
 		/* sys_tkill(pid, SIGHUP); asm to avoid save/reload
 		 * fp regs around c call */
-		asm ("" : : "a"(__NR_tkill), "D"(pid), "S"(SIGHUP));
-		asm ("syscall" : : : "ax");
+		int unused;
+		asm volatile ("syscall" : "=a"(unused) : "a"(__NR_tkill), "D"(pid), "S"(SIGHUP) : "rcx", "r11");
 
 		loop++;
 	}
-- 
2.37.2.609.g9ff673ca1a-goog


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [LTP] [PATCH v3] syscalls/signal06: loop being clobbered by syscall on clang
  2022-08-19 23:27 [LTP] [PATCH v3] syscalls/signal06: loop being clobbered by syscall on clang Edward Liaw via ltp
@ 2022-08-24  8:25 ` Cyril Hrubis
  0 siblings, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2022-08-24  8:25 UTC (permalink / raw)
  To: Edward Liaw; +Cc: vmartensson, kernel-team, ltp

Hi!
Applied, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-24  8:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-19 23:27 [LTP] [PATCH v3] syscalls/signal06: loop being clobbered by syscall on clang Edward Liaw via ltp
2022-08-24  8:25 ` Cyril Hrubis

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 NNTP newsgroup(s).