28 Apr, 2008

5 commits

  • Argument is S_IF... | , where index is normally 0 or 1.
    Triggers if chosen element of ctx->names[] is present and the
    mode of object in question matches the upper bits of argument.
    I.e. for things like "is the argument of that chmod a directory",
    etc.

    Signed-off-by: Al Viro

    Al Viro
     
  • Use msglen as the identifier.
    kernel/audit.c:724:10: warning: symbol 'len' shadows an earlier one
    kernel/audit.c:575:8: originally declared here

    Don't use ino_f to check the inode field at the end of the functions.
    kernel/auditfilter.c:429:22: warning: symbol 'f' shadows an earlier one
    kernel/auditfilter.c:420:21: originally declared here
    kernel/auditfilter.c:542:22: warning: symbol 'f' shadows an earlier one
    kernel/auditfilter.c:529:21: originally declared here

    i always used as a counter for a for loop and initialized to zero before
    use. Eliminate the inner i variables.
    kernel/auditsc.c:1295:8: warning: symbol 'i' shadows an earlier one
    kernel/auditsc.c:1152:6: originally declared here
    kernel/auditsc.c:1320:7: warning: symbol 'i' shadows an earlier one
    kernel/auditsc.c:1152:6: originally declared here

    Signed-off-by: Harvey Harrison
    Signed-off-by: Al Viro

    Harvey Harrison
     
  • Leave audit_sig_{uid|pid|sid} protected by #ifdef CONFIG_AUDITSYSCALL.

    Noticed by sparse:
    kernel/audit.c:73:6: warning: symbol 'audit_ever_enabled' was not declared. Should it be static?
    kernel/audit.c:100:8: warning: symbol 'audit_sig_uid' was not declared. Should it be static?
    kernel/audit.c:101:8: warning: symbol 'audit_sig_pid' was not declared. Should it be static?
    kernel/audit.c:102:6: warning: symbol 'audit_sig_sid' was not declared. Should it be static?
    kernel/audit.c:117:23: warning: symbol 'audit_ih' was not declared. Should it be static?
    kernel/auditfilter.c:78:18: warning: symbol 'audit_filter_list' was not declared. Should it be static?

    Signed-off-by: Harvey Harrison
    Signed-off-by: Al Viro

    Harvey Harrison
     
  • This patch standardized the string auditing interfaces. No userspace
    changes will be visible and this is all just cleanup and consistancy
    work. We have the following string audit interfaces to use:

    void audit_log_n_hex(struct audit_buffer *ab, const unsigned char *buf, size_t len);

    void audit_log_n_string(struct audit_buffer *ab, const char *buf, size_t n);
    void audit_log_string(struct audit_buffer *ab, const char *buf);

    void audit_log_n_untrustedstring(struct audit_buffer *ab, const char *string, size_t n);
    void audit_log_untrustedstring(struct audit_buffer *ab, const char *string);

    This may be the first step to possibly fixing some of the issues that
    people have with the string output from the kernel audit system. But we
    still don't have an agreed upon solution to that problem.

    Signed-off-by: Eric Paris
    Signed-off-by: Al Viro

    Eric Paris
     
  • A couple of audit printk statements did not have a newline.

    Signed-off-by: Eric Paris
    Signed-off-by: Al Viro

    Eric Paris
     

19 Apr, 2008

3 commits

  • Rename the se_str and se_rule audit fields elements to
    lsm_str and lsm_rule to avoid confusion.

    Signed-off-by: Casey Schaufler
    Signed-off-by: Ahmed S. Darwish
    Acked-by: James Morris

    Ahmed S. Darwish
     
  • Convert Audit to use the new LSM Audit hooks instead of
    the exported SELinux interface.

    Basically, use:
    security_audit_rule_init
    secuirty_audit_rule_free
    security_audit_rule_known
    security_audit_rule_match

    instad of (respectively) :
    selinux_audit_rule_init
    selinux_audit_rule_free
    audit_rule_has_selinux
    selinux_audit_rule_match

    Signed-off-by: Casey Schaufler
    Signed-off-by: Ahmed S. Darwish
    Acked-by: James Morris

    Ahmed S. Darwish
     
  • Stop using the following exported SELinux interfaces:
    selinux_get_inode_sid(inode, sid)
    selinux_get_ipc_sid(ipcp, sid)
    selinux_get_task_sid(tsk, sid)
    selinux_sid_to_string(sid, ctx, len)
    kfree(ctx)

    and use following generic LSM equivalents respectively:
    security_inode_getsecid(inode, secid)
    security_ipc_getsecid*(ipcp, secid)
    security_task_getsecid(tsk, secid)
    security_sid_to_secctx(sid, ctx, len)
    security_release_secctx(ctx, len)

    Call security_release_secctx only if security_secid_to_secctx
    succeeded.

    Signed-off-by: Casey Schaufler
    Signed-off-by: Ahmed S. Darwish
    Acked-by: James Morris
    Reviewed-by: Paul Moore

    Ahmed S. Darwish
     

01 Mar, 2008

1 commit

  • Fix the following compiler warning by using "%zu" as defined in C99.

    CC kernel/auditsc.o
    kernel/auditsc.c: In function 'audit_log_single_execve_arg':
    kernel/auditsc.c:1074: warning: format '%ld' expects type 'long int', but
    argument 4 has type 'size_t'

    Signed-off-by: Paul Moore
    Signed-off-by: Al Viro

    Paul Moore
     

19 Feb, 2008

1 commit

  • Clearly this was supposed to be an == not an = in the if statement.
    This patch also causes us to stop processing execve args once we have
    failed rather than continuing to loop on failure over and over and over.

    Signed-off-by: Eric Paris
    Acked-by: Al Viro
    Signed-off-by: Al Viro
    Signed-off-by: Linus Torvalds

    Eric Paris
     

15 Feb, 2008

2 commits

  • audit_log_d_path() is a d_path() wrapper that is used by the audit code. To
    use a struct path in audit_log_d_path() I need to embed it into struct
    avc_audit_data.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Jan Blunck
    Acked-by: Christoph Hellwig
    Cc: Al Viro
    Cc: "J. Bruce Fields"
    Cc: Neil Brown
    Cc: Stephen Smalley
    Cc: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Blunck
     
  • * Use struct path in fs_struct.

    Signed-off-by: Andreas Gruenbacher
    Signed-off-by: Jan Blunck
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Blunck
     

02 Feb, 2008

9 commits


23 Oct, 2007

1 commit

  • Fix kernel-doc for auditsc parameter changes.

    Warning(linux-2.6.23-git17//kernel/auditsc.c:1623): No description found for parameter 'dentry'
    Warning(linux-2.6.23-git17//kernel/auditsc.c:1666): No description found for parameter 'dentry'

    Signed-off-by: Randy Dunlap
    Signed-off-by: Linus Torvalds

    Randy Dunlap
     

21 Oct, 2007

2 commits

  • New kind of audit rule predicates: "object is visible in given subtree".
    The part that can be sanely implemented, that is. Limitations:
    * if you have hardlink from outside of tree, you'd better watch
    it too (or just watch the object itself, obviously)
    * if you mount something under a watched tree, tell audit
    that new chunk should be added to watched subtrees
    * if you umount something in a watched tree and it's still mounted
    elsewhere, you will get matches on events happening there. New command
    tells audit to recalculate the trees, trimming such sources of false
    positives.

    Note that it's _not_ about path - if something mounted in several places
    (multiple mount, bindings, different namespaces, etc.), the match does
    _not_ depend on which one we are using for access.

    Signed-off-by: Al Viro

    Al Viro
     
  • makes caller simpler *and* allows to scan ancestors

    Signed-off-by: Al Viro

    Al Viro
     

19 Oct, 2007

1 commit


17 Oct, 2007

1 commit


10 Oct, 2007

1 commit


23 Aug, 2007

1 commit


08 Aug, 2007

1 commit

  • The check for audit_signals is misplaced and the check for
    audit_dummy_context() is missing; as the result, if we send a signal to
    auditd from task with NULL ->audit_context while we have audit_signals
    != 0 we end up with an oops.

    Signed-off-by: Al Viro
    Acked-by: James Morris
    Signed-off-by: Linus Torvalds

    Al Viro
     

29 Jul, 2007

1 commit

  • copy_from_user() returns the number of bytes not copied, hence 0 is the
    expected output.

    axi->mm might not be valid anymore when not equal to current->mm, do not
    dereference before checking that - thanks to Al for spotting that.

    Signed-off-by: Peter Zijlstra
    Tested-by: Steve Grubb
    Signed-off-by: Linus Torvalds

    Peter Zijlstra
     

22 Jul, 2007

2 commits

  • Selinux folks had been complaining about the lack of AVC_PATH
    records when audit is disabled. I must admit my stupidity - I assumed
    that avc_audit() really couldn't use audit_log_d_path() because of
    deadlocks (== could be called with dcache_lock or vfsmount_lock held).
    Shouldn't have made that assumption - it never gets called that way.
    It _is_ called under spinlocks, but not those.

    Since audit_log_d_path() uses ab->gfp_mask for allocations,
    kmalloc() in there is not a problem. IOW, the simple fix is sufficient:
    let's rip AUDIT_AVC_PATH out and simply generate pathname as part of main
    record. It's trivial to do.

    Signed-off-by: Al Viro
    Acked-by: James Morris

    Al Viro
     
  • The mode fields for IPC records are not consistent. Some are hex, others are
    octal. This patch makes them all octal.

    Signed-off-by: Steve Grubb
    Signed-off-by: Al Viro

    Steve Grubb
     

20 Jul, 2007

2 commits

  • Remove the arg+env limit of MAX_ARG_PAGES by copying the strings directly from
    the old mm into the new mm.

    We create the new mm before the binfmt code runs, and place the new stack at
    the very top of the address space. Once the binfmt code runs and figures out
    where the stack should be, we move it downwards.

    It is a bit peculiar in that we have one task with two mm's, one of which is
    inactive.

    [a.p.zijlstra@chello.nl: limit stack size]
    Signed-off-by: Ollie Wild
    Signed-off-by: Peter Zijlstra
    Cc:
    Cc: Hugh Dickins
    [bunk@stusta.de: unexport bprm_mm_init]
    Signed-off-by: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ollie Wild
     
  • The purpose of audit_bprm() is to log the argv array to a userspace daemon at
    the end of the execve system call. Since user-space hasn't had time to run,
    this array is still in pristine state on the process' stack; so no need to
    copy it, we can just grab it from there.

    In order to minimize the damage to audit_log_*() copy each string into a
    temporary kernel buffer first.

    Currently the audit code requires that the full argument vector fits in a
    single packet. So currently it does clip the argv size to a (sysctl) limit,
    but only when execve auditing is enabled.

    If the audit protocol gets extended to allow for multiple packets this check
    can be removed.

    Signed-off-by: Peter Zijlstra
    Signed-off-by: Ollie Wild
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Zijlstra
     

17 Jul, 2007

2 commits

  • Fix parameter name in audit_core_dumps for kerneldoc.

    Signed-off-by: Henrik Kretzschmar
    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Henrik Kretzschmar
     
  • Add TTY input auditing, used to audit system administrator's actions. This is
    required by various security standards such as DCID 6/3 and PCI to provide
    non-repudiation of administrator's actions and to allow a review of past
    actions if the administrator seems to overstep their duties or if the system
    becomes misconfigured for unknown reasons. These requirements do not make it
    necessary to audit TTY output as well.

    Compared to an user-space keylogger, this approach records TTY input using the
    audit subsystem, correlated with other audit events, and it is completely
    transparent to the user-space application (e.g. the console ioctls still
    work).

    TTY input auditing works on a higher level than auditing all system calls
    within the session, which would produce an overwhelming amount of mostly
    useless audit events.

    Add an "audit_tty" attribute, inherited across fork (). Data read from TTYs
    by process with the attribute is sent to the audit subsystem by the kernel.
    The audit netlink interface is extended to allow modifying the audit_tty
    attribute, and to allow sending explanatory audit events from user-space (for
    example, a shell might send an event containing the final command, after the
    interactive command-line editing and history expansion is performed, which
    might be difficult to decipher from the TTY input alone).

    Because the "audit_tty" attribute is inherited across fork (), it would be set
    e.g. for sshd restarted within an audited session. To prevent this, the
    audit_tty attribute is cleared when a process with no open TTY file
    descriptors (e.g. after daemon startup) opens a TTY.

    See https://www.redhat.com/archives/linux-audit/2007-June/msg00000.html for a
    more detailed rationale document for an older version of this patch.

    [akpm@linux-foundation.org: build fix]
    Signed-off-by: Miloslav Trmac
    Cc: Al Viro
    Cc: Alan Cox
    Cc: Paul Fulghum
    Cc: Casey Schaufler
    Cc: Steve Grubb
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miloslav Trmac
     

11 May, 2007

4 commits

  • Hi,

    I have been working on some code that detects abnormal events based on audit
    system events. One kind of event that we currently have no visibility for is
    when a program terminates due to segfault - which should never happen on a
    production machine. And if it did, you'd want to investigate it. Attached is a
    patch that collects these events and sends them into the audit system.

    Signed-off-by: Steve Grubb
    Signed-off-by: Al Viro

    Steve Grubb
     
  • Make more effort to detect previously collected names, so we don't log
    multiple PATH records for a single filesystem object. Add
    audit_inc_name_count() to reduce duplicate code.

    Signed-off-by: Amy Griffis
    Signed-off-by: Al Viro

    Amy Griffis
     
  • Handle the edge cases for POSIX message queue auditing. Collect inode
    info when opening an existing mq, and for send/receive operations. Remove
    audit_inode_update() as it has really evolved into the equivalent of
    audit_inode().

    Signed-off-by: Amy Griffis
    Signed-off-by: Al Viro

    Amy Griffis
     
  • Audit contexts can be reused, so initialize a name's osid to the
    default in audit_getname(). This ensures we don't log a bogus object
    label when no inode data is collected for a name.

    Signed-off-by: Amy Griffis
    Signed-off-by: Al Viro

    Amy Griffis