All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/userfaultfd01: Always require CAP_SYS_PTRACE
@ 2019-12-05  7:55 Yang Xu
  2020-01-21  5:24 ` Petr Vorel
  0 siblings, 1 reply; 7+ messages in thread
From: Yang Xu @ 2019-12-05  7:55 UTC (permalink / raw)
  To: ltp

Since commit cefdca0a86be ("userfaultfd/sysctl: add vm.unprivileged_userfaultfd").
, it adds a global sysctl knob "vm.unprivileged_userfaultfd" to control whether
unprivileged users can use the userfaultfd system calls.  Set this to 1 to allow
unprivileged users to use the userfaultfd system calls, or set this to 0 to
restrict userfaultfd to only privileged users (with SYS_CAP_PTRACE capability).The
default value is 1. In order to use userfaultfd always, require CAP_SYS_PTRACE.

Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
---
 include/lapi/capability.h                             | 4 ++++
 testcases/kernel/syscalls/userfaultfd/userfaultfd01.c | 7 ++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/lapi/capability.h b/include/lapi/capability.h
index 8833f0605..06c3f4921 100644
--- a/include/lapi/capability.h
+++ b/include/lapi/capability.h
@@ -24,6 +24,10 @@
 # define CAP_NET_RAW          13
 #endif
 
+#ifndef CAP_SYS_PTRACE
+# define CAP_SYS_PTRACE       19
+#endif
+
 #ifndef CAP_SYS_ADMIN
 # define CAP_SYS_ADMIN        21
 #endif
diff --git a/testcases/kernel/syscalls/userfaultfd/userfaultfd01.c b/testcases/kernel/syscalls/userfaultfd/userfaultfd01.c
index a5e142209..74d2d2253 100644
--- a/testcases/kernel/syscalls/userfaultfd/userfaultfd01.c
+++ b/testcases/kernel/syscalls/userfaultfd/userfaultfd01.c
@@ -19,6 +19,7 @@
 #include "tst_safe_macros.h"
 #include "tst_safe_pthread.h"
 #include "lapi/syscalls.h"
+#include "lapi/capability.h"
 
 static int page_size;
 static char *page;
@@ -114,7 +115,11 @@ static void run(void)
 static struct tst_test test = {
 	.test_all = run,
 	.min_kver = "4.3",
-	.timeout = 20
+	.timeout = 20,
+	.caps = (struct tst_cap []) {
+		TST_CAP(TST_CAP_REQ, CAP_SYS_PTRACE),
+		{}
+	}
 };
 
 #else
-- 
2.18.0




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

* [LTP] [PATCH] syscalls/userfaultfd01: Always require CAP_SYS_PTRACE
  2019-12-05  7:55 [LTP] [PATCH] syscalls/userfaultfd01: Always require CAP_SYS_PTRACE Yang Xu
@ 2020-01-21  5:24 ` Petr Vorel
  2020-01-21  5:54   ` Yang Xu
  0 siblings, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2020-01-21  5:24 UTC (permalink / raw)
  To: ltp

Hi Xu,

> Since commit cefdca0a86be ("userfaultfd/sysctl: add vm.unprivileged_userfaultfd").
> , it adds a global sysctl knob "vm.unprivileged_userfaultfd" to control whether
> unprivileged users can use the userfaultfd system calls.  Set this to 1 to allow
> unprivileged users to use the userfaultfd system calls, or set this to 0 to
> restrict userfaultfd to only privileged users (with SYS_CAP_PTRACE capability).The
> default value is 1. In order to use userfaultfd always, require CAP_SYS_PTRACE.

> Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Good idea, thanks!

Kind regards,
Petr

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

* [LTP] [PATCH] syscalls/userfaultfd01: Always require CAP_SYS_PTRACE
  2020-01-21  5:24 ` Petr Vorel
@ 2020-01-21  5:54   ` Yang Xu
  2020-01-21 10:17     ` Petr Vorel
  0 siblings, 1 reply; 7+ messages in thread
From: Yang Xu @ 2020-01-21  5:54 UTC (permalink / raw)
  To: ltp

Hi Peter

> Hi Xu,
>
>> Since commit cefdca0a86be ("userfaultfd/sysctl: add vm.unprivileged_userfaultfd").
>> , it adds a global sysctl knob "vm.unprivileged_userfaultfd" to control whether
>> unprivileged users can use the userfaultfd system calls.  Set this to 1 to allow
>> unprivileged users to use the userfaultfd system calls, or set this to 0 to
>> restrict userfaultfd to only privileged users (with SYS_CAP_PTRACE capability).The
>> default value is 1. In order to use userfaultfd always, require CAP_SYS_PTRACE.
>> Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> Good idea, thanks!

We have pushed "syscalls/userfaultfd01: add hint about unprivileged_userfaultfd" patch(v2)[1].

This is v1.? li Wang and me both think adding hint is more wise, more info see[2].

[1] https://github.com/linux-test-project/ltp/commit/7dc571d3ad1908d6e50163a06ef848f096fe880a
[2] http://lists.linux.it/pipermail/ltp/2020-January/014921.html

Best Regards
Yang Xu

> Kind regards,
> Petr
>
>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200121/5a4e74fb/attachment-0001.htm>

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

* [LTP] [PATCH] syscalls/userfaultfd01: Always require CAP_SYS_PTRACE
  2020-01-21  5:54   ` Yang Xu
@ 2020-01-21 10:17     ` Petr Vorel
  2020-01-22  1:04       ` Xiao Yang
  0 siblings, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2020-01-21 10:17 UTC (permalink / raw)
  To: ltp

Hi Xu,

> We have pushed "syscalls/userfaultfd01: add hint about unprivileged_userfaultfd" patch(v2)[1].

> This is v1.? li Wang and me both think adding hint is more wise, more info see[2].

> [1] https://github.com/linux-test-project/ltp/commit/7dc571d3ad1908d6e50163a06ef848f096fe880a
> [2] http://lists.linux.it/pipermail/ltp/2020-January/014921.html
Thanks for notification, I'll check previous commits next time!

BTW this was caused by maintainers not updating patchwork :(.
Would you mind to register to patchwork and check state of your tickets time to
time [1]. You'd be able to change state of your own patches.

Kind regards,
Petr

[1] https://patchwork.ozlabs.org/project/ltp/list/?submitter=76329

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

* [LTP] [PATCH] syscalls/userfaultfd01: Always require CAP_SYS_PTRACE
  2020-01-21 10:17     ` Petr Vorel
@ 2020-01-22  1:04       ` Xiao Yang
  2020-01-22  4:01         ` Yang Xu
  0 siblings, 1 reply; 7+ messages in thread
From: Xiao Yang @ 2020-01-22  1:04 UTC (permalink / raw)
  To: ltp

On 2020/1/21 18:17, Petr Vorel wrote:
> Hi Xu,
>
>> We have pushed "syscalls/userfaultfd01: add hint about unprivileged_userfaultfd" patch(v2)[1].
>> This is v1.  li Wang and me both think adding hint is more wise, more info see[2].
>> [1] https://github.com/linux-test-project/ltp/commit/7dc571d3ad1908d6e50163a06ef848f096fe880a
>> [2] http://lists.linux.it/pipermail/ltp/2020-January/014921.html
> Thanks for notification, I'll check previous commits next time!
>
> BTW this was caused by maintainers not updating patchwork :(.
> Would you mind to register to patchwork and check state of your tickets time to
> time [1]. You'd be able to change state of your own patches.
Hi Petr,

Thanks for your effort.
Xu is my colleague and I helped him change the state to superseded. :-)

Best Regards,
Xiao Yang
> Kind regards,
> Petr
>
> [1] https://patchwork.ozlabs.org/project/ltp/list/?submitter=76329
>




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

* [LTP] [PATCH] syscalls/userfaultfd01: Always require CAP_SYS_PTRACE
  2020-01-22  1:04       ` Xiao Yang
@ 2020-01-22  4:01         ` Yang Xu
  2020-01-22  7:42           ` Petr Vorel
  0 siblings, 1 reply; 7+ messages in thread
From: Yang Xu @ 2020-01-22  4:01 UTC (permalink / raw)
  To: ltp


> On 2020/1/21 18:17, Petr Vorel wrote:
>> Hi Xu,
>>
>>> We have pushed "syscalls/userfaultfd01: add hint about 
>>> unprivileged_userfaultfd" patch(v2)[1].
>>> This is v1.? li Wang and me both think adding hint is more wise, more 
>>> info see[2].
>>> [1] 
>>> https://github.com/linux-test-project/ltp/commit/7dc571d3ad1908d6e50163a06ef848f096fe880a 
>>>
>>> [2] http://lists.linux.it/pipermail/ltp/2020-January/014921.html
>> Thanks for notification, I'll check previous commits next time!
>>
>> BTW this was caused by maintainers not updating patchwork :(.
>> Would you mind to register to patchwork and check state of your 
>> tickets time to
>> time [1]. You'd be able to change state of your own patches.
Hi Petr
  I have registered to patchwork and I will change the state of my other 
patches later. Thanks for your kind advice.

also thanks for xiao that changed the state of this patch.

Best Regards
Yang Xu
> Hi Petr,
> 
> Thanks for your effort.
> Xu is my colleague and I helped him change the state to superseded. :-)
> 
> Best Regards,
> Xiao Yang
>> Kind regards,
>> Petr
>>
>> [1] https://patchwork.ozlabs.org/project/ltp/list/?submitter=76329
>>
> 



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

* [LTP] [PATCH] syscalls/userfaultfd01: Always require CAP_SYS_PTRACE
  2020-01-22  4:01         ` Yang Xu
@ 2020-01-22  7:42           ` Petr Vorel
  0 siblings, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2020-01-22  7:42 UTC (permalink / raw)
  To: ltp

Hi Xu,

> > > BTW this was caused by maintainers not updating patchwork :(.
> > > Would you mind to register to patchwork and check state of your
> > > tickets time to
> > > time [1]. You'd be able to change state of your own patches.
> Hi Petr
>  I have registered to patchwork and I will change the state of my other
> patches later. Thanks for your kind advice.
Thanks a lot! Normally it shouldn't be needed, but it can avoid errors
like this one.

> also thanks for xiao that changed the state of this patch.

Kind regards,
Petr

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

end of thread, other threads:[~2020-01-22  7:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-05  7:55 [LTP] [PATCH] syscalls/userfaultfd01: Always require CAP_SYS_PTRACE Yang Xu
2020-01-21  5:24 ` Petr Vorel
2020-01-21  5:54   ` Yang Xu
2020-01-21 10:17     ` Petr Vorel
2020-01-22  1:04       ` Xiao Yang
2020-01-22  4:01         ` Yang Xu
2020-01-22  7:42           ` Petr Vorel

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.