Skip to contentSkip to conversation

Refactor 'peeksiginfo' ptrace test part

PATCH In review Ivan Orlov 2 participants 2 messages Feb 20, 2023 – Mar 28, 2023 Kselftest

lore
Share & tools
lore

Ivan Orlov

author
#0 lore raw

PATCH 1/1 Refactor 'peeksiginfo' ptrace test part

peeksiginfo creates an array of 10 instances of 'siginfo_t', but actually uses only one. This patch will reduce amount of memory on the stack used by the peeksiginfo test.

---
 tools/testing/selftests/ptrace/peeksiginfo.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
tools/testing/selftests/ptrace/peeksiginfo.c +7 -7
index 54900657eb44..a6884f66dc01 100644
@@ -151,7 +151,7 @@ int check_direct_path(pid_t child, int shared, int nr)
 
 int main(int argc, char *argv[])
 {
-	siginfo_t siginfo[SIGNR];
+	siginfo_t siginfo;
 	int i, exit_code = 1;
 	sigset_t blockmask;
 	pid_t child;
@@ -176,13 +176,13 @@ int main(int argc, char *argv[])
 
 	/* Send signals in process-wide and per-thread queues */
 	for (i = 0; i < SIGNR; i++) {
-		siginfo->si_code = TEST_SICODE_SHARE;
-		siginfo->si_int = i;
-		sys_rt_sigqueueinfo(child, SIGRTMIN, siginfo);
+		siginfo.si_code = TEST_SICODE_SHARE;
+		siginfo.si_int = i;
+		sys_rt_sigqueueinfo(child, SIGRTMIN, &siginfo);
 
-		siginfo->si_code = TEST_SICODE_PRIV;
-		siginfo->si_int = i;
-		sys_rt_tgsigqueueinfo(child, child, SIGRTMIN, siginfo);
+		siginfo.si_code = TEST_SICODE_PRIV;
+		siginfo.si_int = i;
+		sys_rt_tgsigqueueinfo(child, child, SIGRTMIN, &siginfo);
 	}
 
 	if (sys_ptrace(PTRACE_ATTACH, child, NULL, NULL) == -1)
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 6 lines · Ivan Orlov

peeksiginfo creates an array of 10 instances of 'siginfo_t', but actually uses only one. This patch will reduce amount of memory on the stack used by the peeksiginfo test.

---

Thank you. Applied to linux-kselftest next for Linux 6.4-rc1

thanks,
-- Shuah