Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/kernel Run the attach_pid1 test (from t_ptrace) in unp...
details: https://anonhg.NetBSD.org/src/rev/0d12964d0347
branches: trunk
changeset: 348770:0d12964d0347
user: kamil <kamil%NetBSD.org@localhost>
date: Sun Nov 06 21:47:53 2016 +0000
description:
Run the attach_pid1 test (from t_ptrace) in unprivileged mode
Add in ATF_TC_HEAD() of attach_pid1 the following code to run it as
non-root: atf_tc_set_md_var(tc, "require.user", "unprivileged");
Solution pointed out by Nicolas Joly.
Sponsored by <The NetBSD Foundation>.
diffstat:
tests/kernel/t_ptrace.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diffs (34 lines):
diff -r 9a57058b2344 -r 0d12964d0347 tests/kernel/t_ptrace.c
--- a/tests/kernel/t_ptrace.c Sun Nov 06 21:29:54 2016 +0000
+++ b/tests/kernel/t_ptrace.c Sun Nov 06 21:47:53 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ptrace.c,v 1.11 2016/11/06 16:24:16 kamil Exp $ */
+/* $NetBSD: t_ptrace.c,v 1.12 2016/11/06 21:47:53 kamil Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ptrace.c,v 1.11 2016/11/06 16:24:16 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace.c,v 1.12 2016/11/06 21:47:53 kamil Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -641,13 +641,12 @@
{
atf_tc_set_md_var(tc, "descr",
"Assert that a debugger cannot attach to PID 1 (as non-root)");
+
+ atf_tc_set_md_var(tc, "require.user", "unprivileged");
}
ATF_TC_BODY(attach_pid1, tc)
{
- if (getuid() == 0)
- atf_tc_skip("Test must be run as non-root");
-
errno = 0;
ATF_REQUIRE(ptrace(PT_ATTACH, 1, NULL, 0) == -1);
ATF_REQUIRE(errno == EPERM);
Home |
Main Index |
Thread Index |
Old Index