All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] linux-user: Let sigaction query SIGKILL/SIGSTOP
@ 2021-06-01 14:55 Ilya Leoshkevich
  2021-06-01 14:55 ` [PATCH 1/2] " Ilya Leoshkevich
  2021-06-01 14:56 ` [PATCH 2/2] tests/tcg/linux-test: Check that sigaction can " Ilya Leoshkevich
  0 siblings, 2 replies; 7+ messages in thread
From: Ilya Leoshkevich @ 2021-06-01 14:55 UTC (permalink / raw)
  To: Alex Bennée, Laurent Vivier
  Cc: Christian Borntraeger, qemu-devel, Ilya Leoshkevich

valgrind fails to start under linux-user, one of the reasons being that
it tries to query all the sigactions, which qemu (unlike the real
kernel) doesn't allow for SIGKILL/SIGSTOP.

Patch 1 lifts this restriction, patch 2 adds a test.

Ilya Leoshkevich (2):
  linux-user: Let sigaction query SIGKILL/SIGSTOP
  tests/tcg/linux-test: Check that sigaction can query SIGKILL/SIGSTOP

 linux-user/signal.c              | 6 +++++-
 tests/tcg/multiarch/linux-test.c | 9 +++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

-- 
2.31.1



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

* [PATCH 1/2] linux-user: Let sigaction query SIGKILL/SIGSTOP
  2021-06-01 14:55 [PATCH 0/2] linux-user: Let sigaction query SIGKILL/SIGSTOP Ilya Leoshkevich
@ 2021-06-01 14:55 ` Ilya Leoshkevich
  2021-06-20 14:19   ` Laurent Vivier
  2021-06-20 14:21   ` Laurent Vivier
  2021-06-01 14:56 ` [PATCH 2/2] tests/tcg/linux-test: Check that sigaction can " Ilya Leoshkevich
  1 sibling, 2 replies; 7+ messages in thread
From: Ilya Leoshkevich @ 2021-06-01 14:55 UTC (permalink / raw)
  To: Alex Bennée, Laurent Vivier
  Cc: Christian Borntraeger, qemu-devel, Ilya Leoshkevich

The kernel allows doing this, so let's allow this in qemu as well.
Valgrind relies on this.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 linux-user/signal.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/linux-user/signal.c b/linux-user/signal.c
index 9016896dcd..bc3431708f 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -851,7 +851,11 @@ int do_sigaction(int sig, const struct target_sigaction *act,
 
     trace_signal_do_sigaction_guest(sig, TARGET_NSIG);
 
-    if (sig < 1 || sig > TARGET_NSIG || sig == TARGET_SIGKILL || sig == TARGET_SIGSTOP) {
+    if (sig < 1 || sig > TARGET_NSIG) {
+        return -TARGET_EINVAL;
+    }
+
+    if (act && (sig == TARGET_SIGKILL || sig == TARGET_SIGSTOP)) {
         return -TARGET_EINVAL;
     }
 
-- 
2.31.1



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

* [PATCH 2/2] tests/tcg/linux-test: Check that sigaction can query SIGKILL/SIGSTOP
  2021-06-01 14:55 [PATCH 0/2] linux-user: Let sigaction query SIGKILL/SIGSTOP Ilya Leoshkevich
  2021-06-01 14:55 ` [PATCH 1/2] " Ilya Leoshkevich
@ 2021-06-01 14:56 ` Ilya Leoshkevich
  2021-06-20 14:26   ` Laurent Vivier
  2021-06-20 14:27   ` Laurent Vivier
  1 sibling, 2 replies; 7+ messages in thread
From: Ilya Leoshkevich @ 2021-06-01 14:56 UTC (permalink / raw)
  To: Alex Bennée, Laurent Vivier
  Cc: Christian Borntraeger, qemu-devel, Ilya Leoshkevich

Verify that querying is allowed, but making changes isn't.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 tests/tcg/multiarch/linux-test.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tests/tcg/multiarch/linux-test.c b/tests/tcg/multiarch/linux-test.c
index ce033c21c7..cd9d8159bc 100644
--- a/tests/tcg/multiarch/linux-test.c
+++ b/tests/tcg/multiarch/linux-test.c
@@ -496,6 +496,15 @@ static void test_signal(void)
     sigemptyset(&act.sa_mask);
     act.sa_flags = 0;
     chk_error(sigaction(SIGSEGV, &act, NULL));
+
+    if (sigaction(SIGKILL, &act, NULL) == 0) {
+        error("sigaction(SIGKILL, &act, NULL) must not succeed");
+    }
+    if (sigaction(SIGSTOP, &act, NULL) == 0) {
+        error("sigaction(SIGSTOP, &act, NULL) must not succeed");
+    }
+    chk_error(sigaction(SIGKILL, NULL, &act));
+    chk_error(sigaction(SIGSTOP, NULL, &act));
 }
 
 #define SHM_SIZE 32768
-- 
2.31.1



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

* Re: [PATCH 1/2] linux-user: Let sigaction query SIGKILL/SIGSTOP
  2021-06-01 14:55 ` [PATCH 1/2] " Ilya Leoshkevich
@ 2021-06-20 14:19   ` Laurent Vivier
  2021-06-20 14:21   ` Laurent Vivier
  1 sibling, 0 replies; 7+ messages in thread
From: Laurent Vivier @ 2021-06-20 14:19 UTC (permalink / raw)
  To: Ilya Leoshkevich, Alex Bennée; +Cc: Christian Borntraeger, qemu-devel

Le 01/06/2021 à 16:55, Ilya Leoshkevich a écrit :
> The kernel allows doing this, so let's allow this in qemu as well.
> Valgrind relies on this.
> 
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>  linux-user/signal.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/linux-user/signal.c b/linux-user/signal.c
> index 9016896dcd..bc3431708f 100644
> --- a/linux-user/signal.c
> +++ b/linux-user/signal.c
> @@ -851,7 +851,11 @@ int do_sigaction(int sig, const struct target_sigaction *act,
>  
>      trace_signal_do_sigaction_guest(sig, TARGET_NSIG);
>  
> -    if (sig < 1 || sig > TARGET_NSIG || sig == TARGET_SIGKILL || sig == TARGET_SIGSTOP) {
> +    if (sig < 1 || sig > TARGET_NSIG) {
> +        return -TARGET_EINVAL;
> +    }
> +
> +    if (act && (sig == TARGET_SIGKILL || sig == TARGET_SIGSTOP)) {
>          return -TARGET_EINVAL;
>      }
>  
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>


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

* Re: [PATCH 1/2] linux-user: Let sigaction query SIGKILL/SIGSTOP
  2021-06-01 14:55 ` [PATCH 1/2] " Ilya Leoshkevich
  2021-06-20 14:19   ` Laurent Vivier
@ 2021-06-20 14:21   ` Laurent Vivier
  1 sibling, 0 replies; 7+ messages in thread
From: Laurent Vivier @ 2021-06-20 14:21 UTC (permalink / raw)
  To: Ilya Leoshkevich, Alex Bennée; +Cc: Christian Borntraeger, qemu-devel

Le 01/06/2021 à 16:55, Ilya Leoshkevich a écrit :
> The kernel allows doing this, so let's allow this in qemu as well.
> Valgrind relies on this.
> 
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>  linux-user/signal.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/linux-user/signal.c b/linux-user/signal.c
> index 9016896dcd..bc3431708f 100644
> --- a/linux-user/signal.c
> +++ b/linux-user/signal.c
> @@ -851,7 +851,11 @@ int do_sigaction(int sig, const struct target_sigaction *act,
>  
>      trace_signal_do_sigaction_guest(sig, TARGET_NSIG);
>  
> -    if (sig < 1 || sig > TARGET_NSIG || sig == TARGET_SIGKILL || sig == TARGET_SIGSTOP) {
> +    if (sig < 1 || sig > TARGET_NSIG) {
> +        return -TARGET_EINVAL;
> +    }
> +
> +    if (act && (sig == TARGET_SIGKILL || sig == TARGET_SIGSTOP)) {
>          return -TARGET_EINVAL;
>      }
>  
> 

Applied to my linux-user-for-6.1 branch.

Thanks,
Laurent



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

* Re: [PATCH 2/2] tests/tcg/linux-test: Check that sigaction can query SIGKILL/SIGSTOP
  2021-06-01 14:56 ` [PATCH 2/2] tests/tcg/linux-test: Check that sigaction can " Ilya Leoshkevich
@ 2021-06-20 14:26   ` Laurent Vivier
  2021-06-20 14:27   ` Laurent Vivier
  1 sibling, 0 replies; 7+ messages in thread
From: Laurent Vivier @ 2021-06-20 14:26 UTC (permalink / raw)
  To: Ilya Leoshkevich, Alex Bennée; +Cc: Christian Borntraeger, qemu-devel

Le 01/06/2021 à 16:56, Ilya Leoshkevich a écrit :
> Verify that querying is allowed, but making changes isn't.
> 
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>  tests/tcg/multiarch/linux-test.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/tests/tcg/multiarch/linux-test.c b/tests/tcg/multiarch/linux-test.c
> index ce033c21c7..cd9d8159bc 100644
> --- a/tests/tcg/multiarch/linux-test.c
> +++ b/tests/tcg/multiarch/linux-test.c
> @@ -496,6 +496,15 @@ static void test_signal(void)
>      sigemptyset(&act.sa_mask);
>      act.sa_flags = 0;
>      chk_error(sigaction(SIGSEGV, &act, NULL));
> +
> +    if (sigaction(SIGKILL, &act, NULL) == 0) {
> +        error("sigaction(SIGKILL, &act, NULL) must not succeed");
> +    }
> +    if (sigaction(SIGSTOP, &act, NULL) == 0) {
> +        error("sigaction(SIGSTOP, &act, NULL) must not succeed");
> +    }
> +    chk_error(sigaction(SIGKILL, NULL, &act));
> +    chk_error(sigaction(SIGSTOP, NULL, &act));
>  }
>  
>  #define SHM_SIZE 32768
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

Alex, I will merge this via linux-user, is it ok for you?

Thanks,
Laurent


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

* Re: [PATCH 2/2] tests/tcg/linux-test: Check that sigaction can query SIGKILL/SIGSTOP
  2021-06-01 14:56 ` [PATCH 2/2] tests/tcg/linux-test: Check that sigaction can " Ilya Leoshkevich
  2021-06-20 14:26   ` Laurent Vivier
@ 2021-06-20 14:27   ` Laurent Vivier
  1 sibling, 0 replies; 7+ messages in thread
From: Laurent Vivier @ 2021-06-20 14:27 UTC (permalink / raw)
  To: Ilya Leoshkevich, Alex Bennée; +Cc: Christian Borntraeger, qemu-devel

Le 01/06/2021 à 16:56, Ilya Leoshkevich a écrit :
> Verify that querying is allowed, but making changes isn't.
> 
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>  tests/tcg/multiarch/linux-test.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/tests/tcg/multiarch/linux-test.c b/tests/tcg/multiarch/linux-test.c
> index ce033c21c7..cd9d8159bc 100644
> --- a/tests/tcg/multiarch/linux-test.c
> +++ b/tests/tcg/multiarch/linux-test.c
> @@ -496,6 +496,15 @@ static void test_signal(void)
>      sigemptyset(&act.sa_mask);
>      act.sa_flags = 0;
>      chk_error(sigaction(SIGSEGV, &act, NULL));
> +
> +    if (sigaction(SIGKILL, &act, NULL) == 0) {
> +        error("sigaction(SIGKILL, &act, NULL) must not succeed");
> +    }
> +    if (sigaction(SIGSTOP, &act, NULL) == 0) {
> +        error("sigaction(SIGSTOP, &act, NULL) must not succeed");
> +    }
> +    chk_error(sigaction(SIGKILL, NULL, &act));
> +    chk_error(sigaction(SIGSTOP, NULL, &act));
>  }
>  
>  #define SHM_SIZE 32768
> 

Applied to my linux-user-for-6.1 branch.

Thanks,
Laurent



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

end of thread, other threads:[~2021-06-20 14:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-01 14:55 [PATCH 0/2] linux-user: Let sigaction query SIGKILL/SIGSTOP Ilya Leoshkevich
2021-06-01 14:55 ` [PATCH 1/2] " Ilya Leoshkevich
2021-06-20 14:19   ` Laurent Vivier
2021-06-20 14:21   ` Laurent Vivier
2021-06-01 14:56 ` [PATCH 2/2] tests/tcg/linux-test: Check that sigaction can " Ilya Leoshkevich
2021-06-20 14:26   ` Laurent Vivier
2021-06-20 14:27   ` Laurent Vivier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.