diff options
Diffstat (limited to 'kernel/auditsc.c')
| -rw-r--r-- | kernel/auditsc.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 105147631753..42f2f1179711 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
| @@ -278,8 +278,11 @@ static int audit_filter_rules(struct task_struct *tsk, | |||
| 278 | result = audit_comparator(tsk->pid, f->op, f->val); | 278 | result = audit_comparator(tsk->pid, f->op, f->val); |
| 279 | break; | 279 | break; |
| 280 | case AUDIT_PPID: | 280 | case AUDIT_PPID: |
| 281 | if (ctx) | 281 | if (ctx) { |
| 282 | if (!ctx->ppid) | ||
| 283 | ctx->ppid = sys_getppid(); | ||
| 282 | result = audit_comparator(ctx->ppid, f->op, f->val); | 284 | result = audit_comparator(ctx->ppid, f->op, f->val); |
| 285 | } | ||
| 283 | break; | 286 | break; |
| 284 | case AUDIT_UID: | 287 | case AUDIT_UID: |
| 285 | result = audit_comparator(tsk->uid, f->op, f->val); | 288 | result = audit_comparator(tsk->uid, f->op, f->val); |
| @@ -795,7 +798,8 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts | |||
| 795 | 798 | ||
| 796 | /* tsk == current */ | 799 | /* tsk == current */ |
| 797 | context->pid = tsk->pid; | 800 | context->pid = tsk->pid; |
| 798 | context->ppid = sys_getppid(); /* sic. tsk == current in all cases */ | 801 | if (!context->ppid) |
| 802 | context->ppid = sys_getppid(); | ||
| 799 | context->uid = tsk->uid; | 803 | context->uid = tsk->uid; |
| 800 | context->gid = tsk->gid; | 804 | context->gid = tsk->gid; |
| 801 | context->euid = tsk->euid; | 805 | context->euid = tsk->euid; |
| @@ -1137,6 +1141,7 @@ void audit_syscall_entry(int arch, int major, | |||
| 1137 | context->ctime = CURRENT_TIME; | 1141 | context->ctime = CURRENT_TIME; |
| 1138 | context->in_syscall = 1; | 1142 | context->in_syscall = 1; |
| 1139 | context->auditable = !!(state == AUDIT_RECORD_CONTEXT); | 1143 | context->auditable = !!(state == AUDIT_RECORD_CONTEXT); |
| 1144 | context->ppid = 0; | ||
| 1140 | } | 1145 | } |
| 1141 | 1146 | ||
| 1142 | /** | 1147 | /** |
| @@ -1352,7 +1357,13 @@ void __audit_inode_child(const char *dname, const struct inode *inode, | |||
| 1352 | } | 1357 | } |
| 1353 | 1358 | ||
| 1354 | update_context: | 1359 | update_context: |
| 1355 | idx = context->name_count++; | 1360 | idx = context->name_count; |
| 1361 | if (context->name_count == AUDIT_NAMES) { | ||
| 1362 | printk(KERN_DEBUG "name_count maxed and losing %s\n", | ||
| 1363 | found_name ?: "(null)"); | ||
| 1364 | return; | ||
| 1365 | } | ||
| 1366 | context->name_count++; | ||
| 1356 | #if AUDIT_DEBUG | 1367 | #if AUDIT_DEBUG |
| 1357 | context->ino_count++; | 1368 | context->ino_count++; |
| 1358 | #endif | 1369 | #endif |
| @@ -1370,7 +1381,16 @@ update_context: | |||
| 1370 | /* A parent was not found in audit_names, so copy the inode data for the | 1381 | /* A parent was not found in audit_names, so copy the inode data for the |
| 1371 | * provided parent. */ | 1382 | * provided parent. */ |
| 1372 | if (!found_name) { | 1383 | if (!found_name) { |
| 1373 | idx = context->name_count++; | 1384 | idx = context->name_count; |
| 1385 | if (context->name_count == AUDIT_NAMES) { | ||
| 1386 | printk(KERN_DEBUG | ||
| 1387 | "name_count maxed and losing parent inode data: dev=%02x:%02x, inode=%lu", | ||
| 1388 | MAJOR(parent->i_sb->s_dev), | ||
| 1389 | MINOR(parent->i_sb->s_dev), | ||
| 1390 | parent->i_ino); | ||
| 1391 | return; | ||
| 1392 | } | ||
| 1393 | context->name_count++; | ||
| 1374 | #if AUDIT_DEBUG | 1394 | #if AUDIT_DEBUG |
| 1375 | context->ino_count++; | 1395 | context->ino_count++; |
| 1376 | #endif | 1396 | #endif |
