History

Merge tag 'fsnotify_for_v6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs

Pull fsnotify updates from Jan Kara: "Support for auditing decisions regarding fanotify permission events" * tag 'fsnotify_for_v6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: fanotify,audit: Allow audit to use the full permission event response fanotify: define struct members to hold response decision context fanotify: Ensure consistent variable type for response

Linus Torvalds committed 3 years ago

Commit cd776a42 parents 6639c3c 032bffd7 files · +131 −33Browse files

Showing the changes to include/uapi (1 of 7 files). Show all

Unified · Split

include/uapi/linux/fanotify.h+29−1
@@ -188,15 +188,43 @@ struct fanotify_event_info_error { · 187 unmodified lines
188188 __u32 error_count;
189189 };
190190
191+/*
192+ * User space may need to record additional information about its decision.
193+ * The extra information type records what kind of information is included.
194+ * The default is none. We also define an extra information buffer whose
195+ * size is determined by the extra information type.
196+ *
197+ * If the information type is Audit Rule, then the information following
198+ * is the rule number that triggered the user space decision that
199+ * requires auditing.
200+ */
201+
202+#define FAN_RESPONSE_INFO_NONE 0
203+#define FAN_RESPONSE_INFO_AUDIT_RULE 1
204+
191205 struct fanotify_response {
192206 __s32 fd;
193207 __u32 response;
194208 };
195209
210+struct fanotify_response_info_header {
211+ __u8 type;
212+ __u8 pad;
213+ __u16 len;
214+};
215+
216+struct fanotify_response_info_audit_rule {
217+ struct fanotify_response_info_header hdr;
218+ __u32 rule_number;
219+ __u32 subj_trust;
220+ __u32 obj_trust;
221+};
222+
196223 /* Legit userspace responses to a _PERM event */
197224 #define FAN_ALLOW 0x01
198225 #define FAN_DENY 0x02
199−#define FAN_AUDIT 0x10 /* Bit mask to create audit record for result */
226+#define FAN_AUDIT 0x10 /* Bitmask to create audit record for result */
227+#define FAN_INFO 0x20 /* Bitmask to indicate additional information */
200228
201229 /* No fd set in event */
202230 #define FAN_NOFD -1