/test/xts/hats/kernel/syscalls/process/prctl/ |
H A D | PrctlApiTest.cpp | 16 #include <sys/prctl.h> 53 * @tc.desc : prctl option PR_SET_NAME/PR_GET_NAME/PR_SET_PDEATHSIG/PR_GET_PDEATHSIG test success. 65 // prctl set and get PR_SET_NAME test success in HWTEST_F() 66 int ret = prctl(PR_SET_NAME, name); in HWTEST_F() 69 ret = prctl(PR_GET_NAME, buffer); in HWTEST_F() 73 // prctl set and get PR_SET_PDEATHSIG success in HWTEST_F() 75 ret = prctl(PR_SET_PDEATHSIG, setOption[0]); in HWTEST_F() 79 ret = prctl(PR_GET_PDEATHSIG, &getOption[0]); in HWTEST_F() 87 * @tc.desc : prctl option PR_SET_KEEPCAPS/PR_CAPBSET_READ/PR_CAPBSET_DROP/PR_CAP_AMBIENT test success. 97 // prctl PR_SET_KEEPCAP in HWTEST_F() [all...] |
/kernel/linux/linux-6.6/tools/testing/selftests/syscall_user_dispatch/ |
H A D | sud_test.c | 9 #include <sys/prctl.h> 47 * parameters on prctl 68 ret = prctl(PR_SET_SYSCALL_USER_DISPATCH, PR_SYS_DISPATCH_ON, 0, 0, &sel); in TEST_SIGNAL() 89 prctl(PR_SET_SYSCALL_USER_DISPATCH, op, 0, 0, &sel); in TEST() 96 prctl(PR_SET_SYSCALL_USER_DISPATCH, op, 0x1, 0x0, 0); in TEST() 100 prctl(PR_SET_SYSCALL_USER_DISPATCH, op, 0x0, 0xff, 0); in TEST() 104 prctl(PR_SET_SYSCALL_USER_DISPATCH, op, 0x0, 0x0, &sel); in TEST() 109 prctl(PR_SET_SYSCALL_USER_DISPATCH, op, 0x0, 0x0, 0x0); in TEST() 116 prctl(PR_SET_SYSCALL_USER_DISPATCH, op, 0x1, 0x0, &sel); in TEST() 118 prctl(PR_SET_SYSCALL_USER_DISPATC in TEST() [all...] |
/kernel/linux/linux-5.10/tools/testing/selftests/seccomp/ |
H A D | seccomp_bpf.c | 25 #include <sys/prctl.h> 28 #include <linux/prctl.h> 327 ret = prctl(PR_SET_SECCOMP, SECCOMP_MODE_STRICT, NULL, NULL, NULL); in TEST() 338 ret = prctl(PR_SET_SECCOMP, SECCOMP_MODE_STRICT, NULL, NULL, NULL); in TEST_SIGNAL() 354 ret = prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0); in TEST() 365 ret = prctl(PR_SET_NO_NEW_PRIVS, 1, NULL, 0, 0); in TEST() 369 ret = prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, NULL, NULL); in TEST() 387 ret = prctl(PR_GET_NO_NEW_PRIVS, 0, NULL, 0, 0); in TEST() 392 ret = prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &prog, 0, 0); in TEST() 422 ret = prctl(PR_SET_NO_NEW_PRIV in TEST() [all...] |
/kernel/linux/linux-6.6/tools/testing/selftests/riscv/vector/ |
H A D | vstate_prctl.c | 2 #include <sys/prctl.h> 63 rc = prctl(PR_RISCV_V_SET_CONTROL, provided); in test_and_compare_child() 65 ksft_test_result_fail("prctl with provided arg %lx failed with code %d\n", in test_and_compare_child() 100 rc = prctl(PR_RISCV_V_GET_CONTROL); in main() 106 rc = prctl(PR_RISCV_V_SET_CONTROL, PR_RISCV_V_VSTATE_CTRL_ON); in main() 117 rc = prctl(PR_RISCV_V_SET_CONTROL, flag); in main() 124 rc = prctl(PR_RISCV_V_SET_CONTROL, flag); in main() 162 rc = prctl(PR_RISCV_V_SET_CONTROL, 0xff0); in main() 168 rc = prctl(PR_RISCV_V_SET_CONTROL, 0x3); in main() 174 rc = prctl(PR_RISCV_V_SET_CONTRO in main() [all...] |
/kernel/linux/linux-5.10/tools/testing/selftests/prctl/ |
H A D | disable-tsc-test.c | 3 * Tests for prctl(PR_GET_TSC, ...) / prctl(PR_SET_TSC, ...) 15 #include <sys/prctl.h> 16 #include <linux/prctl.h> 46 printf("prctl(PR_GET_TSC, &tsc_val); "); in sigsegv_cb() 49 if ( prctl(PR_GET_TSC, &tsc_val) == -1) in sigsegv_cb() 50 perror("prctl"); in sigsegv_cb() 53 printf("prctl(PR_SET_TSC, PR_TSC_ENABLE)\n"); in sigsegv_cb() 55 if ( prctl(PR_SET_TSC, PR_TSC_ENABLE) == -1) in sigsegv_cb() 56 perror("prctl"); in sigsegv_cb() [all...] |
H A D | disable-tsc-on-off-stress-test.c | 3 * Tests for prctl(PR_GET_TSC, ...) / prctl(PR_SET_TSC, ...) 6 * when set with prctl() 20 #include <sys/prctl.h> 21 #include <linux/prctl.h> 50 if (prctl(PR_SET_TSC, PR_TSC_ENABLE) < 0) in sigsegv_cb() 52 perror("prctl"); in sigsegv_cb() 72 if (prctl(PR_SET_TSC, PR_TSC_SIGSEGV) < 0) in task() 74 perror("prctl"); in task()
|
H A D | disable-tsc-ctxt-sw-stress-test.c | 3 * Tests for prctl(PR_GET_TSC, ...) / prctl(PR_SET_TSC, ...) 20 #include <sys/prctl.h> 21 #include <linux/prctl.h> 46 if (prctl(PR_SET_TSC, PR_TSC_SIGSEGV) < 0) in segvtask() 48 perror("prctl"); in segvtask() 67 if (prctl(PR_SET_TSC, PR_TSC_ENABLE) < 0) in rdtsctask() 69 perror("prctl"); in rdtsctask()
|
/kernel/linux/linux-6.6/tools/testing/selftests/prctl/ |
H A D | disable-tsc-test.c | 3 * Tests for prctl(PR_GET_TSC, ...) / prctl(PR_SET_TSC, ...) 15 #include <sys/prctl.h> 16 #include <linux/prctl.h> 46 printf("prctl(PR_GET_TSC, &tsc_val); "); in sigsegv_cb() 49 if ( prctl(PR_GET_TSC, &tsc_val) == -1) in sigsegv_cb() 50 perror("prctl"); in sigsegv_cb() 53 printf("prctl(PR_SET_TSC, PR_TSC_ENABLE)\n"); in sigsegv_cb() 55 if ( prctl(PR_SET_TSC, PR_TSC_ENABLE) == -1) in sigsegv_cb() 56 perror("prctl"); in sigsegv_cb() [all...] |
H A D | disable-tsc-on-off-stress-test.c | 3 * Tests for prctl(PR_GET_TSC, ...) / prctl(PR_SET_TSC, ...) 6 * when set with prctl() 20 #include <sys/prctl.h> 21 #include <linux/prctl.h> 50 if (prctl(PR_SET_TSC, PR_TSC_ENABLE) < 0) in sigsegv_cb() 52 perror("prctl"); in sigsegv_cb() 72 if (prctl(PR_SET_TSC, PR_TSC_SIGSEGV) < 0) in task() 74 perror("prctl"); in task()
|
H A D | set-process-name.c | 3 * This test covers the PR_SET_NAME functionality of prctl calls 7 #include <sys/prctl.h> 20 res = prctl(PR_SET_NAME, name, NULL, NULL, NULL); in set_name() 32 res = prctl(PR_GET_NAME, name, NULL, NULL, NULL); in check_is_name_correct() 45 res = prctl(PR_GET_NAME, name, NULL, NULL, NULL); in check_null_pointer()
|
/third_party/ltp/testcases/kernel/syscalls/prctl/ |
H A D | prctl07.c | 10 * Test the PR_CAP_AMBIENT of prctl(2). 30 #include <sys/prctl.h> 37 #include "lapi/prctl.h" 48 TEST(prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, cap, 0, 0)); in check_cap_raise() 74 TEST(prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_IS_SET, cap, 0, 0)); in check_cap_is_set() 87 TEST(prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_LOWER, cap, 0, 0)); in check_cap_lower() 122 prctl(PR_SET_SECUREBITS, SECBIT_NO_CAP_AMBIENT_RAISE); in verify_prctl() 124 prctl(PR_SET_SECUREBITS, 0); in verify_prctl() 142 prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, CAP_NET_BIND_SERVICE, 0, 0); in verify_prctl() 144 TEST(prctl(PR_CAP_AMBIEN in verify_prctl() [all...] |
H A D | prctl08.c | 10 * Test PR_GET_TIMERSLACK and PR_SET_TIMERSLACK of prctl(2). 21 * and no person will set this over 4s. prctl return value is int, so 28 #include <sys/prctl.h> 34 #include "lapi/prctl.h" 66 TEST(prctl(PR_GET_TIMERSLACK)); in check_get_timerslack() 68 tst_res(TPASS, "%s prctl(PR_GET_TIMERSLACK) got %lu expectedly", in check_get_timerslack() 71 tst_res(TFAIL, "%s prctl(PR_GET_TIMERSLACK) expected %lu got %lu", in check_get_timerslack() 86 current_value = prctl(PR_GET_TIMERSLACK); in check_inherit_timerslack() 87 prctl(PR_SET_TIMERSLACK, 0); in check_inherit_timerslack() 88 default_value = prctl(PR_GET_TIMERSLAC in check_inherit_timerslack() [all...] |
H A D | prctl02.c | 45 #include <sys/prctl.h> 53 #include "lapi/prctl.h" 60 #define unsup_string "prctl() doesn't support this option, skip it" 155 TEST(prctl(tc->option, *tc->arg2, *tc->arg3, 0, 0)); in verify_prctl() 157 tst_res(TFAIL, "prctl() succeeded unexpectedly"); in verify_prctl() 162 tst_res(TPASS | TTERRNO, "prctl() failed as expected"); in verify_prctl() 167 tst_res(TFAIL | TTERRNO, "prctl() failed unexpectedly, expected %s", in verify_prctl() 176 TEST(prctl(PR_GET_SECCOMP)); in setup() 180 TEST(prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0)); in setup() 184 TEST(prctl(PR_GET_THP_DISABL in setup() [all...] |
H A D | prctl04.c | 10 * Test PR_GET_SECCOMP and PR_SET_SECCOMP of prctl(2). 30 #include <sys/prctl.h> 39 #include "lapi/prctl.h" 127 TEST(prctl(PR_SET_SECCOMP, SECCOMP_MODE_STRICT)); in check_strict_mode() 130 "prctl(PR_SET_SECCOMP) sets SECCOMP_MODE_STRICT failed"); in check_strict_mode() 137 "prctl(PR_SET_SECCOMP) sets SECCOMP_MODE_STRICT succeed"); in check_strict_mode() 138 prctl(PR_GET_SECCOMP); in check_strict_mode() 139 tst_res(TFAIL, "prctl(PR_GET_SECCOMP) succeed unexpectedly"); in check_strict_mode() 168 TEST(prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &strict)); in check_filter_mode() 171 "prctl(PR_SET_SECCOM in check_filter_mode() [all...] |
/kernel/linux/linux-6.6/tools/testing/selftests/mm/ |
H A D | mdwe_test.c | 8 #include <linux/prctl.h> 13 #include <sys/prctl.h> 25 EXPECT_LT(prctl(PR_SET_MDWE, 7L, 0L, 0L, 0L), 0); in TEST() 26 EXPECT_LT(prctl(PR_SET_MDWE, 0L, 7L, 0L, 0L), 0); in TEST() 27 EXPECT_LT(prctl(PR_SET_MDWE, 0L, 0L, 7L, 0L), 0); in TEST() 28 EXPECT_LT(prctl(PR_SET_MDWE, 0L, 0L, 0L, 7L), 0); in TEST() 30 EXPECT_LT(prctl(PR_GET_MDWE, 7L, 0L, 0L, 0L), 0); in TEST() 31 EXPECT_LT(prctl(PR_GET_MDWE, 0L, 7L, 0L, 0L), 0); in TEST() 32 EXPECT_LT(prctl(PR_GET_MDWE, 0L, 0L, 7L, 0L), 0); in TEST() 33 EXPECT_LT(prctl(PR_GET_MDW in TEST() [all...] |
H A D | ksm_functional_tests.c | 18 #include <sys/prctl.h> 187 ret = prctl(PR_SET_MEMORY_MERGE, 1, 0, 0, 0); in mmap_and_merge_range() 398 /* Verify that KSM can be enabled / queried with prctl. */ 405 ret = prctl(PR_SET_MEMORY_MERGE, 1, 0, 0, 0); in test_prctl() 414 ret = prctl(PR_GET_MEMORY_MERGE, 0, 0, 0, 0); in test_prctl() 423 ret = prctl(PR_SET_MEMORY_MERGE, 0, 0, 0, 0); in test_prctl() 429 ret = prctl(PR_GET_MEMORY_MERGE, 0, 0, 0, 0); in test_prctl() 441 /* Verify that prctl ksm flag is inherited. */ 449 ret = prctl(PR_SET_MEMORY_MERGE, 1, 0, 0, 0); in test_prctl_fork() 460 exit(prctl(PR_GET_MEMORY_MERG in test_prctl_fork() [all...] |
/third_party/ltp/testcases/kernel/mce-test/hwpoison/ |
H A D | tprctl.c | 1 // test prctl per process setting 7 #include <sys/prctl.h> 72 err = prctl(PR_MCE_KILL_GET, 0, 0, 0, 0, 0); in main() 77 if (prctl(PR_MCE_KILL, PR_MCE_KILL_SET, PR_MCE_KILL_LATE, 0, 0, 0) < 0) in main() 80 if (prctl(PR_MCE_KILL, PR_MCE_KILL_SET, PR_MCE_KILL_EARLY, 0, 0, 0) < 0) in main() 83 err = prctl(PR_MCE_KILL_GET, 0, 0, 0,0,0); in main() 88 if (prctl(PR_MCE_KILL, PR_MCE_KILL_CLEAR, 0, 0,0,0) < 0) in main() 90 err = prctl(PR_MCE_KILL_GET, 0, 0, 0, 0, 0); in main()
|
/third_party/ltp/testcases/kernel/mce-test/tsrc/ |
H A D | tprctl.c | 1 // test prctl per process setting 7 #include <sys/prctl.h> 72 err = prctl(PR_MCE_KILL_GET, 0, 0, 0, 0, 0); in main() 77 if (prctl(PR_MCE_KILL, PR_MCE_KILL_SET, PR_MCE_KILL_LATE, 0, 0, 0) < 0) in main() 80 if (prctl(PR_MCE_KILL, PR_MCE_KILL_SET, PR_MCE_KILL_EARLY, 0, 0, 0) < 0) in main() 83 err = prctl(PR_MCE_KILL_GET, 0, 0, 0,0,0); in main() 88 if (prctl(PR_MCE_KILL, PR_MCE_KILL_CLEAR, 0, 0,0,0) < 0) in main() 90 err = prctl(PR_MCE_KILL_GET, 0, 0, 0, 0, 0); in main()
|
/kernel/linux/linux-6.6/tools/testing/selftests/seccomp/ |
H A D | seccomp_bpf.c | 25 #include <sys/prctl.h> 28 #include <linux/prctl.h> 340 ret = prctl(PR_SET_SECCOMP, SECCOMP_MODE_STRICT, NULL, NULL, NULL); in TEST() 351 ret = prctl(PR_SET_SECCOMP, SECCOMP_MODE_STRICT, NULL, NULL, NULL); in TEST_SIGNAL() 367 ret = prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0); in TEST() 378 ret = prctl(PR_SET_NO_NEW_PRIVS, 1, NULL, 0, 0); in TEST() 382 ret = prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, NULL, NULL); in TEST() 402 ret = prctl(PR_GET_NO_NEW_PRIVS, 0, NULL, 0, 0); in TEST() 407 ret = prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &prog, 0, 0); in TEST() 437 ret = prctl(PR_SET_NO_NEW_PRIV in TEST() [all...] |
/third_party/ltp/testcases/kernel/security/cap_bound/ |
H A D | cap_bounds_rw.c | 32 #include <sys/prctl.h> 49 ret = prctl(PR_CAPBSET_READ, i); in check_remaining_caps() 69 ret = prctl(PR_CAPBSET_READ, i); in check_remaining_caps() 103 ret = prctl(PR_CAPBSET_READ, -1); in main() 110 "prctl(PR_CAPBSET_DROP, -1) returned %d", in main() 119 ret = prctl(PR_CAPBSET_DROP, MAX(INSANE, CAP_LAST_CAP + 1)); in main() 125 tst_resm(TFAIL, "prctl(PR_CAPBSET_DROP, %d) returned %d", in main() 133 ret = prctl(PR_CAPBSET_DROP, i); in main() 140 "prctl(PR_CAPBSET_DROP, %d) returned %d", i, in main()
|
/third_party/ltp/testcases/kernel/security/securebits/ |
H A D | check_keepcaps.c | 7 #include <sys/prctl.h> 18 a. do with prctl(PR_SET_KEEPCAPS) 20 b. do with prctl(PR_SET_SECUREBITS, SECURE_KEEP_CAPS) 104 ret = prctl(PR_GET_KEEPCAPS); in main() 119 ret = prctl(PR_SET_KEEPCAPS, 1); in main() 124 ret = prctl(PR_GET_KEEPCAPS); in main() 131 ret = prctl(PR_GET_SECUREBITS); in main() 132 ret = prctl(PR_SET_SECUREBITS, ret | SECBIT_KEEP_CAPS); in main() 137 ret = prctl(PR_GET_KEEPCAPS); in main()
|
/kernel/linux/linux-5.10/tools/testing/selftests/capabilities/ |
H A D | test_execve.c | 18 #include <sys/prctl.h> 105 if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) != 0) in create_and_enter_ns() 285 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, CAP_NET_BIND_SERVICE, 0, 0, 0) != -1 || errno != EPERM) { in do_tests() 302 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, CAP_NET_RAW, 0, 0, 0) != -1 || errno != EPERM) { in do_tests() 313 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, CAP_NET_BIND_SERVICE, 0, 0, 0) != 0) { in do_tests() 320 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_IS_SET, CAP_NET_BIND_SERVICE, 0, 0, 0) != 1) { in do_tests() 325 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_CLEAR_ALL, 0, 0, 0, 0) != 0) in do_tests() 329 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_IS_SET, CAP_NET_BIND_SERVICE, 0, 0, 0) != 0) { in do_tests() 335 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, CAP_NET_BIND_SERVICE, 0, 0, 0) != 0) in do_tests() 343 if (prctl(PR_CAP_AMBIEN in do_tests() [all...] |
/kernel/linux/linux-6.6/tools/testing/selftests/capabilities/ |
H A D | test_execve.c | 18 #include <sys/prctl.h> 105 if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) != 0) in create_and_enter_ns() 285 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, CAP_NET_BIND_SERVICE, 0, 0, 0) != -1 || errno != EPERM) { in do_tests() 302 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, CAP_NET_RAW, 0, 0, 0) != -1 || errno != EPERM) { in do_tests() 313 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, CAP_NET_BIND_SERVICE, 0, 0, 0) != 0) { in do_tests() 320 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_IS_SET, CAP_NET_BIND_SERVICE, 0, 0, 0) != 1) { in do_tests() 325 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_CLEAR_ALL, 0, 0, 0, 0) != 0) in do_tests() 329 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_IS_SET, CAP_NET_BIND_SERVICE, 0, 0, 0) != 0) { in do_tests() 335 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, CAP_NET_BIND_SERVICE, 0, 0, 0) != 0) in do_tests() 343 if (prctl(PR_CAP_AMBIEN in do_tests() [all...] |
/kernel/linux/linux-6.6/tools/testing/selftests/arm64/fp/ |
H A D | vec-syscfg.c | 16 #include <sys/prctl.h> 306 /* Can we read back a VL from prctl? */ 311 ret = prctl(data->prctl_get); in prctl_get() 313 ksft_test_result_fail("%s prctl() read failed: %d (%s)\n", in prctl_get() 326 ksft_test_result_fail("%s prctl() VL %d but RDVL is %d\n", in prctl_get() 330 /* Does the prctl let us set the VL we already have? */ 336 ret = prctl(data->prctl_set, cur_vl); in prctl_set_same() 338 ksft_test_result_fail("%s prctl set failed: %d (%s)\n", in prctl_set_same() 360 ret = prctl(data->prctl_set, data->min_vl); in prctl_set() 362 ksft_test_result_fail("%s prctl se in prctl_set() [all...] |
/base/startup/init/services/init/adapter/ |
H A D | init_adapter.c | 19 #include <sys/prctl.h>
35 if (prctl(PR_SET_SECUREBITS, SECBIT_NO_SETUID_FIXUP | SECBIT_NO_SETUID_FIXUP_LOCKED)) {
in KeepCapability() 36 INIT_LOGE("prctl PR_SET_SECUREBITS failed: %d", errno);
in KeepCapability() 43 if (prctl(PR_SET_SECUREBITS, SECBIT_NO_SETUID_FIXUP | SECBIT_NO_SETUID_FIXUP_LOCKED)) {
in KeepCapability() 44 INIT_LOGE("prctl PR_SET_SECUREBITS failed: %d", errno);
in KeepCapability() 49 if (prctl(PR_SET_SECUREBITS, SECBIT_KEEP_CAPS | SECBIT_KEEP_CAPS_LOCKED)) {
in KeepCapability() 50 INIT_LOGE("prctl PR_SET_SECUREBITS failed: %d", errno);
in KeepCapability() 61 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, cap, 0, 0)) {
in SetAmbientCapability() 62 INIT_LOGE("prctl PR_CAP_AMBIENT failed: %d", errno);
in SetAmbientCapability()
|