Skip to content

Commit 939a67f

Browse files
committed
Audit: split audit watch Kconfig
Audit watch should depend on CONFIG_AUDIT_SYSCALL and should select FSNOTIFY. This splits the spagetti like mixing of audit_watch and audit_filter code so they can be configured seperately. Signed-off-by: Eric Paris <eparis@redhat.com>
1 parent 67640b6 commit 939a67f

3 files changed

Lines changed: 21 additions & 4 deletions

File tree

‎init/Kconfig‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@ config TASK_IO_ACCOUNTING
307307
config AUDIT
308308
bool "Auditing support"
309309
depends on NET
310-
select FSNOTIFY
311310
help
312311
Enable auditing infrastructure that can be used with another
313312
kernel subsystem, such as SELinux (which requires this for
@@ -323,6 +322,11 @@ config AUDITSYSCALL
323322
can be used independently or with another kernel subsystem,
324323
such as SELinux.
325324

325+
config AUDIT_WATCH
326+
def_bool y
327+
depends on AUDITSYSCALL
328+
select FSNOTIFY
329+
326330
config AUDIT_TREE
327331
def_bool y
328332
depends on AUDITSYSCALL

‎kernel/Makefile‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,11 @@ obj-$(CONFIG_IKCONFIG) += configs.o
7070
obj-$(CONFIG_RESOURCE_COUNTERS) += res_counter.o
7171
obj-$(CONFIG_SMP) += stop_machine.o
7272
obj-$(CONFIG_KPROBES_SANITY_TEST) += test_kprobes.o
73-
obj-$(CONFIG_AUDIT) += audit.o auditfilter.o audit_watch.o
73+
obj-$(CONFIG_AUDIT) += audit.o auditfilter.o
7474
obj-$(CONFIG_AUDITSYSCALL) += auditsc.o
75-
obj-$(CONFIG_GCOV_KERNEL) += gcov/
75+
obj-$(CONFIG_AUDIT_WATCH) += audit_watch.o
7676
obj-$(CONFIG_AUDIT_TREE) += audit_tree.o
77+
obj-$(CONFIG_GCOV_KERNEL) += gcov/
7778
obj-$(CONFIG_KPROBES) += kprobes.o
7879
obj-$(CONFIG_KGDB) += debug/
7980
obj-$(CONFIG_DETECT_SOFTLOCKUP) += softlockup.o

‎kernel/audit.h‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,27 @@ extern struct mutex audit_filter_mutex;
103103
extern void audit_free_rule_rcu(struct rcu_head *);
104104
extern struct list_head audit_filter_list[];
105105

106+
extern struct audit_entry *audit_dupe_rule(struct audit_krule *old);
107+
106108
/* audit watch functions */
109+
#ifdef CONFIG_AUDIT_WATCH
107110
extern void audit_put_watch(struct audit_watch *watch);
108111
extern void audit_get_watch(struct audit_watch *watch);
109112
extern int audit_to_watch(struct audit_krule *krule, char *path, int len, u32 op);
110113
extern int audit_add_watch(struct audit_krule *krule, struct list_head **list);
111114
extern void audit_remove_watch_rule(struct audit_krule *krule);
112115
extern char *audit_watch_path(struct audit_watch *watch);
113116
extern int audit_watch_compare(struct audit_watch *watch, unsigned long ino, dev_t dev);
114-
extern struct audit_entry *audit_dupe_rule(struct audit_krule *old);
117+
#else
118+
#define audit_put_watch(w) {}
119+
#define audit_get_watch(w) {}
120+
#define audit_to_watch(k, p, l, o) (-EINVAL)
121+
#define audit_add_watch(k, l) (-EINVAL)
122+
#define audit_remove_watch_rule(k) BUG()
123+
#define audit_watch_path(w) ""
124+
#define audit_watch_compare(w, i, d) 0
125+
126+
#endif /* CONFIG_AUDIT_WATCH */
115127

116128
#ifdef CONFIG_AUDIT_TREE
117129
extern struct audit_chunk *audit_tree_lookup(const struct inode *);

0 commit comments

Comments
 (0)