Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 82035
b: refs/heads/master
c: b593d38
h: refs/heads/master
i:
  82033: 9ef77e4
  82031: 059e66c
v: v3
  • Loading branch information
Eric Paris authored and Al Viro committed Feb 1, 2008
1 parent acfb6cc commit e404e10
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 50397bd1e471391d27f64efad9271459c913de87
refs/heads/master: b593d384efcff7bdf6beb1bc1bc69927977aee26
16 changes: 13 additions & 3 deletions trunk/kernel/audit.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ static int audit_initialized;
#define AUDIT_ON 1
#define AUDIT_LOCKED 2
int audit_enabled;
int audit_ever_enabled;

/* Default state when kernel boots without any parameters. */
static int audit_default;
Expand Down Expand Up @@ -310,11 +311,17 @@ static int audit_set_backlog_limit(int limit, uid_t loginuid, u32 sid)

static int audit_set_enabled(int state, uid_t loginuid, u32 sid)
{
int rc;
if (state < AUDIT_OFF || state > AUDIT_LOCKED)
return -EINVAL;

return audit_do_config_change("audit_enabled", &audit_enabled, state,
loginuid, sid);
rc = audit_do_config_change("audit_enabled", &audit_enabled, state,
loginuid, sid);

if (!rc)
audit_ever_enabled |= !!state;

return rc;
}

static int audit_set_failure(int state, uid_t loginuid, u32 sid)
Expand Down Expand Up @@ -857,6 +864,7 @@ static int __init audit_init(void)
skb_queue_head_init(&audit_skb_queue);
audit_initialized = 1;
audit_enabled = audit_default;
audit_ever_enabled |= !!audit_default;

/* Register the callback with selinux. This callback will be invoked
* when a new policy is loaded. */
Expand Down Expand Up @@ -884,8 +892,10 @@ static int __init audit_enable(char *str)
printk(KERN_INFO "audit: %s%s\n",
audit_default ? "enabled" : "disabled",
audit_initialized ? "" : " (after initialization)");
if (audit_initialized)
if (audit_initialized) {
audit_enabled = audit_default;
audit_ever_enabled |= !!audit_default;
}
return 1;
}

Expand Down
3 changes: 2 additions & 1 deletion trunk/kernel/auditsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
#include "audit.h"

extern struct list_head audit_filter_list[];
extern int audit_ever_enabled;

/* AUDIT_NAMES is the number of slots we reserve in the audit_context
* for saving names from getname(). */
Expand Down Expand Up @@ -838,7 +839,7 @@ int audit_alloc(struct task_struct *tsk)
struct audit_context *context;
enum audit_state state;

if (likely(!audit_enabled))
if (likely(!audit_ever_enabled))
return 0; /* Return if not auditing. */

state = audit_filter_task(tsk);
Expand Down

0 comments on commit e404e10

Please sign in to comment.