diff options
Diffstat (limited to 'kernel/auditsc.c')
-rw-r--r-- | kernel/auditsc.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 2bfc64786765..7d6ac7c1f414 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
@@ -329,6 +329,14 @@ static int audit_match_filetype(struct audit_context *ctx, int which) | |||
329 | */ | 329 | */ |
330 | 330 | ||
331 | #ifdef CONFIG_AUDIT_TREE | 331 | #ifdef CONFIG_AUDIT_TREE |
332 | static void audit_set_auditable(struct audit_context *ctx) | ||
333 | { | ||
334 | if (!ctx->prio) { | ||
335 | ctx->prio = 1; | ||
336 | ctx->current_state = AUDIT_RECORD_CONTEXT; | ||
337 | } | ||
338 | } | ||
339 | |||
332 | static int put_tree_ref(struct audit_context *ctx, struct audit_chunk *chunk) | 340 | static int put_tree_ref(struct audit_context *ctx, struct audit_chunk *chunk) |
333 | { | 341 | { |
334 | struct audit_tree_refs *p = ctx->trees; | 342 | struct audit_tree_refs *p = ctx->trees; |
@@ -742,17 +750,9 @@ void audit_filter_inodes(struct task_struct *tsk, struct audit_context *ctx) | |||
742 | rcu_read_unlock(); | 750 | rcu_read_unlock(); |
743 | } | 751 | } |
744 | 752 | ||
745 | static void audit_set_auditable(struct audit_context *ctx) | ||
746 | { | ||
747 | if (!ctx->prio) { | ||
748 | ctx->prio = 1; | ||
749 | ctx->current_state = AUDIT_RECORD_CONTEXT; | ||
750 | } | ||
751 | } | ||
752 | |||
753 | static inline struct audit_context *audit_get_context(struct task_struct *tsk, | 753 | static inline struct audit_context *audit_get_context(struct task_struct *tsk, |
754 | int return_valid, | 754 | int return_valid, |
755 | int return_code) | 755 | long return_code) |
756 | { | 756 | { |
757 | struct audit_context *context = tsk->audit_context; | 757 | struct audit_context *context = tsk->audit_context; |
758 | 758 | ||
@@ -1024,7 +1024,7 @@ static int audit_log_single_execve_arg(struct audit_context *context, | |||
1024 | { | 1024 | { |
1025 | char arg_num_len_buf[12]; | 1025 | char arg_num_len_buf[12]; |
1026 | const char __user *tmp_p = p; | 1026 | const char __user *tmp_p = p; |
1027 | /* how many digits are in arg_num? 3 is the length of a=\n */ | 1027 | /* how many digits are in arg_num? 3 is the length of " a=" */ |
1028 | size_t arg_num_len = snprintf(arg_num_len_buf, 12, "%d", arg_num) + 3; | 1028 | size_t arg_num_len = snprintf(arg_num_len_buf, 12, "%d", arg_num) + 3; |
1029 | size_t len, len_left, to_send; | 1029 | size_t len, len_left, to_send; |
1030 | size_t max_execve_audit_len = MAX_EXECVE_AUDIT_LEN; | 1030 | size_t max_execve_audit_len = MAX_EXECVE_AUDIT_LEN; |
@@ -1110,7 +1110,7 @@ static int audit_log_single_execve_arg(struct audit_context *context, | |||
1110 | * so we can be sure nothing was lost. | 1110 | * so we can be sure nothing was lost. |
1111 | */ | 1111 | */ |
1112 | if ((i == 0) && (too_long)) | 1112 | if ((i == 0) && (too_long)) |
1113 | audit_log_format(*ab, "a%d_len=%zu ", arg_num, | 1113 | audit_log_format(*ab, " a%d_len=%zu", arg_num, |
1114 | has_cntl ? 2*len : len); | 1114 | has_cntl ? 2*len : len); |
1115 | 1115 | ||
1116 | /* | 1116 | /* |
@@ -1130,7 +1130,7 @@ static int audit_log_single_execve_arg(struct audit_context *context, | |||
1130 | buf[to_send] = '\0'; | 1130 | buf[to_send] = '\0'; |
1131 | 1131 | ||
1132 | /* actually log it */ | 1132 | /* actually log it */ |
1133 | audit_log_format(*ab, "a%d", arg_num); | 1133 | audit_log_format(*ab, " a%d", arg_num); |
1134 | if (too_long) | 1134 | if (too_long) |
1135 | audit_log_format(*ab, "[%d]", i); | 1135 | audit_log_format(*ab, "[%d]", i); |
1136 | audit_log_format(*ab, "="); | 1136 | audit_log_format(*ab, "="); |
@@ -1138,7 +1138,6 @@ static int audit_log_single_execve_arg(struct audit_context *context, | |||
1138 | audit_log_n_hex(*ab, buf, to_send); | 1138 | audit_log_n_hex(*ab, buf, to_send); |
1139 | else | 1139 | else |
1140 | audit_log_format(*ab, "\"%s\"", buf); | 1140 | audit_log_format(*ab, "\"%s\"", buf); |
1141 | audit_log_format(*ab, "\n"); | ||
1142 | 1141 | ||
1143 | p += to_send; | 1142 | p += to_send; |
1144 | len_left -= to_send; | 1143 | len_left -= to_send; |
@@ -1166,7 +1165,7 @@ static void audit_log_execve_info(struct audit_context *context, | |||
1166 | 1165 | ||
1167 | p = (const char __user *)axi->mm->arg_start; | 1166 | p = (const char __user *)axi->mm->arg_start; |
1168 | 1167 | ||
1169 | audit_log_format(*ab, "argc=%d ", axi->argc); | 1168 | audit_log_format(*ab, "argc=%d", axi->argc); |
1170 | 1169 | ||
1171 | /* | 1170 | /* |
1172 | * we need some kernel buffer to hold the userspace args. Just | 1171 | * we need some kernel buffer to hold the userspace args. Just |
@@ -1479,7 +1478,7 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts | |||
1479 | case 0: | 1478 | case 0: |
1480 | /* name was specified as a relative path and the | 1479 | /* name was specified as a relative path and the |
1481 | * directory component is the cwd */ | 1480 | * directory component is the cwd */ |
1482 | audit_log_d_path(ab, " name=", &context->pwd); | 1481 | audit_log_d_path(ab, "name=", &context->pwd); |
1483 | break; | 1482 | break; |
1484 | default: | 1483 | default: |
1485 | /* log the name's directory component */ | 1484 | /* log the name's directory component */ |
@@ -2150,7 +2149,7 @@ int audit_set_loginuid(struct task_struct *task, uid_t loginuid) | |||
2150 | * __audit_mq_open - record audit data for a POSIX MQ open | 2149 | * __audit_mq_open - record audit data for a POSIX MQ open |
2151 | * @oflag: open flag | 2150 | * @oflag: open flag |
2152 | * @mode: mode bits | 2151 | * @mode: mode bits |
2153 | * @u_attr: queue attributes | 2152 | * @attr: queue attributes |
2154 | * | 2153 | * |
2155 | */ | 2154 | */ |
2156 | void __audit_mq_open(int oflag, mode_t mode, struct mq_attr *attr) | 2155 | void __audit_mq_open(int oflag, mode_t mode, struct mq_attr *attr) |
@@ -2197,7 +2196,7 @@ void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, | |||
2197 | /** | 2196 | /** |
2198 | * __audit_mq_notify - record audit data for a POSIX MQ notify | 2197 | * __audit_mq_notify - record audit data for a POSIX MQ notify |
2199 | * @mqdes: MQ descriptor | 2198 | * @mqdes: MQ descriptor |
2200 | * @u_notification: Notification event | 2199 | * @notification: Notification event |
2201 | * | 2200 | * |
2202 | */ | 2201 | */ |
2203 | 2202 | ||