Lines Matching refs:ab
172 static void audit_set_pid(struct audit_buffer *ab, pid_t pid) in audit_set_pid() argument
174 if (ab) { in audit_set_pid()
175 struct nlmsghdr *nlh = nlmsg_hdr(ab->skb); in audit_set_pid()
272 struct audit_buffer *ab; in audit_log_config_change() local
275 ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE); in audit_log_config_change()
276 if (unlikely(!ab)) in audit_log_config_change()
278 audit_log_format(ab, "%s=%d old=%d", function_name, new, old); in audit_log_config_change()
279 audit_log_session_info(ab); in audit_log_config_change()
280 rc = audit_log_task_context(ab); in audit_log_config_change()
283 audit_log_format(ab, " res=%d", allow_changes); in audit_log_config_change()
284 audit_log_end(ab); in audit_log_config_change()
611 static int audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type) in audit_log_common_recv_msg() argument
617 *ab = NULL; in audit_log_common_recv_msg()
621 *ab = audit_log_start(NULL, GFP_KERNEL, msg_type); in audit_log_common_recv_msg()
622 if (unlikely(!*ab)) in audit_log_common_recv_msg()
624 audit_log_format(*ab, "pid=%d uid=%u", task_tgid_vnr(current), uid); in audit_log_common_recv_msg()
625 audit_log_session_info(*ab); in audit_log_common_recv_msg()
626 audit_log_task_context(*ab); in audit_log_common_recv_msg()
637 struct audit_buffer *ab; in audit_receive_msg() local
722 audit_log_common_recv_msg(&ab, msg_type); in audit_receive_msg()
724 audit_log_format(ab, " msg='%.1024s'", in audit_receive_msg()
729 audit_log_format(ab, " data="); in audit_receive_msg()
734 audit_log_n_untrustedstring(ab, data, size); in audit_receive_msg()
736 audit_set_pid(ab, NETLINK_CB(skb).portid); in audit_receive_msg()
737 audit_log_end(ab); in audit_receive_msg()
745 audit_log_common_recv_msg(&ab, AUDIT_CONFIG_CHANGE); in audit_receive_msg()
746 audit_log_format(ab, " audit_enabled=%d res=0", audit_enabled); in audit_receive_msg()
747 audit_log_end(ab); in audit_receive_msg()
757 audit_log_common_recv_msg(&ab, AUDIT_CONFIG_CHANGE); in audit_receive_msg()
758 audit_log_format(ab, " op=trim res=1"); in audit_receive_msg()
759 audit_log_end(ab); in audit_receive_msg()
787 audit_log_common_recv_msg(&ab, AUDIT_CONFIG_CHANGE); in audit_receive_msg()
789 audit_log_format(ab, " op=make_equiv old="); in audit_receive_msg()
790 audit_log_untrustedstring(ab, old); in audit_receive_msg()
791 audit_log_format(ab, " new="); in audit_receive_msg()
792 audit_log_untrustedstring(ab, new); in audit_receive_msg()
793 audit_log_format(ab, " res=%d", !err); in audit_receive_msg()
794 audit_log_end(ab); in audit_receive_msg()
953 static void audit_buffer_free(struct audit_buffer *ab) in audit_buffer_free() argument
957 if (!ab) in audit_buffer_free()
960 if (ab->skb) in audit_buffer_free()
961 kfree_skb(ab->skb); in audit_buffer_free()
965 kfree(ab); in audit_buffer_free()
968 list_add(&ab->list, &audit_freelist); in audit_buffer_free()
977 struct audit_buffer *ab = NULL; in audit_buffer_alloc() local
982 ab = list_entry(audit_freelist.next, in audit_buffer_alloc()
984 list_del(&ab->list); in audit_buffer_alloc()
989 if (!ab) { in audit_buffer_alloc()
990 ab = kmalloc(sizeof(*ab), gfp_mask); in audit_buffer_alloc()
991 if (!ab) in audit_buffer_alloc()
995 ab->ctx = ctx; in audit_buffer_alloc()
996 ab->gfp_mask = gfp_mask; in audit_buffer_alloc()
998 ab->skb = nlmsg_new(AUDIT_BUFSIZ, gfp_mask); in audit_buffer_alloc()
999 if (!ab->skb) in audit_buffer_alloc()
1002 nlh = nlmsg_put(ab->skb, 0, 0, type, 0, 0); in audit_buffer_alloc()
1006 return ab; in audit_buffer_alloc()
1009 kfree_skb(ab->skb); in audit_buffer_alloc()
1010 ab->skb = NULL; in audit_buffer_alloc()
1012 audit_buffer_free(ab); in audit_buffer_alloc()
1101 struct audit_buffer *ab = NULL; in audit_log_start() local
1142 ab = audit_buffer_alloc(ctx, gfp_mask, type); in audit_log_start()
1143 if (!ab) { in audit_log_start()
1148 audit_get_stamp(ab->ctx, &t, &serial); in audit_log_start()
1150 audit_log_format(ab, "audit(%lu.%03lu:%u): ", in audit_log_start()
1152 return ab; in audit_log_start()
1163 static inline int audit_expand(struct audit_buffer *ab, int extra) in audit_expand() argument
1165 struct sk_buff *skb = ab->skb; in audit_expand()
1167 int ret = pskb_expand_head(skb, 0, extra, ab->gfp_mask); in audit_expand()
1185 static void audit_log_vformat(struct audit_buffer *ab, const char *fmt, in audit_log_vformat() argument
1192 if (!ab) in audit_log_vformat()
1195 BUG_ON(!ab->skb); in audit_log_vformat()
1196 skb = ab->skb; in audit_log_vformat()
1199 avail = audit_expand(ab, AUDIT_BUFSIZ); in audit_log_vformat()
1209 avail = audit_expand(ab, in audit_log_vformat()
1231 void audit_log_format(struct audit_buffer *ab, const char *fmt, ...) in audit_log_format() argument
1235 if (!ab) in audit_log_format()
1238 audit_log_vformat(ab, fmt, args); in audit_log_format()
1253 void audit_log_n_hex(struct audit_buffer *ab, const unsigned char *buf, in audit_log_n_hex() argument
1261 if (!ab) in audit_log_n_hex()
1264 BUG_ON(!ab->skb); in audit_log_n_hex()
1265 skb = ab->skb; in audit_log_n_hex()
1271 avail = audit_expand(ab, new_len); in audit_log_n_hex()
1289 void audit_log_n_string(struct audit_buffer *ab, const char *string, in audit_log_n_string() argument
1296 if (!ab) in audit_log_n_string()
1299 BUG_ON(!ab->skb); in audit_log_n_string()
1300 skb = ab->skb; in audit_log_n_string()
1304 avail = audit_expand(ab, new_len); in audit_log_n_string()
1346 void audit_log_n_untrustedstring(struct audit_buffer *ab, const char *string, in audit_log_n_untrustedstring() argument
1350 audit_log_n_hex(ab, string, len); in audit_log_n_untrustedstring()
1352 audit_log_n_string(ab, string, len); in audit_log_n_untrustedstring()
1363 void audit_log_untrustedstring(struct audit_buffer *ab, const char *string) in audit_log_untrustedstring() argument
1365 audit_log_n_untrustedstring(ab, string, strlen(string)); in audit_log_untrustedstring()
1369 void audit_log_d_path(struct audit_buffer *ab, const char *prefix, in audit_log_d_path() argument
1375 audit_log_format(ab, "%s", prefix); in audit_log_d_path()
1378 pathname = kmalloc(PATH_MAX+11, ab->gfp_mask); in audit_log_d_path()
1380 audit_log_string(ab, "<no_memory>"); in audit_log_d_path()
1386 audit_log_string(ab, "<too_long>"); in audit_log_d_path()
1388 audit_log_untrustedstring(ab, p); in audit_log_d_path()
1392 void audit_log_session_info(struct audit_buffer *ab) in audit_log_session_info() argument
1397 audit_log_format(ab, " auid=%u ses=%u\n", auid, sessionid); in audit_log_session_info()
1400 void audit_log_key(struct audit_buffer *ab, char *key) in audit_log_key() argument
1402 audit_log_format(ab, " key="); in audit_log_key()
1404 audit_log_untrustedstring(ab, key); in audit_log_key()
1406 audit_log_format(ab, "(null)"); in audit_log_key()
1409 void audit_log_cap(struct audit_buffer *ab, char *prefix, kernel_cap_t *cap) in audit_log_cap() argument
1413 audit_log_format(ab, " %s=", prefix); in audit_log_cap()
1415 audit_log_format(ab, "%08x", in audit_log_cap()
1420 void audit_log_fcaps(struct audit_buffer *ab, struct audit_names *name) in audit_log_fcaps() argument
1427 audit_log_cap(ab, "cap_fp", perm); in audit_log_fcaps()
1431 audit_log_cap(ab, "cap_fi", inh); in audit_log_fcaps()
1436 audit_log_format(ab, " cap_fe=%d cap_fver=%x", in audit_log_fcaps()
1487 struct audit_buffer *ab; in audit_log_name() local
1488 ab = audit_log_start(context, GFP_KERNEL, AUDIT_PATH); in audit_log_name()
1489 if (!ab) in audit_log_name()
1492 audit_log_format(ab, "item=%d", record_num); in audit_log_name()
1495 audit_log_d_path(ab, " name=", path); in audit_log_name()
1500 audit_log_format(ab, " name="); in audit_log_name()
1501 audit_log_untrustedstring(ab, n->name->name); in audit_log_name()
1506 audit_log_d_path(ab, " name=", &context->pwd); in audit_log_name()
1510 audit_log_format(ab, " name="); in audit_log_name()
1511 audit_log_n_untrustedstring(ab, n->name->name, in audit_log_name()
1515 audit_log_format(ab, " name=(null)"); in audit_log_name()
1518 audit_log_format(ab, " inode=%lu" in audit_log_name()
1535 audit_log_format(ab, " osid=%u", n->osid); in audit_log_name()
1539 audit_log_format(ab, " obj=%s", ctx); in audit_log_name()
1544 audit_log_fcaps(ab, n); in audit_log_name()
1545 audit_log_end(ab); in audit_log_name()
1548 int audit_log_task_context(struct audit_buffer *ab) in audit_log_task_context() argument
1566 audit_log_format(ab, " subj=%s", ctx); in audit_log_task_context()
1576 void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk) in audit_log_task_info() argument
1583 if (!ab) in audit_log_task_info()
1596 audit_log_format(ab, in audit_log_task_info()
1614 audit_log_format(ab, " comm="); in audit_log_task_info()
1615 audit_log_untrustedstring(ab, name); in audit_log_task_info()
1620 audit_log_d_path(ab, " exe=", &mm->exe_file->f_path); in audit_log_task_info()
1623 audit_log_task_context(ab); in audit_log_task_info()
1634 struct audit_buffer *ab; in audit_log_link_denied() local
1642 ab = audit_log_start(current->audit_context, GFP_KERNEL, in audit_log_link_denied()
1644 if (!ab) in audit_log_link_denied()
1646 audit_log_format(ab, "op=%s", operation); in audit_log_link_denied()
1647 audit_log_task_info(ab, current); in audit_log_link_denied()
1648 audit_log_format(ab, " res=0"); in audit_log_link_denied()
1649 audit_log_end(ab); in audit_log_link_denied()
1668 void audit_log_end(struct audit_buffer *ab) in audit_log_end() argument
1670 if (!ab) in audit_log_end()
1675 struct nlmsghdr *nlh = nlmsg_hdr(ab->skb); in audit_log_end()
1676 nlh->nlmsg_len = ab->skb->len - NLMSG_HDRLEN; in audit_log_end()
1679 skb_queue_tail(&audit_skb_queue, ab->skb); in audit_log_end()
1682 audit_printk_skb(ab->skb); in audit_log_end()
1684 ab->skb = NULL; in audit_log_end()
1686 audit_buffer_free(ab); in audit_log_end()
1704 struct audit_buffer *ab; in audit_log() local
1707 ab = audit_log_start(ctx, gfp_mask, type); in audit_log()
1708 if (ab) { in audit_log()
1710 audit_log_vformat(ab, fmt, args); in audit_log()
1712 audit_log_end(ab); in audit_log()
1727 void audit_log_secctx(struct audit_buffer *ab, u32 secid) in audit_log_secctx() argument
1735 audit_log_format(ab, " obj=%s", secctx); in audit_log_secctx()