Debian Codegraph @

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

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