History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Cross-merge networking fixes after downstream PR. No conflicts (or adjacent changes of note).

Jakub Kicinski committed 3 years ago

Commit 2606cf02 parents 49e7265 f291209550 files · +5537 −3311Browse files

Showing the changes to tools/include/uapi (3 of 550 files). Show all

Unified · Split

3 files
  1. tools/include/uapi/asm-generic/unistd.h +4 −1
  2. tools/include/uapi/drm/drm.h +69 −15
  3. tools/include/uapi/linux/seccomp.h +157 −0
tools/include/uapi/asm-generic/unistd.h+4−1
@@ -820,8 +820,11 @@ __SYSCALL(__NR_set_mempolicy_home_node, sys_set_mempolicy_home_node) · 819 unmodified lines
820#define __NR_cachestat 451820#define __NR_cachestat 451
821__SYSCALL(__NR_cachestat, sys_cachestat)821__SYSCALL(__NR_cachestat, sys_cachestat)
822 822
823#define __NR_fchmodat2 452
824__SYSCALL(__NR_fchmodat2, sys_fchmodat2)
825
823#undef __NR_syscalls826#undef __NR_syscalls
824#define __NR_syscalls 452827#define __NR_syscalls 453
825 828
826/*829/*
827 * 32 bit systems traditionally used different830 * 32 bit systems traditionally used different
tools/include/uapi/drm/drm.h+69−15
@@ -673,8 +673,11 @@ struct drm_gem_open { · 672 unmodified lines
673 * Bitfield of supported PRIME sharing capabilities. See &DRM_PRIME_CAP_IMPORT673 * Bitfield of supported PRIME sharing capabilities. See &DRM_PRIME_CAP_IMPORT
674 * and &DRM_PRIME_CAP_EXPORT.674 * and &DRM_PRIME_CAP_EXPORT.
675 *675 *
676 * PRIME buffers are exposed as dma-buf file descriptors. See676 * Starting from kernel version 6.6, both &DRM_PRIME_CAP_IMPORT and
677 * Documentation/gpu/drm-mm.rst, section "PRIME Buffer Sharing".677 * &DRM_PRIME_CAP_EXPORT are always advertised.
678 *
679 * PRIME buffers are exposed as dma-buf file descriptors.
680 * See :ref:`prime_buffer_sharing`.
678 */681 */
679#define DRM_CAP_PRIME 0x5682#define DRM_CAP_PRIME 0x5
680/**683/**
@@ -682,6 +685,8 @@ struct drm_gem_open { · 1 unmodified line
682 *685 *
683 * If this bit is set in &DRM_CAP_PRIME, the driver supports importing PRIME686 * If this bit is set in &DRM_CAP_PRIME, the driver supports importing PRIME
684 * buffers via the &DRM_IOCTL_PRIME_FD_TO_HANDLE ioctl.687 * buffers via the &DRM_IOCTL_PRIME_FD_TO_HANDLE ioctl.
688 *
689 * Starting from kernel version 6.6, this bit is always set in &DRM_CAP_PRIME.
685 */690 */
686#define DRM_PRIME_CAP_IMPORT 0x1691#define DRM_PRIME_CAP_IMPORT 0x1
687/**692/**
@@ -689,6 +694,8 @@ struct drm_gem_open { · 1 unmodified line
689 *694 *
690 * If this bit is set in &DRM_CAP_PRIME, the driver supports exporting PRIME695 * If this bit is set in &DRM_CAP_PRIME, the driver supports exporting PRIME
691 * buffers via the &DRM_IOCTL_PRIME_HANDLE_TO_FD ioctl.696 * buffers via the &DRM_IOCTL_PRIME_HANDLE_TO_FD ioctl.
697 *
698 * Starting from kernel version 6.6, this bit is always set in &DRM_CAP_PRIME.
692 */699 */
693#define DRM_PRIME_CAP_EXPORT 0x2700#define DRM_PRIME_CAP_EXPORT 0x2
694/**701/**
@@ -756,15 +763,14 @@ struct drm_gem_open { · 61 unmodified lines
756/**763/**
757 * DRM_CAP_SYNCOBJ764 * DRM_CAP_SYNCOBJ
758 *765 *
759 * If set to 1, the driver supports sync objects. See766 * If set to 1, the driver supports sync objects. See :ref:`drm_sync_objects`.
760 * Documentation/gpu/drm-mm.rst, section "DRM Sync Objects".
761 */767 */
762#define DRM_CAP_SYNCOBJ 0x13768#define DRM_CAP_SYNCOBJ 0x13
763/**769/**
764 * DRM_CAP_SYNCOBJ_TIMELINE770 * DRM_CAP_SYNCOBJ_TIMELINE
765 *771 *
766 * If set to 1, the driver supports timeline operations on sync objects. See772 * If set to 1, the driver supports timeline operations on sync objects. See
767 * Documentation/gpu/drm-mm.rst, section "DRM Sync Objects".773 * :ref:`drm_sync_objects`.
768 */774 */
769#define DRM_CAP_SYNCOBJ_TIMELINE 0x14775#define DRM_CAP_SYNCOBJ_TIMELINE 0x14
770 776
@@ -909,6 +915,27 @@ struct drm_syncobj_timeline_wait { · 138 unmodified lines
909 __u32 pad;915 __u32 pad;
910};916};
911 917
918/**
919 * struct drm_syncobj_eventfd
920 * @handle: syncobj handle.
921 * @flags: Zero to wait for the point to be signalled, or
922 * &DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE to wait for a fence to be
923 * available for the point.
924 * @point: syncobj timeline point (set to zero for binary syncobjs).
925 * @fd: Existing eventfd to sent events to.
926 * @pad: Must be zero.
927 *
928 * Register an eventfd to be signalled by a syncobj. The eventfd counter will
929 * be incremented by one.
930 */
931struct drm_syncobj_eventfd {
932 __u32 handle;
933 __u32 flags;
934 __u64 point;
935 __s32 fd;
936 __u32 pad;
937};
938
912 939
913struct drm_syncobj_array {940struct drm_syncobj_array {
914 __u64 handles;941 __u64 handles;
@@ -1169,6 +1196,8 @@ extern "C" { · 254 unmodified lines
1169 */1196 */
1170#define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)1197#define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)
1171 1198
1199#define DRM_IOCTL_SYNCOBJ_EVENTFD DRM_IOWR(0xCF, struct drm_syncobj_eventfd)
1200
1172/*1201/*
1173 * Device specific ioctls should only be in their respective headers1202 * Device specific ioctls should only be in their respective headers
1174 * The device specific ioctl range is from 0x40 to 0x9f.1203 * The device specific ioctl range is from 0x40 to 0x9f.
@@ -1180,25 +1209,50 @@ extern "C" { · 5 unmodified lines
1180#define DRM_COMMAND_BASE 0x401209#define DRM_COMMAND_BASE 0x40
1181#define DRM_COMMAND_END 0xA01210#define DRM_COMMAND_END 0xA0
1182 1211
1183/*1212/**
1184 * Header for events written back to userspace on the drm fd. The1213 * struct drm_event - Header for DRM events
1185 * type defines the type of event, the length specifies the total1214 * @type: event type.
1186 * length of the event (including the header), and user_data is1215 * @length: total number of payload bytes (including header).
1187 * typically a 64 bit value passed with the ioctl that triggered the
1188 * event. A read on the drm fd will always only return complete
1189 * events, that is, if for example the read buffer is 100 bytes, and
1190 * there are two 64 byte events pending, only one will be returned.
1191 *1216 *
1192 * Event types 0 - 0x7fffffff are generic drm events, 0x80000000 and1217 * This struct is a header for events written back to user-space on the DRM FD.
1193 * up are chipset specific.1218 * A read on the DRM FD will always only return complete events: e.g. if the
1219 * read buffer is 100 bytes large and there are two 64 byte events pending,
1220 * only one will be returned.
1221 *
1222 * Event types 0 - 0x7fffffff are generic DRM events, 0x80000000 and
1223 * up are chipset specific. Generic DRM events include &DRM_EVENT_VBLANK,
1224 * &DRM_EVENT_FLIP_COMPLETE and &DRM_EVENT_CRTC_SEQUENCE.
1194 */1225 */
1195struct drm_event {1226struct drm_event {
1196 __u32 type;1227 __u32 type;
1197 __u32 length;1228 __u32 length;
1198};1229};
1199 1230
1231/**
1232 * DRM_EVENT_VBLANK - vertical blanking event
1233 *
1234 * This event is sent in response to &DRM_IOCTL_WAIT_VBLANK with the
1235 * &_DRM_VBLANK_EVENT flag set.
1236 *
1237 * The event payload is a struct drm_event_vblank.
1238 */
1200#define DRM_EVENT_VBLANK 0x011239#define DRM_EVENT_VBLANK 0x01
1240/**
1241 * DRM_EVENT_FLIP_COMPLETE - page-flip completion event
1242 *
1243 * This event is sent in response to an atomic commit or legacy page-flip with
1244 * the &DRM_MODE_PAGE_FLIP_EVENT flag set.
1245 *
1246 * The event payload is a struct drm_event_vblank.
1247 */
1201#define DRM_EVENT_FLIP_COMPLETE 0x021248#define DRM_EVENT_FLIP_COMPLETE 0x02
1249/**
1250 * DRM_EVENT_CRTC_SEQUENCE - CRTC sequence event
1251 *
1252 * This event is sent in response to &DRM_IOCTL_CRTC_QUEUE_SEQUENCE.
1253 *
1254 * The event payload is a struct drm_event_crtc_sequence.
1255 */
1202#define DRM_EVENT_CRTC_SEQUENCE 0x031256#define DRM_EVENT_CRTC_SEQUENCE 0x03
1203 1257
1204struct drm_event_vblank {1258struct drm_event_vblank {
tools/include/uapi/linux/seccomp.h+157−0
@@ -0,0 +1,157 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _UAPI_LINUX_SECCOMP_H
3#define _UAPI_LINUX_SECCOMP_H
4
5#include <linux/compiler.h>
6#include <linux/types.h>
7
8
9/* Valid values for seccomp.mode and prctl(PR_SET_SECCOMP, <mode>) */
10#define SECCOMP_MODE_DISABLED 0 /* seccomp is not in use. */
11#define SECCOMP_MODE_STRICT 1 /* uses hard-coded filter. */
12#define SECCOMP_MODE_FILTER 2 /* uses user-supplied filter. */
13
14/* Valid operations for seccomp syscall. */
15#define SECCOMP_SET_MODE_STRICT 0
16#define SECCOMP_SET_MODE_FILTER 1
17#define SECCOMP_GET_ACTION_AVAIL 2
18#define SECCOMP_GET_NOTIF_SIZES 3
19
20/* Valid flags for SECCOMP_SET_MODE_FILTER */
21#define SECCOMP_FILTER_FLAG_TSYNC (1UL << 0)
22#define SECCOMP_FILTER_FLAG_LOG (1UL << 1)
23#define SECCOMP_FILTER_FLAG_SPEC_ALLOW (1UL << 2)
24#define SECCOMP_FILTER_FLAG_NEW_LISTENER (1UL << 3)
25#define SECCOMP_FILTER_FLAG_TSYNC_ESRCH (1UL << 4)
26/* Received notifications wait in killable state (only respond to fatal signals) */
27#define SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV (1UL << 5)
28
29/*
30 * All BPF programs must return a 32-bit value.
31 * The bottom 16-bits are for optional return data.
32 * The upper 16-bits are ordered from least permissive values to most,
33 * as a signed value (so 0x8000000 is negative).
34 *
35 * The ordering ensures that a min_t() over composed return values always
36 * selects the least permissive choice.
37 */
38#define SECCOMP_RET_KILL_PROCESS 0x80000000U /* kill the process */
39#define SECCOMP_RET_KILL_THREAD 0x00000000U /* kill the thread */
40#define SECCOMP_RET_KILL SECCOMP_RET_KILL_THREAD
41#define SECCOMP_RET_TRAP 0x00030000U /* disallow and force a SIGSYS */
42#define SECCOMP_RET_ERRNO 0x00050000U /* returns an errno */
43#define SECCOMP_RET_USER_NOTIF 0x7fc00000U /* notifies userspace */
44#define SECCOMP_RET_TRACE 0x7ff00000U /* pass to a tracer or disallow */
45#define SECCOMP_RET_LOG 0x7ffc0000U /* allow after logging */
46#define SECCOMP_RET_ALLOW 0x7fff0000U /* allow */
47
48/* Masks for the return value sections. */
49#define SECCOMP_RET_ACTION_FULL 0xffff0000U
50#define SECCOMP_RET_ACTION 0x7fff0000U
51#define SECCOMP_RET_DATA 0x0000ffffU
52
53/**
54 * struct seccomp_data - the format the BPF program executes over.
55 * @nr: the system call number
56 * @arch: indicates system call convention as an AUDIT_ARCH_* value
57 * as defined in <linux/audit.h>.
58 * @instruction_pointer: at the time of the system call.
59 * @args: up to 6 system call arguments always stored as 64-bit values
60 * regardless of the architecture.
61 */
62struct seccomp_data {
63 int nr;
64 __u32 arch;
65 __u64 instruction_pointer;
66 __u64 args[6];
67};
68
69struct seccomp_notif_sizes {
70 __u16 seccomp_notif;
71 __u16 seccomp_notif_resp;
72 __u16 seccomp_data;
73};
74
75struct seccomp_notif {
76 __u64 id;
77 __u32 pid;
78 __u32 flags;
79 struct seccomp_data data;
80};
81
82/*
83 * Valid flags for struct seccomp_notif_resp
84 *
85 * Note, the SECCOMP_USER_NOTIF_FLAG_CONTINUE flag must be used with caution!
86 * If set by the process supervising the syscalls of another process the
87 * syscall will continue. This is problematic because of an inherent TOCTOU.
88 * An attacker can exploit the time while the supervised process is waiting on
89 * a response from the supervising process to rewrite syscall arguments which
90 * are passed as pointers of the intercepted syscall.
91 * It should be absolutely clear that this means that the seccomp notifier
92 * _cannot_ be used to implement a security policy! It should only ever be used
93 * in scenarios where a more privileged process supervises the syscalls of a
94 * lesser privileged process to get around kernel-enforced security
95 * restrictions when the privileged process deems this safe. In other words,
96 * in order to continue a syscall the supervising process should be sure that
97 * another security mechanism or the kernel itself will sufficiently block
98 * syscalls if arguments are rewritten to something unsafe.
99 *
100 * Similar precautions should be applied when stacking SECCOMP_RET_USER_NOTIF
101 * or SECCOMP_RET_TRACE. For SECCOMP_RET_USER_NOTIF filters acting on the
102 * same syscall, the most recently added filter takes precedence. This means
103 * that the new SECCOMP_RET_USER_NOTIF filter can override any
104 * SECCOMP_IOCTL_NOTIF_SEND from earlier filters, essentially allowing all
105 * such filtered syscalls to be executed by sending the response
106 * SECCOMP_USER_NOTIF_FLAG_CONTINUE. Note that SECCOMP_RET_TRACE can equally
107 * be overriden by SECCOMP_USER_NOTIF_FLAG_CONTINUE.
108 */
109#define SECCOMP_USER_NOTIF_FLAG_CONTINUE (1UL << 0)
110
111struct seccomp_notif_resp {
112 __u64 id;
113 __s64 val;
114 __s32 error;
115 __u32 flags;
116};
117
118#define SECCOMP_USER_NOTIF_FD_SYNC_WAKE_UP (1UL << 0)
119
120/* valid flags for seccomp_notif_addfd */
121#define SECCOMP_ADDFD_FLAG_SETFD (1UL << 0) /* Specify remote fd */
122#define SECCOMP_ADDFD_FLAG_SEND (1UL << 1) /* Addfd and return it, atomically */
123
124/**
125 * struct seccomp_notif_addfd
126 * @id: The ID of the seccomp notification
127 * @flags: SECCOMP_ADDFD_FLAG_*
128 * @srcfd: The local fd number
129 * @newfd: Optional remote FD number if SETFD option is set, otherwise 0.
130 * @newfd_flags: The O_* flags the remote FD should have applied
131 */
132struct seccomp_notif_addfd {
133 __u64 id;
134 __u32 flags;
135 __u32 srcfd;
136 __u32 newfd;
137 __u32 newfd_flags;
138};
139
140#define SECCOMP_IOC_MAGIC '!'
141#define SECCOMP_IO(nr) _IO(SECCOMP_IOC_MAGIC, nr)
142#define SECCOMP_IOR(nr, type) _IOR(SECCOMP_IOC_MAGIC, nr, type)
143#define SECCOMP_IOW(nr, type) _IOW(SECCOMP_IOC_MAGIC, nr, type)
144#define SECCOMP_IOWR(nr, type) _IOWR(SECCOMP_IOC_MAGIC, nr, type)
145
146/* Flags for seccomp notification fd ioctl. */
147#define SECCOMP_IOCTL_NOTIF_RECV SECCOMP_IOWR(0, struct seccomp_notif)
148#define SECCOMP_IOCTL_NOTIF_SEND SECCOMP_IOWR(1, \
149 struct seccomp_notif_resp)
150#define SECCOMP_IOCTL_NOTIF_ID_VALID SECCOMP_IOW(2, __u64)
151/* On success, the return value is the remote process's added fd number */
152#define SECCOMP_IOCTL_NOTIF_ADDFD SECCOMP_IOW(3, \
153 struct seccomp_notif_addfd)
154
155#define SECCOMP_IOCTL_NOTIF_SET_FLAGS SECCOMP_IOW(4, __u64)
156
157#endif /* _UAPI_LINUX_SECCOMP_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t