~ubuntu-branches/ubuntu/quantal/linux-lowlatency/quantal

« back to all changes in this revision

Viewing changes to kernel/auditsc.c

  • Committer: Package Import Robot
  • Author(s): Luke Yelavich, Luke Yelavich
  • Date: 2012-03-22 15:37:37 UTC
  • Revision ID: package-import@ubuntu.com-20120322153737-rg85rk5zle7b0iu9
Tags: 3.2.0-20.28
[ Luke Yelavich ]
* Rebase against Ubuntu-3.2.0-20.32
* [Config] Update configs after rebase against precise mainline

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
#include <linux/syscalls.h>
68
68
#include <linux/capability.h>
69
69
#include <linux/fs_struct.h>
 
70
#include <linux/compat.h>
70
71
 
71
72
#include "audit.h"
72
73
 
2499
2500
        context->type = AUDIT_MMAP;
2500
2501
}
2501
2502
 
2502
 
/**
2503
 
 * audit_core_dumps - record information about processes that end abnormally
2504
 
 * @signr: signal value
2505
 
 *
2506
 
 * If a process ends with a core dump, something fishy is going on and we
2507
 
 * should record the event for investigation.
2508
 
 */
2509
 
void audit_core_dumps(long signr)
 
2503
static void audit_log_abend(struct audit_buffer *ab, char *reason, long signr)
2510
2504
{
2511
 
        struct audit_buffer *ab;
2512
 
        u32 sid;
2513
 
        uid_t auid = audit_get_loginuid(current), uid;
 
2505
        uid_t auid, uid;
2514
2506
        gid_t gid;
2515
 
        unsigned int sessionid = audit_get_sessionid(current);
2516
 
 
2517
 
        if (!audit_enabled)
2518
 
                return;
2519
 
 
2520
 
        if (signr == SIGQUIT)   /* don't care for those */
2521
 
                return;
2522
 
 
2523
 
        ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_ANOM_ABEND);
 
2507
        unsigned int sessionid;
 
2508
 
 
2509
        auid = audit_get_loginuid(current);
 
2510
        sessionid = audit_get_sessionid(current);
2524
2511
        current_uid_gid(&uid, &gid);
 
2512
 
2525
2513
        audit_log_format(ab, "auid=%u uid=%u gid=%u ses=%u",
2526
2514
                         auid, uid, gid, sessionid);
2527
 
        security_task_getsecid(current, &sid);
2528
 
        if (sid) {
2529
 
                char *ctx = NULL;
2530
 
                u32 len;
2531
 
 
2532
 
                if (security_secid_to_secctx(sid, &ctx, &len))
2533
 
                        audit_log_format(ab, " ssid=%u", sid);
2534
 
                else {
2535
 
                        audit_log_format(ab, " subj=%s", ctx);
2536
 
                        security_release_secctx(ctx, len);
2537
 
                }
2538
 
        }
 
2515
        audit_log_task_context(ab);
2539
2516
        audit_log_format(ab, " pid=%d comm=", current->pid);
2540
2517
        audit_log_untrustedstring(ab, current->comm);
 
2518
        audit_log_format(ab, " reason=");
 
2519
        audit_log_string(ab, reason);
2541
2520
        audit_log_format(ab, " sig=%ld", signr);
 
2521
}
 
2522
/**
 
2523
 * audit_core_dumps - record information about processes that end abnormally
 
2524
 * @signr: signal value
 
2525
 *
 
2526
 * If a process ends with a core dump, something fishy is going on and we
 
2527
 * should record the event for investigation.
 
2528
 */
 
2529
void audit_core_dumps(long signr)
 
2530
{
 
2531
        struct audit_buffer *ab;
 
2532
 
 
2533
        if (!audit_enabled)
 
2534
                return;
 
2535
 
 
2536
        if (signr == SIGQUIT)   /* don't care for those */
 
2537
                return;
 
2538
 
 
2539
        ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_ANOM_ABEND);
 
2540
        audit_log_abend(ab, "memory violation", signr);
 
2541
        audit_log_end(ab);
 
2542
}
 
2543
 
 
2544
void __audit_seccomp(unsigned long syscall, long signr, int code)
 
2545
{
 
2546
        struct audit_buffer *ab;
 
2547
 
 
2548
        ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_ANOM_ABEND);
 
2549
        audit_log_abend(ab, "seccomp", signr);
 
2550
        audit_log_format(ab, " syscall=%ld", syscall);
 
2551
#ifdef CONFIG_COMPAT
 
2552
        audit_log_format(ab, " compat=%d", is_compat_task());
 
2553
#endif
 
2554
        audit_log_format(ab, " ip=0x%lx", KSTK_EIP(current));
 
2555
        audit_log_format(ab, " code=0x%x", code);
2542
2556
        audit_log_end(ab);
2543
2557
}
2544
2558