Skip to content

Commit e359bce

Browse files
committed
Merge tag 'audit-pr-20210426' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit
Pull audit updates from Paul Moore: "Another small pull request for audit, most of the patches are documentation updates with only two real code changes: one to fix a compiler warning for a dummy function/macro, and one to cleanup some code since we removed the AUDIT_FILTER_ENTRY ages ago (v4.17)" * tag 'audit-pr-20210426' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit: audit: drop /proc/PID/loginuid documentation Format field audit: avoid -Wempty-body warning audit: document /proc/PID/sessionid audit: document /proc/PID/loginuid MAINTAINERS: update audit files audit: further cleanup of AUDIT_FILTER_ENTRY deprecation
2 parents f1c921f + b75d8f3 commit e359bce

File tree

4 files changed

+39
-13
lines changed

4 files changed

+39
-13
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
What: Audit Login UID
2+
Date: 2005-02-01
3+
KernelVersion: 2.6.11-rc2 1e2d1492e178 ("[PATCH] audit: handle loginuid through proc")
4+
5+
Users: audit and login applications
6+
Description:
7+
The /proc/$pid/loginuid pseudofile is written to set and
8+
read to get the audit login UID of process $pid as a
9+
decimal unsigned int (%u, u32). If it is unset,
10+
permissions are not needed to set it. The accessor must
11+
have CAP_AUDIT_CONTROL in the initial user namespace to
12+
write it if it has been set. It cannot be written again
13+
if AUDIT_FEATURE_LOGINUID_IMMUTABLE is enabled. It
14+
cannot be unset if AUDIT_FEATURE_ONLY_UNSET_LOGINUID is
15+
enabled.
16+
17+
What: Audit Login Session ID
18+
Date: 2008-03-13
19+
KernelVersion: 2.6.25-rc7 1e0bd7550ea9 ("[PATCH] export sessionid alongside the loginuid in procfs")
20+
21+
Users: audit and login applications
22+
Description:
23+
The /proc/$pid/sessionid pseudofile is read to get the
24+
audit login session ID of process $pid as a decimal
25+
unsigned int (%u, u32). It is set automatically,
26+
serially assigned with each new login.
27+

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3018,9 +3018,11 @@ L: [email protected] (moderated for non-subscribers)
30183018
S: Supported
30193019
W: https://github.com/linux-audit
30203020
T: git git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit.git
3021+
F: include/asm-generic/audit_*.h
30213022
F: include/linux/audit.h
30223023
F: include/uapi/linux/audit.h
30233024
F: kernel/audit*
3025+
F: lib/*audit.c
30243026

30253027
AUXILIARY DISPLAY DRIVERS
30263028
M: Miguel Ojeda <[email protected]>

kernel/audit.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ extern void audit_filter_inodes(struct task_struct *tsk,
292292
extern struct list_head *audit_killed_trees(void);
293293
#else /* CONFIG_AUDITSYSCALL */
294294
#define auditsc_get_stamp(c, t, s) 0
295-
#define audit_put_watch(w) {}
296-
#define audit_get_watch(w) {}
295+
#define audit_put_watch(w) do { } while (0)
296+
#define audit_get_watch(w) do { } while (0)
297297
#define audit_to_watch(k, p, l, o) (-EINVAL)
298298
#define audit_add_watch(k, l) (-EINVAL)
299299
#define audit_remove_watch_rule(k) BUG()
@@ -302,17 +302,17 @@ extern struct list_head *audit_killed_trees(void);
302302

303303
#define audit_alloc_mark(k, p, l) (ERR_PTR(-EINVAL))
304304
#define audit_mark_path(m) ""
305-
#define audit_remove_mark(m)
306-
#define audit_remove_mark_rule(k)
305+
#define audit_remove_mark(m) do { } while (0)
306+
#define audit_remove_mark_rule(k) do { } while (0)
307307
#define audit_mark_compare(m, i, d) 0
308308
#define audit_exe_compare(t, m) (-EINVAL)
309309
#define audit_dupe_exe(n, o) (-EINVAL)
310310

311311
#define audit_remove_tree_rule(rule) BUG()
312312
#define audit_add_tree_rule(rule) -EINVAL
313313
#define audit_make_tree(rule, str, op) -EINVAL
314-
#define audit_trim_trees() (void)0
315-
#define audit_put_tree(tree) (void)0
314+
#define audit_trim_trees() do { } while (0)
315+
#define audit_put_tree(tree) do { } while (0)
316316
#define audit_tag_tree(old, new) -EINVAL
317317
#define audit_tree_path(rule) "" /* never called */
318318
#define audit_kill_trees(context) BUG()

kernel/auditsc.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -805,8 +805,7 @@ static int audit_in_mask(const struct audit_krule *rule, unsigned long val)
805805
* (i.e., the state is AUDIT_SETUP_CONTEXT or AUDIT_BUILD_CONTEXT).
806806
*/
807807
static void audit_filter_syscall(struct task_struct *tsk,
808-
struct audit_context *ctx,
809-
struct list_head *list)
808+
struct audit_context *ctx)
810809
{
811810
struct audit_entry *e;
812811
enum audit_state state;
@@ -815,7 +814,7 @@ static void audit_filter_syscall(struct task_struct *tsk,
815814
return;
816815

817816
rcu_read_lock();
818-
list_for_each_entry_rcu(e, list, list) {
817+
list_for_each_entry_rcu(e, &audit_filter_list[AUDIT_FILTER_EXIT], list) {
819818
if (audit_in_mask(&e->rule, ctx->major) &&
820819
audit_filter_rules(tsk, &e->rule, ctx, NULL,
821820
&state, false)) {
@@ -1627,8 +1626,7 @@ void __audit_free(struct task_struct *tsk)
16271626
context->return_valid = AUDITSC_INVALID;
16281627
context->return_code = 0;
16291628

1630-
audit_filter_syscall(tsk, context,
1631-
&audit_filter_list[AUDIT_FILTER_EXIT]);
1629+
audit_filter_syscall(tsk, context);
16321630
audit_filter_inodes(tsk, context);
16331631
if (context->current_state == AUDIT_RECORD_CONTEXT)
16341632
audit_log_exit();
@@ -1735,8 +1733,7 @@ void __audit_syscall_exit(int success, long return_code)
17351733
else
17361734
context->return_code = return_code;
17371735

1738-
audit_filter_syscall(current, context,
1739-
&audit_filter_list[AUDIT_FILTER_EXIT]);
1736+
audit_filter_syscall(current, context);
17401737
audit_filter_inodes(current, context);
17411738
if (context->current_state == AUDIT_RECORD_CONTEXT)
17421739
audit_log_exit();

0 commit comments

Comments
 (0)