All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/capget02: Use pid=0 instead of getpid()
@ 2020-01-09  7:00 Yang Xu
  2020-01-09  7:24 ` Yang Xu
  0 siblings, 1 reply; 6+ messages in thread
From: Yang Xu @ 2020-01-09  7:00 UTC (permalink / raw)
  To: ltp

Since pid=0 returns the capabilities for the calling thread,
we can remove getpid and use pid=0 instead of it. Also we
can cover this test point.

Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
---
 testcases/kernel/syscalls/capget/capget02.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/testcases/kernel/syscalls/capget/capget02.c b/testcases/kernel/syscalls/capget/capget02.c
index 42c76a011..0a23700b9 100644
--- a/testcases/kernel/syscalls/capget/capget02.c
+++ b/testcases/kernel/syscalls/capget/capget02.c
@@ -69,15 +69,13 @@ static void verify_capget(unsigned int n)
 
 static void setup(void)
 {
-	unsigned int i, pid;
-
-	pid = getpid();
+	unsigned int i;
 
 	header.version = 0x19980330;
-	header.pid = pid;
+	header.pid = 0;
 
 	bad_version_header.version = 0;
-	bad_version_header.pid = pid;
+	bad_version_header.pid = 0;
 
 	bad_pid_header.version = 0x19980330;
 	bad_pid_header.pid = -1;
-- 
2.18.0




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

* [LTP] [PATCH] syscalls/capget02: Use pid=0 instead of getpid()
  2020-01-09  7:00 [LTP] [PATCH] syscalls/capget02: Use pid=0 instead of getpid() Yang Xu
@ 2020-01-09  7:24 ` Yang Xu
  2020-01-09  9:59   ` Cyril Hrubis
  0 siblings, 1 reply; 6+ messages in thread
From: Yang Xu @ 2020-01-09  7:24 UTC (permalink / raw)
  To: ltp

Hi
> Since pid=0 returns the capabilities for the calling thread,
> we can remove getpid and use pid=0 instead of it. Also we
> can cover this test point.
Since I defined static struct, I think it doesn't need pid=0 assignment. 
I will send a v2 and add comment.
> 
> Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
> ---
>   testcases/kernel/syscalls/capget/capget02.c | 8 +++-----
>   1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/capget/capget02.c b/testcases/kernel/syscalls/capget/capget02.c
> index 42c76a011..0a23700b9 100644
> --- a/testcases/kernel/syscalls/capget/capget02.c
> +++ b/testcases/kernel/syscalls/capget/capget02.c
> @@ -69,15 +69,13 @@ static void verify_capget(unsigned int n)
>   
>   static void setup(void)
>   {
> -	unsigned int i, pid;
> -
> -	pid = getpid();
> +	unsigned int i;
>   
>   	header.version = 0x19980330;
> -	header.pid = pid;
> +	header.pid = 0;
>   
>   	bad_version_header.version = 0;
> -	bad_version_header.pid = pid;
> +	bad_version_header.pid = 0;
>   
>   	bad_pid_header.version = 0x19980330;
>   	bad_pid_header.pid = -1;
> 



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

* [LTP] [PATCH] syscalls/capget02: Use pid=0 instead of getpid()
  2020-01-09  7:24 ` Yang Xu
@ 2020-01-09  9:59   ` Cyril Hrubis
  2020-01-09 10:14     ` Yang Xu
  0 siblings, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2020-01-09  9:59 UTC (permalink / raw)
  To: ltp

Hi!
> > Since pid=0 returns the capabilities for the calling thread,
> > we can remove getpid and use pid=0 instead of it. Also we
> > can cover this test point.
> Since I defined static struct, I think it doesn't need pid=0 assignment. 
> I will send a v2 and add comment.

If you are at it, can you also allocate guarded buffers instead?

https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines#2231-guarded-buffers

-- 
Cyril Hrubis
chrubis@suse.cz

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

* [LTP] [PATCH] syscalls/capget02: Use pid=0 instead of getpid()
  2020-01-09  9:59   ` Cyril Hrubis
@ 2020-01-09 10:14     ` Yang Xu
  2020-01-10 16:46       ` Petr Vorel
  0 siblings, 1 reply; 6+ messages in thread
From: Yang Xu @ 2020-01-09 10:14 UTC (permalink / raw)
  To: ltp

Hi!> Hi!
>>> Since pid=0 returns the capabilities for the calling thread,
>>> we can remove getpid and use pid=0 instead of it. Also we
>>> can cover this test point.
>> Since I defined static struct, I think it doesn't need pid=0 assignment.
>> I will send a v2 and add comment.
> 
> If you are at it, can you also allocate guarded buffers instead?
Sure, I will use guarded buffers instead.
> 
> https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines#2231-guarded-buffers
> 



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

* [LTP] [PATCH] syscalls/capget02: Use pid=0 instead of getpid()
  2020-01-09 10:14     ` Yang Xu
@ 2020-01-10 16:46       ` Petr Vorel
  2020-01-13  1:21         ` Yang Xu
  0 siblings, 1 reply; 6+ messages in thread
From: Petr Vorel @ 2020-01-10 16:46 UTC (permalink / raw)
  To: ltp

Hi,

FYI this was replaced by
https://patchwork.ozlabs.org/patch/1220805/
and merged as ad57b6090 syscalls/capget[set]: Make use of guarded buffers


Kind regards,
Petr

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

* [LTP] [PATCH] syscalls/capget02: Use pid=0 instead of getpid()
  2020-01-10 16:46       ` Petr Vorel
@ 2020-01-13  1:21         ` Yang Xu
  0 siblings, 0 replies; 6+ messages in thread
From: Yang Xu @ 2020-01-13  1:21 UTC (permalink / raw)
  To: ltp

Hi
> Hi,
> 
> FYI this was replaced by
> https://patchwork.ozlabs.org/patch/1220805/
> and merged as ad57b6090 syscalls/capget[set]: Make use of guarded buffers
> 
Thanks for your review and merge.

Best Regards
Yang Xu
> 
> Kind regards,
> Petr
> 
> 



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

end of thread, other threads:[~2020-01-13  1:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-09  7:00 [LTP] [PATCH] syscalls/capget02: Use pid=0 instead of getpid() Yang Xu
2020-01-09  7:24 ` Yang Xu
2020-01-09  9:59   ` Cyril Hrubis
2020-01-09 10:14     ` Yang Xu
2020-01-10 16:46       ` Petr Vorel
2020-01-13  1:21         ` Yang Xu

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.