Commit 6d39b27f0ac7e805ae3bd9efa51d7da04bec0360

Authored by Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current

* git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current:
  lsm: Use a compressed IPv6 string format in audit events
  Audit: send signal info if selinux is disabled
  Audit: rearrange audit_context to save 16 bytes per struct
  Audit: reorganize struct audit_watch to save 8 bytes

Showing 4 changed files Side-by-side Diff

... ... @@ -855,18 +855,24 @@
855 855 break;
856 856 }
857 857 case AUDIT_SIGNAL_INFO:
858   - err = security_secid_to_secctx(audit_sig_sid, &ctx, &len);
859   - if (err)
860   - return err;
  858 + len = 0;
  859 + if (audit_sig_sid) {
  860 + err = security_secid_to_secctx(audit_sig_sid, &ctx, &len);
  861 + if (err)
  862 + return err;
  863 + }
861 864 sig_data = kmalloc(sizeof(*sig_data) + len, GFP_KERNEL);
862 865 if (!sig_data) {
863   - security_release_secctx(ctx, len);
  866 + if (audit_sig_sid)
  867 + security_release_secctx(ctx, len);
864 868 return -ENOMEM;
865 869 }
866 870 sig_data->uid = audit_sig_uid;
867 871 sig_data->pid = audit_sig_pid;
868   - memcpy(sig_data->ctx, ctx, len);
869   - security_release_secctx(ctx, len);
  872 + if (audit_sig_sid) {
  873 + memcpy(sig_data->ctx, ctx, len);
  874 + security_release_secctx(ctx, len);
  875 + }
870 876 audit_send_reply(NETLINK_CB(skb).pid, seq, AUDIT_SIGNAL_INFO,
871 877 0, 0, sig_data, sizeof(*sig_data) + len);
872 878 kfree(sig_data);
kernel/audit_watch.c
... ... @@ -45,8 +45,8 @@
45 45  
46 46 struct audit_watch {
47 47 atomic_t count; /* reference count */
48   - char *path; /* insertion path */
49 48 dev_t dev; /* associated superblock device */
  49 + char *path; /* insertion path */
50 50 unsigned long ino; /* associated inode number */
51 51 struct audit_parent *parent; /* associated parent */
52 52 struct list_head wlist; /* entry in parent->watches list */
... ... @@ -168,12 +168,12 @@
168 168 int in_syscall; /* 1 if task is in a syscall */
169 169 enum audit_state state, current_state;
170 170 unsigned int serial; /* serial number for record */
171   - struct timespec ctime; /* time of syscall entry */
172 171 int major; /* syscall number */
  172 + struct timespec ctime; /* time of syscall entry */
173 173 unsigned long argv[4]; /* syscall arguments */
174   - int return_valid; /* return code is valid */
175 174 long return_code;/* syscall return code */
176 175 u64 prio;
  176 + int return_valid; /* return code is valid */
177 177 int name_count;
178 178 struct audit_names names[AUDIT_NAMES];
179 179 char * filterkey; /* key for rule that triggered record */
180 180  
... ... @@ -198,8 +198,8 @@
198 198 char target_comm[TASK_COMM_LEN];
199 199  
200 200 struct audit_tree_refs *trees, *first_trees;
201   - int tree_count;
202 201 struct list_head killed_trees;
  202 + int tree_count;
203 203  
204 204 int type;
205 205 union {
security/lsm_audit.c
... ... @@ -187,7 +187,7 @@
187 187 char *name1, char *name2)
188 188 {
189 189 if (!ipv6_addr_any(addr))
190   - audit_log_format(ab, " %s=%pI6", name1, addr);
  190 + audit_log_format(ab, " %s=%pI6c", name1, addr);
191 191 if (port)
192 192 audit_log_format(ab, " %s=%d", name2, ntohs(port));
193 193 }