aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/auditsc.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-06-22 10:04:33 -0400
committerDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-06-22 10:04:33 -0400
commit9ad9ad385be27fcc7c16d290d972c6173e780a61 (patch)
treebbca700c2d88ba421a6c9c348de367eaf4de0e2c /kernel/auditsc.c
parent177bbc733a1d9c935bc3d6efd776a6699b29b1ca (diff)
AUDIT: Wait for backlog to clear when generating messages.
Add a gfp_mask to audit_log_start() and audit_log(), to reduce the amount of GFP_ATOMIC allocation -- most of it doesn't need to be GFP_ATOMIC. Also if the mask includes __GFP_WAIT, then wait up to 60 seconds for the auditd backlog to clear instead of immediately abandoning the message. The timeout should probably be made configurable, but for now it'll suffice that it only happens if auditd is actually running. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'kernel/auditsc.c')
-rw-r--r--kernel/auditsc.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index fc858b0c044a..f463fd230846 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -346,7 +346,7 @@ int audit_receive_filter(int type, int pid, int uid, int seq, void *data,
346 } 346 }
347 listnr = entry->rule.flags & ~AUDIT_FILTER_PREPEND; 347 listnr = entry->rule.flags & ~AUDIT_FILTER_PREPEND;
348 audit_add_rule(entry, &audit_filter_list[listnr]); 348 audit_add_rule(entry, &audit_filter_list[listnr]);
349 audit_log(NULL, AUDIT_CONFIG_CHANGE, 349 audit_log(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE,
350 "auid=%u added an audit rule\n", loginuid); 350 "auid=%u added an audit rule\n", loginuid);
351 break; 351 break;
352 case AUDIT_DEL: 352 case AUDIT_DEL:
@@ -356,7 +356,7 @@ int audit_receive_filter(int type, int pid, int uid, int seq, void *data,
356 356
357 err = audit_del_rule(data, &audit_filter_list[listnr]); 357 err = audit_del_rule(data, &audit_filter_list[listnr]);
358 if (!err) 358 if (!err)
359 audit_log(NULL, AUDIT_CONFIG_CHANGE, 359 audit_log(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE,
360 "auid=%u removed an audit rule\n", loginuid); 360 "auid=%u removed an audit rule\n", loginuid);
361 break; 361 break;
362 default: 362 default:
@@ -756,7 +756,7 @@ static void audit_log_exit(struct audit_context *context)
756 struct audit_buffer *ab; 756 struct audit_buffer *ab;
757 struct audit_aux_data *aux; 757 struct audit_aux_data *aux;
758 758
759 ab = audit_log_start(context, AUDIT_SYSCALL); 759 ab = audit_log_start(context, GFP_KERNEL, AUDIT_SYSCALL);
760 if (!ab) 760 if (!ab)
761 return; /* audit_panic has been called */ 761 return; /* audit_panic has been called */
762 audit_log_format(ab, "arch=%x syscall=%d", 762 audit_log_format(ab, "arch=%x syscall=%d",
@@ -788,7 +788,7 @@ static void audit_log_exit(struct audit_context *context)
788 788
789 for (aux = context->aux; aux; aux = aux->next) { 789 for (aux = context->aux; aux; aux = aux->next) {
790 790
791 ab = audit_log_start(context, aux->type); 791 ab = audit_log_start(context, GFP_KERNEL, aux->type);
792 if (!ab) 792 if (!ab)
793 continue; /* audit_panic has been called */ 793 continue; /* audit_panic has been called */
794 794
@@ -825,14 +825,14 @@ static void audit_log_exit(struct audit_context *context)
825 } 825 }
826 826
827 if (context->pwd && context->pwdmnt) { 827 if (context->pwd && context->pwdmnt) {
828 ab = audit_log_start(context, AUDIT_CWD); 828 ab = audit_log_start(context, GFP_KERNEL, AUDIT_CWD);
829 if (ab) { 829 if (ab) {
830 audit_log_d_path(ab, "cwd=", context->pwd, context->pwdmnt); 830 audit_log_d_path(ab, "cwd=", context->pwd, context->pwdmnt);
831 audit_log_end(ab); 831 audit_log_end(ab);
832 } 832 }
833 } 833 }
834 for (i = 0; i < context->name_count; i++) { 834 for (i = 0; i < context->name_count; i++) {
835 ab = audit_log_start(context, AUDIT_PATH); 835 ab = audit_log_start(context, GFP_KERNEL, AUDIT_PATH);
836 if (!ab) 836 if (!ab)
837 continue; /* audit_panic has been called */ 837 continue; /* audit_panic has been called */
838 838
@@ -1118,7 +1118,7 @@ int audit_set_loginuid(struct task_struct *task, uid_t loginuid)
1118 if (task->audit_context) { 1118 if (task->audit_context) {
1119 struct audit_buffer *ab; 1119 struct audit_buffer *ab;
1120 1120
1121 ab = audit_log_start(NULL, AUDIT_LOGIN); 1121 ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_LOGIN);
1122 if (ab) { 1122 if (ab) {
1123 audit_log_format(ab, "login pid=%d uid=%u " 1123 audit_log_format(ab, "login pid=%d uid=%u "
1124 "old auid=%u new auid=%u", 1124 "old auid=%u new auid=%u",