Debian Codegraph @

upstream/debian-unstable/man2/PR_SET_SECCOMP.2const

raw
1 .\" Copyright 2008-2015, Michael Kerrisk <[email protected]>
2 .\" Copyright, the authors of the Linux man-pages project
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .TH PR_SET_SECCOMP 2const 2026-02-08 "Linux man-pages 6.18"
7 .SH NAME
8 PR_SET_SECCOMP
9 \-
10 set the secure computing mode
11 .SH LIBRARY
12 Standard C library
13 .RI ( libc ,\~ \-lc )
14 .SH SYNOPSIS
15 .nf
16 .BR "#include <linux/prctl.h>" " /* Definition of " PR_* " constants */"
17 .B #include <sys/prctl.h>
18 .P
19 .B [[deprecated]]
20 .BI "int prctl(PR_SET_SECCOMP, long " mode ", ...);"
21 .P
22 .B [[deprecated]]
23 .B int prctl(PR_SET_SECCOMP, SECCOMP_MODE_STRICT);
24 .B [[deprecated]]
25 .B int prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER,
26 .BI " struct sock_fprog *" filter );
27 .fi
28 .SH DESCRIPTION
29 Set the secure computing (seccomp) mode for the calling thread,
30 to limit the available system calls.
31 The more recent
32 .BR seccomp (2)
33 system call provides a superset of the functionality of
34 .BR PR_SET_SECCOMP ,
35 and is the preferred interface for new applications.
36 .P
37 The seccomp mode is selected via
38 .IR mode .
39 The seccomp constants are defined in
40 .IR <linux/seccomp.h> .
41 The following values can be specified:
42 .TP
43 .BR SECCOMP_MODE_STRICT " (since Linux 2.6.23)"
44 See the description of
45 .B SECCOMP_SET_MODE_STRICT
46 in
47 .BR seccomp (2).
48 .IP
49 This operation is available only
50 if the kernel is configured with
51 .B CONFIG_SECCOMP
52 enabled.
53 .TP
54 .BR SECCOMP_MODE_FILTER " (since Linux 3.5)"
55 The allowed system calls are defined by a pointer
56 to a Berkeley Packet Filter passed in
57 .IR filter .
58 It can be designed to filter
59 arbitrary system calls and system call arguments.
60 See the description of
61 .B SECCOMP_SET_MODE_FILTER
62 in
63 .BR seccomp (2).
64 .IP
65 This operation is available only
66 if the kernel is configured with
67 .B CONFIG_SECCOMP_FILTER
68 enabled.
69 .SH RETURN VALUE
70 On success,
71 0 is returned.
72 On error, \-1 is returned, and
73 .I errno
74 is set to indicate the error.
75 .SH ERRORS
76 .TP
77 .B EACCES
78 .I mode
79 is
80 .BR SECCOMP_MODE_FILTER ,
81 but the process does not have the
82 .B CAP_SYS_ADMIN
83 capability or has not set the
84 .I no_new_privs
85 attribute (see
86 .BR PR_SET_NO_NEW_PRIVS (2const)).
87 .TP
88 .B EFAULT
89 .I mode
90 is
91 .BR SECCOMP_MODE_FILTER ,
92 and
93 .I filter
94 is an invalid address.
95 .TP
96 .B EINVAL
97 .I mode
98 is not a valid value.
99 .TP
100 .B EINVAL
101 The kernel was not configured with
102 .BR CONFIG_SECCOMP .
103 .TP
104 .B EINVAL
105 .I mode
106 is
107 .BR SECCOMP_MODE_FILTER ,
108 and the kernel was not configured with
109 .BR CONFIG_SECCOMP_FILTER .
110 .SH STANDARDS
111 Linux.
112 .SH HISTORY
113 Linux 2.6.23.
114 .\" See http://thread.gmane.org/gmane.linux.kernel/542632
115 .\" [PATCH 0 of 2] seccomp updates
116 .\" [email protected]
117 .SH SEE ALSO
118 .BR prctl (2),
119 .BR PR_GET_SECCOMP (2const),
120 .BR seccomp (2)