linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] stress-shm-sysv: exercise shmat with invalid flags
@ 2020-09-22  7:27 Piyush Goyal
  2020-09-22  7:27 ` [PATCH 2/3] stress-shm-sysv: exercise shmat with all possible flags Piyush Goyal
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Piyush Goyal @ 2020-09-22  7:27 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Matthias Brugger, linux-arm-kernel,
	linux-mediatek
  Cc: linux-kernel

Exercise shmat syscall with invalid flags resulting in more kernel
coverage.

Signed-off-by: Piyush Goyal <piyushgoyaliit@gmail.com>
---
 stress-shm-sysv.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/stress-shm-sysv.c b/stress-shm-sysv.c
index aa03d718..5a3e0cc1 100644
--- a/stress-shm-sysv.c
+++ b/stress-shm-sysv.c
@@ -128,6 +128,19 @@ static int stress_shm_sysv_check(
 	return 0;
 }
 
+/*
+ *  exercise_shmat()
+ *	exercise shmat syscall with all possible values of arguments
+ */
+static void exercise_shmat(int shm_id)
+{
+	void *addr;
+
+	/* Exercise shmat syscall with invalid flags */
+	addr = shmat(shm_id, NULL, ~0);
+	(void)addr;
+}
+
 #if defined(__linux__)
 /*
  *  stress_shm_get_procinfo()
@@ -337,6 +350,7 @@ static int stress_shm_sysv_child(
 				goto reap;
 			}
 
+			exercise_shmat(shm_id);
 			addr = shmat(shm_id, NULL, 0);
 			if (addr == (char *) -1) {
 				ok = false;
-- 
2.25.1


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

* [PATCH 2/3] stress-shm-sysv: exercise shmat with all possible flags
  2020-09-22  7:27 [PATCH 1/3] stress-shm-sysv: exercise shmat with invalid flags Piyush Goyal
@ 2020-09-22  7:27 ` Piyush Goyal
  2020-09-22  7:27 ` [PATCH 3/3] stress-shmsysv: exercise shmat with SHM_REMAP flag on NULL address Piyush Goyal
  2020-09-22  8:16 ` [PATCH 1/3] stress-shm-sysv: exercise shmat with invalid flags Colin Ian King
  2 siblings, 0 replies; 4+ messages in thread
From: Piyush Goyal @ 2020-09-22  7:27 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Matthias Brugger, linux-arm-kernel,
	linux-mediatek
  Cc: linux-kernel

Exercise shmat syscall with all possible flags resulting in more kernel
coverage.

Signed-off-by: Piyush Goyal <piyushgoyaliit@gmail.com>
---
 stress-shm-sysv.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/stress-shm-sysv.c b/stress-shm-sysv.c
index 5a3e0cc1..9efaa091 100644
--- a/stress-shm-sysv.c
+++ b/stress-shm-sysv.c
@@ -139,6 +139,16 @@ static void exercise_shmat(int shm_id)
 	/* Exercise shmat syscall with invalid flags */
 	addr = shmat(shm_id, NULL, ~0);
 	(void)addr;
+
+	/* Exercise shmat with all possible values of flags */
+	addr = shmat(shm_id, NULL, SHM_RDONLY);
+	(void)addr;
+
+	addr = shmat(shm_id, NULL, SHM_EXEC);
+	(void)addr;
+
+	addr = shmat(shm_id, NULL, SHM_RND);
+	(void)addr;
 }
 
 #if defined(__linux__)
-- 
2.25.1


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

* [PATCH 3/3] stress-shmsysv: exercise shmat with SHM_REMAP flag on NULL address
  2020-09-22  7:27 [PATCH 1/3] stress-shm-sysv: exercise shmat with invalid flags Piyush Goyal
  2020-09-22  7:27 ` [PATCH 2/3] stress-shm-sysv: exercise shmat with all possible flags Piyush Goyal
@ 2020-09-22  7:27 ` Piyush Goyal
  2020-09-22  8:16 ` [PATCH 1/3] stress-shm-sysv: exercise shmat with invalid flags Colin Ian King
  2 siblings, 0 replies; 4+ messages in thread
From: Piyush Goyal @ 2020-09-22  7:27 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Matthias Brugger, linux-arm-kernel,
	linux-mediatek
  Cc: linux-kernel

Exercise shmat syscall with SHM_REMAP flag on NULL address resulting
in EINVAL error and more kernel coverage.

Signed-off-by: Piyush Goyal <piyushgoyaliit@gmail.com>
---
 stress-shm-sysv.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/stress-shm-sysv.c b/stress-shm-sysv.c
index 9efaa091..e2aff788 100644
--- a/stress-shm-sysv.c
+++ b/stress-shm-sysv.c
@@ -149,6 +149,10 @@ static void exercise_shmat(int shm_id)
 
 	addr = shmat(shm_id, NULL, SHM_RND);
 	(void)addr;
+
+	/* Exercise shmat with SHM_REMAP flag on NULL address */
+	addr = shmat(shm_id, NULL, SHM_REMAP);
+	(void)addr;
 }
 
 #if defined(__linux__)
-- 
2.25.1


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

* Re: [PATCH 1/3] stress-shm-sysv: exercise shmat with invalid flags
  2020-09-22  7:27 [PATCH 1/3] stress-shm-sysv: exercise shmat with invalid flags Piyush Goyal
  2020-09-22  7:27 ` [PATCH 2/3] stress-shm-sysv: exercise shmat with all possible flags Piyush Goyal
  2020-09-22  7:27 ` [PATCH 3/3] stress-shmsysv: exercise shmat with SHM_REMAP flag on NULL address Piyush Goyal
@ 2020-09-22  8:16 ` Colin Ian King
  2 siblings, 0 replies; 4+ messages in thread
From: Colin Ian King @ 2020-09-22  8:16 UTC (permalink / raw)
  To: Piyush Goyal, Liam Girdwood, Mark Brown, Matthias Brugger,
	linux-arm-kernel, linux-mediatek
  Cc: linux-kernel

I believe these patches should have gone directly to me and not various
other folk.

Colin

On 22/09/2020 08:27, Piyush Goyal wrote:
> Exercise shmat syscall with invalid flags resulting in more kernel
> coverage.
> 
> Signed-off-by: Piyush Goyal <piyushgoyaliit@gmail.com>
> ---
>  stress-shm-sysv.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/stress-shm-sysv.c b/stress-shm-sysv.c
> index aa03d718..5a3e0cc1 100644
> --- a/stress-shm-sysv.c
> +++ b/stress-shm-sysv.c
> @@ -128,6 +128,19 @@ static int stress_shm_sysv_check(
>  	return 0;
>  }
>  
> +/*
> + *  exercise_shmat()
> + *	exercise shmat syscall with all possible values of arguments
> + */
> +static void exercise_shmat(int shm_id)
> +{
> +	void *addr;
> +
> +	/* Exercise shmat syscall with invalid flags */
> +	addr = shmat(shm_id, NULL, ~0);
> +	(void)addr;
> +}
> +
>  #if defined(__linux__)
>  /*
>   *  stress_shm_get_procinfo()
> @@ -337,6 +350,7 @@ static int stress_shm_sysv_child(
>  				goto reap;
>  			}
>  
> +			exercise_shmat(shm_id);
>  			addr = shmat(shm_id, NULL, 0);
>  			if (addr == (char *) -1) {
>  				ok = false;
> 


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

end of thread, other threads:[~2020-09-22  8:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-22  7:27 [PATCH 1/3] stress-shm-sysv: exercise shmat with invalid flags Piyush Goyal
2020-09-22  7:27 ` [PATCH 2/3] stress-shm-sysv: exercise shmat with all possible flags Piyush Goyal
2020-09-22  7:27 ` [PATCH 3/3] stress-shmsysv: exercise shmat with SHM_REMAP flag on NULL address Piyush Goyal
2020-09-22  8:16 ` [PATCH 1/3] stress-shm-sysv: exercise shmat with invalid flags Colin Ian King

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).