diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-09-27 11:01:26 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-09-30 16:29:22 -0400 |
commit | 0ae4061223a3d097222cbec6599370e54db17731 (patch) | |
tree | be862c305ba2c4c037281b3e3ce6793ce3796cb3 /tools | |
parent | 05f371f8c55d69e4c04db4473085303291e4e734 (diff) |
tools headers uapi: Sync linux/fs.h with the kernel sources
To pick the changes from:
78a1b96bcf7a ("fscrypt: add FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS ioctl")
23c688b54016 ("fscrypt: allow unprivileged users to add/remove keys for v2 policies")
5dae460c2292 ("fscrypt: v2 encryption policy support")
5a7e29924dac ("fscrypt: add FS_IOC_GET_ENCRYPTION_KEY_STATUS ioctl")
b1c0ec3599f4 ("fscrypt: add FS_IOC_REMOVE_ENCRYPTION_KEY ioctl")
22d94f493bfb ("fscrypt: add FS_IOC_ADD_ENCRYPTION_KEY ioctl")
3b6df59bc4d2 ("fscrypt: use FSCRYPT_* definitions, not FS_*")
2336d0deb2d4 ("fscrypt: use FSCRYPT_ prefix for uapi constants")
7af0ab0d3aab ("fs, fscrypt: move uapi definitions to new header <linux/fscrypt.h>")
That don't trigger any changes in tooling, as it so far is used only
for:
$ grep -l 'fs\.h' tools/perf/trace/beauty/*.sh | xargs grep regex=
tools/perf/trace/beauty/rename_flags.sh:regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+RENAME_([[:alnum:]_]+)[[:space:]]+\(1[[:space:]]*<<[[:space:]]*([[:xdigit:]]+)[[:space:]]*\)[[:space:]]*.*'
tools/perf/trace/beauty/sync_file_range.sh:regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+SYNC_FILE_RANGE_([[:alnum:]_]+)[[:space:]]+([[:xdigit:]]+)[[:space:]]*.*'
tools/perf/trace/beauty/usbdevfs_ioctl.sh:regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)(\(\w+\))?[[:space:]]+_IO[CWR]{0,2}\([[:space:]]*(_IOC_\w+,[[:space:]]*)?'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*"
tools/perf/trace/beauty/usbdevfs_ioctl.sh:regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)[[:space:]]+_IO[WR]{0,2}\([[:space:]]*'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*"
$
This silences this perf build warning:
Warning: Kernel ABI header at 'tools/include/uapi/linux/fs.h' differs from latest version at 'include/uapi/linux/fs.h'
diff -u tools/include/uapi/linux/fs.h include/uapi/linux/fs.h
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Eric Biggers <ebiggers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-44g48exl9br9ba0t64chqb4i@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/include/uapi/linux/fs.h | 55 | ||||
-rw-r--r-- | tools/include/uapi/linux/fscrypt.h | 181 | ||||
-rwxr-xr-x | tools/perf/check-headers.sh | 1 |
3 files changed, 186 insertions, 51 deletions
diff --git a/tools/include/uapi/linux/fs.h b/tools/include/uapi/linux/fs.h index 2a616aa3f686..379a612f8f1d 100644 --- a/tools/include/uapi/linux/fs.h +++ b/tools/include/uapi/linux/fs.h | |||
@@ -13,6 +13,9 @@ | |||
13 | #include <linux/limits.h> | 13 | #include <linux/limits.h> |
14 | #include <linux/ioctl.h> | 14 | #include <linux/ioctl.h> |
15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
16 | #ifndef __KERNEL__ | ||
17 | #include <linux/fscrypt.h> | ||
18 | #endif | ||
16 | 19 | ||
17 | /* Use of MS_* flags within the kernel is restricted to core mount(2) code. */ | 20 | /* Use of MS_* flags within the kernel is restricted to core mount(2) code. */ |
18 | #if !defined(__KERNEL__) | 21 | #if !defined(__KERNEL__) |
@@ -213,57 +216,6 @@ struct fsxattr { | |||
213 | #define FS_IOC_SETFSLABEL _IOW(0x94, 50, char[FSLABEL_MAX]) | 216 | #define FS_IOC_SETFSLABEL _IOW(0x94, 50, char[FSLABEL_MAX]) |
214 | 217 | ||
215 | /* | 218 | /* |
216 | * File system encryption support | ||
217 | */ | ||
218 | /* Policy provided via an ioctl on the topmost directory */ | ||
219 | #define FS_KEY_DESCRIPTOR_SIZE 8 | ||
220 | |||
221 | #define FS_POLICY_FLAGS_PAD_4 0x00 | ||
222 | #define FS_POLICY_FLAGS_PAD_8 0x01 | ||
223 | #define FS_POLICY_FLAGS_PAD_16 0x02 | ||
224 | #define FS_POLICY_FLAGS_PAD_32 0x03 | ||
225 | #define FS_POLICY_FLAGS_PAD_MASK 0x03 | ||
226 | #define FS_POLICY_FLAG_DIRECT_KEY 0x04 /* use master key directly */ | ||
227 | #define FS_POLICY_FLAGS_VALID 0x07 | ||
228 | |||
229 | /* Encryption algorithms */ | ||
230 | #define FS_ENCRYPTION_MODE_INVALID 0 | ||
231 | #define FS_ENCRYPTION_MODE_AES_256_XTS 1 | ||
232 | #define FS_ENCRYPTION_MODE_AES_256_GCM 2 | ||
233 | #define FS_ENCRYPTION_MODE_AES_256_CBC 3 | ||
234 | #define FS_ENCRYPTION_MODE_AES_256_CTS 4 | ||
235 | #define FS_ENCRYPTION_MODE_AES_128_CBC 5 | ||
236 | #define FS_ENCRYPTION_MODE_AES_128_CTS 6 | ||
237 | #define FS_ENCRYPTION_MODE_SPECK128_256_XTS 7 /* Removed, do not use. */ | ||
238 | #define FS_ENCRYPTION_MODE_SPECK128_256_CTS 8 /* Removed, do not use. */ | ||
239 | #define FS_ENCRYPTION_MODE_ADIANTUM 9 | ||
240 | |||
241 | struct fscrypt_policy { | ||
242 | __u8 version; | ||
243 | __u8 contents_encryption_mode; | ||
244 | __u8 filenames_encryption_mode; | ||
245 | __u8 flags; | ||
246 | __u8 master_key_descriptor[FS_KEY_DESCRIPTOR_SIZE]; | ||
247 | }; | ||
248 | |||
249 | #define FS_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct fscrypt_policy) | ||
250 | #define FS_IOC_GET_ENCRYPTION_PWSALT _IOW('f', 20, __u8[16]) | ||
251 | #define FS_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct fscrypt_policy) | ||
252 | |||
253 | /* Parameters for passing an encryption key into the kernel keyring */ | ||
254 | #define FS_KEY_DESC_PREFIX "fscrypt:" | ||
255 | #define FS_KEY_DESC_PREFIX_SIZE 8 | ||
256 | |||
257 | /* Structure that userspace passes to the kernel keyring */ | ||
258 | #define FS_MAX_KEY_SIZE 64 | ||
259 | |||
260 | struct fscrypt_key { | ||
261 | __u32 mode; | ||
262 | __u8 raw[FS_MAX_KEY_SIZE]; | ||
263 | __u32 size; | ||
264 | }; | ||
265 | |||
266 | /* | ||
267 | * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS) | 219 | * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS) |
268 | * | 220 | * |
269 | * Note: for historical reasons, these flags were originally used and | 221 | * Note: for historical reasons, these flags were originally used and |
@@ -306,6 +258,7 @@ struct fscrypt_key { | |||
306 | #define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ | 258 | #define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ |
307 | #define FS_HUGE_FILE_FL 0x00040000 /* Reserved for ext4 */ | 259 | #define FS_HUGE_FILE_FL 0x00040000 /* Reserved for ext4 */ |
308 | #define FS_EXTENT_FL 0x00080000 /* Extents */ | 260 | #define FS_EXTENT_FL 0x00080000 /* Extents */ |
261 | #define FS_VERITY_FL 0x00100000 /* Verity protected inode */ | ||
309 | #define FS_EA_INODE_FL 0x00200000 /* Inode used for large EA */ | 262 | #define FS_EA_INODE_FL 0x00200000 /* Inode used for large EA */ |
310 | #define FS_EOFBLOCKS_FL 0x00400000 /* Reserved for ext4 */ | 263 | #define FS_EOFBLOCKS_FL 0x00400000 /* Reserved for ext4 */ |
311 | #define FS_NOCOW_FL 0x00800000 /* Do not cow file */ | 264 | #define FS_NOCOW_FL 0x00800000 /* Do not cow file */ |
diff --git a/tools/include/uapi/linux/fscrypt.h b/tools/include/uapi/linux/fscrypt.h new file mode 100644 index 000000000000..39ccfe9311c3 --- /dev/null +++ b/tools/include/uapi/linux/fscrypt.h | |||
@@ -0,0 +1,181 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
2 | /* | ||
3 | * fscrypt user API | ||
4 | * | ||
5 | * These ioctls can be used on filesystems that support fscrypt. See the | ||
6 | * "User API" section of Documentation/filesystems/fscrypt.rst. | ||
7 | */ | ||
8 | #ifndef _UAPI_LINUX_FSCRYPT_H | ||
9 | #define _UAPI_LINUX_FSCRYPT_H | ||
10 | |||
11 | #include <linux/types.h> | ||
12 | |||
13 | /* Encryption policy flags */ | ||
14 | #define FSCRYPT_POLICY_FLAGS_PAD_4 0x00 | ||
15 | #define FSCRYPT_POLICY_FLAGS_PAD_8 0x01 | ||
16 | #define FSCRYPT_POLICY_FLAGS_PAD_16 0x02 | ||
17 | #define FSCRYPT_POLICY_FLAGS_PAD_32 0x03 | ||
18 | #define FSCRYPT_POLICY_FLAGS_PAD_MASK 0x03 | ||
19 | #define FSCRYPT_POLICY_FLAG_DIRECT_KEY 0x04 | ||
20 | #define FSCRYPT_POLICY_FLAGS_VALID 0x07 | ||
21 | |||
22 | /* Encryption algorithms */ | ||
23 | #define FSCRYPT_MODE_AES_256_XTS 1 | ||
24 | #define FSCRYPT_MODE_AES_256_CTS 4 | ||
25 | #define FSCRYPT_MODE_AES_128_CBC 5 | ||
26 | #define FSCRYPT_MODE_AES_128_CTS 6 | ||
27 | #define FSCRYPT_MODE_ADIANTUM 9 | ||
28 | #define __FSCRYPT_MODE_MAX 9 | ||
29 | |||
30 | /* | ||
31 | * Legacy policy version; ad-hoc KDF and no key verification. | ||
32 | * For new encrypted directories, use fscrypt_policy_v2 instead. | ||
33 | * | ||
34 | * Careful: the .version field for this is actually 0, not 1. | ||
35 | */ | ||
36 | #define FSCRYPT_POLICY_V1 0 | ||
37 | #define FSCRYPT_KEY_DESCRIPTOR_SIZE 8 | ||
38 | struct fscrypt_policy_v1 { | ||
39 | __u8 version; | ||
40 | __u8 contents_encryption_mode; | ||
41 | __u8 filenames_encryption_mode; | ||
42 | __u8 flags; | ||
43 | __u8 master_key_descriptor[FSCRYPT_KEY_DESCRIPTOR_SIZE]; | ||
44 | }; | ||
45 | #define fscrypt_policy fscrypt_policy_v1 | ||
46 | |||
47 | /* | ||
48 | * Process-subscribed "logon" key description prefix and payload format. | ||
49 | * Deprecated; prefer FS_IOC_ADD_ENCRYPTION_KEY instead. | ||
50 | */ | ||
51 | #define FSCRYPT_KEY_DESC_PREFIX "fscrypt:" | ||
52 | #define FSCRYPT_KEY_DESC_PREFIX_SIZE 8 | ||
53 | #define FSCRYPT_MAX_KEY_SIZE 64 | ||
54 | struct fscrypt_key { | ||
55 | __u32 mode; | ||
56 | __u8 raw[FSCRYPT_MAX_KEY_SIZE]; | ||
57 | __u32 size; | ||
58 | }; | ||
59 | |||
60 | /* | ||
61 | * New policy version with HKDF and key verification (recommended). | ||
62 | */ | ||
63 | #define FSCRYPT_POLICY_V2 2 | ||
64 | #define FSCRYPT_KEY_IDENTIFIER_SIZE 16 | ||
65 | struct fscrypt_policy_v2 { | ||
66 | __u8 version; | ||
67 | __u8 contents_encryption_mode; | ||
68 | __u8 filenames_encryption_mode; | ||
69 | __u8 flags; | ||
70 | __u8 __reserved[4]; | ||
71 | __u8 master_key_identifier[FSCRYPT_KEY_IDENTIFIER_SIZE]; | ||
72 | }; | ||
73 | |||
74 | /* Struct passed to FS_IOC_GET_ENCRYPTION_POLICY_EX */ | ||
75 | struct fscrypt_get_policy_ex_arg { | ||
76 | __u64 policy_size; /* input/output */ | ||
77 | union { | ||
78 | __u8 version; | ||
79 | struct fscrypt_policy_v1 v1; | ||
80 | struct fscrypt_policy_v2 v2; | ||
81 | } policy; /* output */ | ||
82 | }; | ||
83 | |||
84 | /* | ||
85 | * v1 policy keys are specified by an arbitrary 8-byte key "descriptor", | ||
86 | * matching fscrypt_policy_v1::master_key_descriptor. | ||
87 | */ | ||
88 | #define FSCRYPT_KEY_SPEC_TYPE_DESCRIPTOR 1 | ||
89 | |||
90 | /* | ||
91 | * v2 policy keys are specified by a 16-byte key "identifier" which the kernel | ||
92 | * calculates as a cryptographic hash of the key itself, | ||
93 | * matching fscrypt_policy_v2::master_key_identifier. | ||
94 | */ | ||
95 | #define FSCRYPT_KEY_SPEC_TYPE_IDENTIFIER 2 | ||
96 | |||
97 | /* | ||
98 | * Specifies a key, either for v1 or v2 policies. This doesn't contain the | ||
99 | * actual key itself; this is just the "name" of the key. | ||
100 | */ | ||
101 | struct fscrypt_key_specifier { | ||
102 | __u32 type; /* one of FSCRYPT_KEY_SPEC_TYPE_* */ | ||
103 | __u32 __reserved; | ||
104 | union { | ||
105 | __u8 __reserved[32]; /* reserve some extra space */ | ||
106 | __u8 descriptor[FSCRYPT_KEY_DESCRIPTOR_SIZE]; | ||
107 | __u8 identifier[FSCRYPT_KEY_IDENTIFIER_SIZE]; | ||
108 | } u; | ||
109 | }; | ||
110 | |||
111 | /* Struct passed to FS_IOC_ADD_ENCRYPTION_KEY */ | ||
112 | struct fscrypt_add_key_arg { | ||
113 | struct fscrypt_key_specifier key_spec; | ||
114 | __u32 raw_size; | ||
115 | __u32 __reserved[9]; | ||
116 | __u8 raw[]; | ||
117 | }; | ||
118 | |||
119 | /* Struct passed to FS_IOC_REMOVE_ENCRYPTION_KEY */ | ||
120 | struct fscrypt_remove_key_arg { | ||
121 | struct fscrypt_key_specifier key_spec; | ||
122 | #define FSCRYPT_KEY_REMOVAL_STATUS_FLAG_FILES_BUSY 0x00000001 | ||
123 | #define FSCRYPT_KEY_REMOVAL_STATUS_FLAG_OTHER_USERS 0x00000002 | ||
124 | __u32 removal_status_flags; /* output */ | ||
125 | __u32 __reserved[5]; | ||
126 | }; | ||
127 | |||
128 | /* Struct passed to FS_IOC_GET_ENCRYPTION_KEY_STATUS */ | ||
129 | struct fscrypt_get_key_status_arg { | ||
130 | /* input */ | ||
131 | struct fscrypt_key_specifier key_spec; | ||
132 | __u32 __reserved[6]; | ||
133 | |||
134 | /* output */ | ||
135 | #define FSCRYPT_KEY_STATUS_ABSENT 1 | ||
136 | #define FSCRYPT_KEY_STATUS_PRESENT 2 | ||
137 | #define FSCRYPT_KEY_STATUS_INCOMPLETELY_REMOVED 3 | ||
138 | __u32 status; | ||
139 | #define FSCRYPT_KEY_STATUS_FLAG_ADDED_BY_SELF 0x00000001 | ||
140 | __u32 status_flags; | ||
141 | __u32 user_count; | ||
142 | __u32 __out_reserved[13]; | ||
143 | }; | ||
144 | |||
145 | #define FS_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct fscrypt_policy) | ||
146 | #define FS_IOC_GET_ENCRYPTION_PWSALT _IOW('f', 20, __u8[16]) | ||
147 | #define FS_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct fscrypt_policy) | ||
148 | #define FS_IOC_GET_ENCRYPTION_POLICY_EX _IOWR('f', 22, __u8[9]) /* size + version */ | ||
149 | #define FS_IOC_ADD_ENCRYPTION_KEY _IOWR('f', 23, struct fscrypt_add_key_arg) | ||
150 | #define FS_IOC_REMOVE_ENCRYPTION_KEY _IOWR('f', 24, struct fscrypt_remove_key_arg) | ||
151 | #define FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS _IOWR('f', 25, struct fscrypt_remove_key_arg) | ||
152 | #define FS_IOC_GET_ENCRYPTION_KEY_STATUS _IOWR('f', 26, struct fscrypt_get_key_status_arg) | ||
153 | |||
154 | /**********************************************************************/ | ||
155 | |||
156 | /* old names; don't add anything new here! */ | ||
157 | #ifndef __KERNEL__ | ||
158 | #define FS_KEY_DESCRIPTOR_SIZE FSCRYPT_KEY_DESCRIPTOR_SIZE | ||
159 | #define FS_POLICY_FLAGS_PAD_4 FSCRYPT_POLICY_FLAGS_PAD_4 | ||
160 | #define FS_POLICY_FLAGS_PAD_8 FSCRYPT_POLICY_FLAGS_PAD_8 | ||
161 | #define FS_POLICY_FLAGS_PAD_16 FSCRYPT_POLICY_FLAGS_PAD_16 | ||
162 | #define FS_POLICY_FLAGS_PAD_32 FSCRYPT_POLICY_FLAGS_PAD_32 | ||
163 | #define FS_POLICY_FLAGS_PAD_MASK FSCRYPT_POLICY_FLAGS_PAD_MASK | ||
164 | #define FS_POLICY_FLAG_DIRECT_KEY FSCRYPT_POLICY_FLAG_DIRECT_KEY | ||
165 | #define FS_POLICY_FLAGS_VALID FSCRYPT_POLICY_FLAGS_VALID | ||
166 | #define FS_ENCRYPTION_MODE_INVALID 0 /* never used */ | ||
167 | #define FS_ENCRYPTION_MODE_AES_256_XTS FSCRYPT_MODE_AES_256_XTS | ||
168 | #define FS_ENCRYPTION_MODE_AES_256_GCM 2 /* never used */ | ||
169 | #define FS_ENCRYPTION_MODE_AES_256_CBC 3 /* never used */ | ||
170 | #define FS_ENCRYPTION_MODE_AES_256_CTS FSCRYPT_MODE_AES_256_CTS | ||
171 | #define FS_ENCRYPTION_MODE_AES_128_CBC FSCRYPT_MODE_AES_128_CBC | ||
172 | #define FS_ENCRYPTION_MODE_AES_128_CTS FSCRYPT_MODE_AES_128_CTS | ||
173 | #define FS_ENCRYPTION_MODE_SPECK128_256_XTS 7 /* removed */ | ||
174 | #define FS_ENCRYPTION_MODE_SPECK128_256_CTS 8 /* removed */ | ||
175 | #define FS_ENCRYPTION_MODE_ADIANTUM FSCRYPT_MODE_ADIANTUM | ||
176 | #define FS_KEY_DESC_PREFIX FSCRYPT_KEY_DESC_PREFIX | ||
177 | #define FS_KEY_DESC_PREFIX_SIZE FSCRYPT_KEY_DESC_PREFIX_SIZE | ||
178 | #define FS_MAX_KEY_SIZE FSCRYPT_MAX_KEY_SIZE | ||
179 | #endif /* !__KERNEL__ */ | ||
180 | |||
181 | #endif /* _UAPI_LINUX_FSCRYPT_H */ | ||
diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh index e2e0f06c97d0..cea13cb987d0 100755 --- a/tools/perf/check-headers.sh +++ b/tools/perf/check-headers.sh | |||
@@ -8,6 +8,7 @@ include/uapi/drm/i915_drm.h | |||
8 | include/uapi/linux/fadvise.h | 8 | include/uapi/linux/fadvise.h |
9 | include/uapi/linux/fcntl.h | 9 | include/uapi/linux/fcntl.h |
10 | include/uapi/linux/fs.h | 10 | include/uapi/linux/fs.h |
11 | include/uapi/linux/fscrypt.h | ||
11 | include/uapi/linux/kcmp.h | 12 | include/uapi/linux/kcmp.h |
12 | include/uapi/linux/kvm.h | 13 | include/uapi/linux/kvm.h |
13 | include/uapi/linux/in.h | 14 | include/uapi/linux/in.h |