Skip to content

Commit

Permalink
Merge git://git.infradead.org/users/eparis/audit
Browse files Browse the repository at this point in the history
Pull audit update from Eric Paris:
 "Again we stayed pretty well contained inside the audit system.
  Venturing out was fixing a couple of function prototypes which were
  inconsistent (didn't hurt anything, but we used the same value as an
  int, uint, u32, and I think even a long in a couple of places).

  We also made a couple of minor changes to when a couple of LSMs called
  the audit system.  We hoped to add aarch64 audit support this go
  round, but it wasn't ready.

  I'm disappearing on vacation on Thursday.  I should have internet
  access, but it'll be spotty.  If anything goes wrong please be sure to
  cc [email protected].  He'll make fixing things his top priority"

* git://git.infradead.org/users/eparis/audit: (50 commits)
  audit: whitespace fix in kernel-parameters.txt
  audit: fix location of __net_initdata for audit_net_ops
  audit: remove pr_info for every network namespace
  audit: Modify a set of system calls in audit class definitions
  audit: Convert int limit uses to u32
  audit: Use more current logging style
  audit: Use hex_byte_pack_upper
  audit: correct a type mismatch in audit_syscall_exit()
  audit: reorder AUDIT_TTY_SET arguments
  audit: rework AUDIT_TTY_SET to only grab spin_lock once
  audit: remove needless switch in AUDIT_SET
  audit: use define's for audit version
  audit: documentation of audit= kernel parameter
  audit: wait_for_auditd rework for readability
  audit: update MAINTAINERS
  audit: log task info on feature change
  audit: fix incorrect set of audit_sock
  audit: print error message when fail to create audit socket
  audit: fix dangling keywords in audit_log_set_loginuid() output
  audit: log on errors from filter user rules
  ...
  • Loading branch information
torvalds committed Jan 24, 2014
2 parents 90804ed + f3411cb commit 6dd9158
Show file tree
Hide file tree
Showing 20 changed files with 404 additions and 243 deletions.
16 changes: 16 additions & 0 deletions Documentation/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,22 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
atkbd.softrepeat= [HW]
Use software keyboard repeat

audit= [KNL] Enable the audit sub-system
Format: { "0" | "1" } (0 = disabled, 1 = enabled)
0 - kernel audit is disabled and can not be enabled
until the next reboot
unset - kernel audit is initialized but disabled and
will be fully enabled by the userspace auditd.
1 - kernel audit is initialized and partially enabled,
storing at most audit_backlog_limit messages in
RAM until it is fully enabled by the userspace
auditd.
Default: unset

audit_backlog_limit= [KNL] Set the audit queue size limit.
Format: <int> (must be >=0)
Default: 64

baycom_epp= [HW,AX25]
Format: <io>,<mode>

Expand Down
3 changes: 1 addition & 2 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -1597,11 +1597,10 @@ S: Supported
F: drivers/scsi/esas2r

AUDIT SUBSYSTEM
M: Al Viro <[email protected]>
M: Eric Paris <[email protected]>
L: [email protected] (subscribers-only)
W: http://people.redhat.com/sgrubb/audit/
T: git git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current.git
T: git git://git.infradead.org/users/eparis/audit.git
S: Maintained
F: include/linux/audit.h
F: include/uapi/linux/audit.h
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/tty_audit.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static void tty_audit_log(const char *description, int major, int minor,
struct task_struct *tsk = current;
uid_t uid = from_kuid(&init_user_ns, task_uid(tsk));
uid_t loginuid = from_kuid(&init_user_ns, audit_get_loginuid(tsk));
u32 sessionid = audit_get_sessionid(tsk);
unsigned int sessionid = audit_get_sessionid(tsk);

ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_TTY);
if (ab) {
Expand Down
4 changes: 3 additions & 1 deletion include/asm-generic/audit_change_attr.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ __NR_chmod,
__NR_fchmod,
#ifdef __NR_chown
__NR_chown,
__NR_fchown,
__NR_lchown,
#endif
#ifdef __NR_fchown
__NR_fchown,
#endif
__NR_setxattr,
__NR_lsetxattr,
__NR_fsetxattr,
Expand Down
6 changes: 6 additions & 0 deletions include/asm-generic/audit_write.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ __NR_truncate,
#ifdef __NR_truncate64
__NR_truncate64,
#endif
#ifdef __NR_ftruncate
__NR_ftruncate,
#endif
#ifdef __NR_ftruncate64
__NR_ftruncate64,
#endif
#ifdef __NR_bind
__NR_bind, /* bind can affect fs object only in one way... */
#endif
22 changes: 12 additions & 10 deletions include/linux/audit.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ static inline void audit_syscall_exit(void *pt_regs)
{
if (unlikely(current->audit_context)) {
int success = is_syscall_success(pt_regs);
int return_code = regs_return_value(pt_regs);
long return_code = regs_return_value(pt_regs);

__audit_syscall_exit(success, return_code);
}
Expand Down Expand Up @@ -202,7 +202,7 @@ static inline kuid_t audit_get_loginuid(struct task_struct *tsk)
return tsk->loginuid;
}

static inline int audit_get_sessionid(struct task_struct *tsk)
static inline unsigned int audit_get_sessionid(struct task_struct *tsk)
{
return tsk->sessionid;
}
Expand All @@ -220,7 +220,7 @@ extern void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
extern int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
const struct cred *new,
const struct cred *old);
extern void __audit_log_capset(pid_t pid, const struct cred *new, const struct cred *old);
extern void __audit_log_capset(const struct cred *new, const struct cred *old);
extern void __audit_mmap_fd(int fd, int flags);

static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
Expand Down Expand Up @@ -285,11 +285,11 @@ static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm,
return 0;
}

static inline void audit_log_capset(pid_t pid, const struct cred *new,
static inline void audit_log_capset(const struct cred *new,
const struct cred *old)
{
if (unlikely(!audit_dummy_context()))
__audit_log_capset(pid, new, old);
__audit_log_capset(new, old);
}

static inline void audit_mmap_fd(int fd, int flags)
Expand Down Expand Up @@ -359,7 +359,7 @@ static inline kuid_t audit_get_loginuid(struct task_struct *tsk)
{
return INVALID_UID;
}
static inline int audit_get_sessionid(struct task_struct *tsk)
static inline unsigned int audit_get_sessionid(struct task_struct *tsk)
{
return -1;
}
Expand Down Expand Up @@ -397,8 +397,8 @@ static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm,
{
return 0;
}
static inline void audit_log_capset(pid_t pid, const struct cred *new,
const struct cred *old)
static inline void audit_log_capset(const struct cred *new,
const struct cred *old)
{ }
static inline void audit_mmap_fd(int fd, int flags)
{ }
Expand Down Expand Up @@ -461,9 +461,11 @@ extern int audit_update_lsm_rules(void);
/* Private API (for audit.c only) */
extern int audit_filter_user(int type);
extern int audit_filter_type(int type);
extern int audit_receive_filter(int type, int pid, int seq,
extern int audit_rule_change(int type, __u32 portid, int seq,
void *data, size_t datasz);
extern int audit_enabled;
extern int audit_list_rules_send(__u32 portid, int seq);

extern u32 audit_enabled;
#else /* CONFIG_AUDIT */
static inline __printf(4, 5)
void audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type,
Expand Down
2 changes: 1 addition & 1 deletion include/linux/init_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ extern struct group_info init_groups;
#ifdef CONFIG_AUDITSYSCALL
#define INIT_IDS \
.loginuid = INVALID_UID, \
.sessionid = -1,
.sessionid = (unsigned int)-1,
#else
#define INIT_IDS
#endif
Expand Down
2 changes: 1 addition & 1 deletion include/net/netlabel.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ struct cipso_v4_doi;
struct netlbl_audit {
u32 secid;
kuid_t loginuid;
u32 sessionid;
unsigned int sessionid;
};

/*
Expand Down
20 changes: 10 additions & 10 deletions include/net/xfrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ struct xfrm_spi_skb_cb {
struct xfrm_audit {
u32 secid;
kuid_t loginuid;
u32 sessionid;
unsigned int sessionid;
};

#ifdef CONFIG_AUDITSYSCALL
Expand All @@ -699,7 +699,7 @@ static inline struct audit_buffer *xfrm_audit_start(const char *op)
return audit_buf;
}

static inline void xfrm_audit_helper_usrinfo(kuid_t auid, u32 ses, u32 secid,
static inline void xfrm_audit_helper_usrinfo(kuid_t auid, unsigned int ses, u32 secid,
struct audit_buffer *audit_buf)
{
char *secctx;
Expand All @@ -716,13 +716,13 @@ static inline void xfrm_audit_helper_usrinfo(kuid_t auid, u32 ses, u32 secid,
}

void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, kuid_t auid,
u32 ses, u32 secid);
unsigned int ses, u32 secid);
void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, kuid_t auid,
u32 ses, u32 secid);
unsigned int ses, u32 secid);
void xfrm_audit_state_add(struct xfrm_state *x, int result, kuid_t auid,
u32 ses, u32 secid);
unsigned int ses, u32 secid);
void xfrm_audit_state_delete(struct xfrm_state *x, int result, kuid_t auid,
u32 ses, u32 secid);
unsigned int ses, u32 secid);
void xfrm_audit_state_replay_overflow(struct xfrm_state *x,
struct sk_buff *skb);
void xfrm_audit_state_replay(struct xfrm_state *x, struct sk_buff *skb,
Expand All @@ -735,22 +735,22 @@ void xfrm_audit_state_icvfail(struct xfrm_state *x, struct sk_buff *skb,
#else

static inline void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
kuid_t auid, u32 ses, u32 secid)
kuid_t auid, unsigned int ses, u32 secid)
{
}

static inline void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result,
kuid_t auid, u32 ses, u32 secid)
kuid_t auid, unsigned int ses, u32 secid)
{
}

static inline void xfrm_audit_state_add(struct xfrm_state *x, int result,
kuid_t auid, u32 ses, u32 secid)
kuid_t auid, unsigned int ses, u32 secid)
{
}

static inline void xfrm_audit_state_delete(struct xfrm_state *x, int result,
kuid_t auid, u32 ses, u32 secid)
kuid_t auid, unsigned int ses, u32 secid)
{
}

Expand Down
8 changes: 8 additions & 0 deletions include/uapi/linux/audit.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,12 @@ enum {
#define AUDIT_STATUS_PID 0x0004
#define AUDIT_STATUS_RATE_LIMIT 0x0008
#define AUDIT_STATUS_BACKLOG_LIMIT 0x0010
#define AUDIT_STATUS_BACKLOG_WAIT_TIME 0x0020

#define AUDIT_VERSION_BACKLOG_LIMIT 1
#define AUDIT_VERSION_BACKLOG_WAIT_TIME 2
#define AUDIT_VERSION_LATEST AUDIT_VERSION_BACKLOG_WAIT_TIME

/* Failure-to-log actions */
#define AUDIT_FAIL_SILENT 0
#define AUDIT_FAIL_PRINTK 1
Expand Down Expand Up @@ -375,6 +381,8 @@ struct audit_status {
__u32 backlog_limit; /* waiting messages limit */
__u32 lost; /* messages lost */
__u32 backlog; /* messages waiting in queue */
__u32 version; /* audit api version number */
__u32 backlog_wait_time;/* message queue wait timeout */
};

struct audit_features {
Expand Down
Loading

0 comments on commit 6dd9158

Please sign in to comment.