diff options
Diffstat (limited to 'kernel/auditsc.c')
-rw-r--r-- | kernel/auditsc.c | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index d94e0404113c..a300736ee037 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
@@ -646,6 +646,25 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts | |||
646 | } | 646 | } |
647 | break; } | 647 | break; } |
648 | 648 | ||
649 | case AUDIT_IPC_SET_PERM: { | ||
650 | struct audit_aux_data_ipcctl *axi = (void *)aux; | ||
651 | audit_log_format(ab, | ||
652 | " new qbytes=%lx new iuid=%u new igid=%u new mode=%x", | ||
653 | axi->qbytes, axi->uid, axi->gid, axi->mode); | ||
654 | if (axi->osid != 0) { | ||
655 | char *ctx = NULL; | ||
656 | u32 len; | ||
657 | if (selinux_ctxid_to_string( | ||
658 | axi->osid, &ctx, &len)) { | ||
659 | audit_log_format(ab, " osid=%u", | ||
660 | axi->osid); | ||
661 | call_panic = 1; | ||
662 | } else | ||
663 | audit_log_format(ab, " obj=%s", ctx); | ||
664 | kfree(ctx); | ||
665 | } | ||
666 | break; } | ||
667 | |||
649 | case AUDIT_SOCKETCALL: { | 668 | case AUDIT_SOCKETCALL: { |
650 | int i; | 669 | int i; |
651 | struct audit_aux_data_socketcall *axs = (void *)aux; | 670 | struct audit_aux_data_socketcall *axs = (void *)aux; |
@@ -1148,7 +1167,36 @@ uid_t audit_get_loginuid(struct audit_context *ctx) | |||
1148 | } | 1167 | } |
1149 | 1168 | ||
1150 | /** | 1169 | /** |
1151 | * audit_ipc_perms - record audit data for ipc | 1170 | * audit_ipc_obj - record audit data for ipc object |
1171 | * @ipcp: ipc permissions | ||
1172 | * | ||
1173 | * Returns 0 for success or NULL context or < 0 on error. | ||
1174 | */ | ||
1175 | int audit_ipc_obj(struct kern_ipc_perm *ipcp) | ||
1176 | { | ||
1177 | struct audit_aux_data_ipcctl *ax; | ||
1178 | struct audit_context *context = current->audit_context; | ||
1179 | |||
1180 | if (likely(!context)) | ||
1181 | return 0; | ||
1182 | |||
1183 | ax = kmalloc(sizeof(*ax), GFP_ATOMIC); | ||
1184 | if (!ax) | ||
1185 | return -ENOMEM; | ||
1186 | |||
1187 | ax->uid = ipcp->uid; | ||
1188 | ax->gid = ipcp->gid; | ||
1189 | ax->mode = ipcp->mode; | ||
1190 | selinux_get_ipc_sid(ipcp, &ax->osid); | ||
1191 | |||
1192 | ax->d.type = AUDIT_IPC; | ||
1193 | ax->d.next = context->aux; | ||
1194 | context->aux = (void *)ax; | ||
1195 | return 0; | ||
1196 | } | ||
1197 | |||
1198 | /** | ||
1199 | * audit_ipc_set_perm - record audit data for new ipc permissions | ||
1152 | * @qbytes: msgq bytes | 1200 | * @qbytes: msgq bytes |
1153 | * @uid: msgq user id | 1201 | * @uid: msgq user id |
1154 | * @gid: msgq group id | 1202 | * @gid: msgq group id |
@@ -1156,7 +1204,7 @@ uid_t audit_get_loginuid(struct audit_context *ctx) | |||
1156 | * | 1204 | * |
1157 | * Returns 0 for success or NULL context or < 0 on error. | 1205 | * Returns 0 for success or NULL context or < 0 on error. |
1158 | */ | 1206 | */ |
1159 | int audit_ipc_perms(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode, struct kern_ipc_perm *ipcp) | 1207 | int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode, struct kern_ipc_perm *ipcp) |
1160 | { | 1208 | { |
1161 | struct audit_aux_data_ipcctl *ax; | 1209 | struct audit_aux_data_ipcctl *ax; |
1162 | struct audit_context *context = current->audit_context; | 1210 | struct audit_context *context = current->audit_context; |
@@ -1174,7 +1222,7 @@ int audit_ipc_perms(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode, str | |||
1174 | ax->mode = mode; | 1222 | ax->mode = mode; |
1175 | selinux_get_ipc_sid(ipcp, &ax->osid); | 1223 | selinux_get_ipc_sid(ipcp, &ax->osid); |
1176 | 1224 | ||
1177 | ax->d.type = AUDIT_IPC; | 1225 | ax->d.type = AUDIT_IPC_SET_PERM; |
1178 | ax->d.next = context->aux; | 1226 | ax->d.next = context->aux; |
1179 | context->aux = (void *)ax; | 1227 | context->aux = (void *)ax; |
1180 | return 0; | 1228 | return 0; |