1. 24 9月, 2014 5 次提交
  2. 10 6月, 2014 1 次提交
  3. 20 3月, 2014 7 次提交
    • J
      audit: remove stray newline from audit_log_execve_info() audit_panic() call · b7550787
      Joe Perches 提交于
      There's an unnecessary use of a \n in audit_panic.
      Signed-off-by: NRichard Guy Briggs <rgb@redhat.com>
      b7550787
    • E
      audit: include subject in login records · ddfad8af
      Eric Paris 提交于
      The login uid change record does not include the selinux context of the
      task logging in.  Add that information.
      
      (Updated from 2011-01: RHBZ:670328 -- RGB)
      Reported-by: NSteve Grubb <sgrubb@redhat.com>
      Acked-by: NJames Morris <jmorris@redhat.com>
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Signed-off-by: NAristeu Rozanski <arozansk@redhat.com>
      Signed-off-by: NRichard Guy Briggs <rgb@redhat.com>
      ddfad8af
    • R
      audit: remove superfluous new- prefix in AUDIT_LOGIN messages · aa589a13
      Richard Guy Briggs 提交于
      The new- prefix on ses and auid are un-necessary and break ausearch.
      Signed-off-by: NRichard Guy Briggs <rgb@redhat.com>
      aa589a13
    • R
      audit: anchor all pid references in the initial pid namespace · f1dc4867
      Richard Guy Briggs 提交于
      Store and log all PIDs with reference to the initial PID namespace and
      use the access functions task_pid_nr() and task_tgid_nr() for task->pid
      and task->tgid.
      
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      (informed by ebiederman's c776b5d2)
      Signed-off-by: NRichard Guy Briggs <rgb@redhat.com>
      f1dc4867
    • R
      audit: convert PPIDs to the inital PID namespace. · c92cdeb4
      Richard Guy Briggs 提交于
      sys_getppid() returns the parent pid of the current process in its own pid
      namespace.  Since audit filters are based in the init pid namespace, a process
      could avoid a filter or trigger an unintended one by being in an alternate pid
      namespace or log meaningless information.
      
      Switch to task_ppid_nr() for PPIDs to anchor all audit filters in the
      init_pid_ns.
      
      (informed by ebiederman's 6c621b7e)
      Cc: stable@vger.kernel.org
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NRichard Guy Briggs <rgb@redhat.com>
      c92cdeb4
    • R
      audit: rename the misleading audit_get_context() to audit_take_context() · 4a3eb726
      Richard Guy Briggs 提交于
      "get" usually implies incrementing a refcount into a structure to indicate a
      reference being held by another part of code.
      
      Change this function name to indicate it is in fact being taken from it,
      returning the value while clearing it in the supplying structure.
      Signed-off-by: NRichard Guy Briggs <rgb@redhat.com>
      4a3eb726
    • W
      audit: Audit proc/<pid>/cmdline aka proctitle · 3f1c8250
      William Roberts 提交于
      During an audit event, cache and print the value of the process's
      proctitle value (proc/<pid>/cmdline). This is useful in situations
      where processes are started via fork'd virtual machines where the
      comm field is incorrect. Often times, setting the comm field still
      is insufficient as the comm width is not very wide and most
      virtual machine "package names" do not fit. Also, during execution,
      many threads have their comm field set as well. By tying it back to
      the global cmdline value for the process, audit records will be more
      complete in systems with these properties. An example of where this
      is useful and applicable is in the realm of Android. With Android,
      their is no fork/exec for VM instances. The bare, preloaded Dalvik
      VM listens for a fork and specialize request. When this request comes
      in, the VM forks, and the loads the specific application (specializing).
      This was done to take advantage of COW and to not require a load of
      basic packages by the VM on very app spawn. When this spawn occurs,
      the package name is set via setproctitle() and shows up in procfs.
      Many of these package names are longer then 16 bytes, the historical
      width of task->comm. Having the cmdline in the audit records will
      couple the application back to the record directly. Also, on my
      Debian development box, some audit records were more useful then
      what was printed under comm.
      
      The cached proctitle is tied to the life-cycle of the audit_context
      structure and is built on demand.
      
      Proctitle is controllable by userspace, and thus should not be trusted.
      It is meant as an aid to assist in debugging. The proctitle event is
      emitted during syscall audits, and can be filtered with auditctl.
      
      Example:
      type=AVC msg=audit(1391217013.924:386): avc:  denied  { getattr } for  pid=1971 comm="mkdir" name="/" dev="selinuxfs" ino=1 scontext=system_u:system_r:consolekit_t:s0-s0:c0.c255 tcontext=system_u:object_r:security_t:s0 tclass=filesystem
      type=SYSCALL msg=audit(1391217013.924:386): arch=c000003e syscall=137 success=yes exit=0 a0=7f019dfc8bd7 a1=7fffa6aed2c0 a2=fffffffffff4bd25 a3=7fffa6aed050 items=0 ppid=1967 pid=1971 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="mkdir" exe="/bin/mkdir" subj=system_u:system_r:consolekit_t:s0-s0:c0.c255 key=(null)
      type=UNKNOWN[1327] msg=audit(1391217013.924:386):  proctitle=6D6B646972002D70002F7661722F72756E2F636F6E736F6C65
      
      Acked-by: Steve Grubb <sgrubb@redhat.com> (wrt record formating)
      Signed-off-by: NWilliam Roberts <wroberts@tresys.com>
      Signed-off-by: NEric Paris <eparis@redhat.com>
      3f1c8250
  4. 08 3月, 2014 1 次提交
  5. 06 2月, 2014 1 次提交
    • L
      execve: use 'struct filename *' for executable name passing · c4ad8f98
      Linus Torvalds 提交于
      This changes 'do_execve()' to get the executable name as a 'struct
      filename', and to free it when it is done.  This is what the normal
      users want, and it simplifies and streamlines their error handling.
      
      The controlled lifetime of the executable name also fixes a
      use-after-free problem with the trace_sched_process_exec tracepoint: the
      lifetime of the passed-in string for kernel users was not at all
      obvious, and the user-mode helper code used UMH_WAIT_EXEC to serialize
      the pathname allocation lifetime with the execve() having finished,
      which in turn meant that the trace point that happened after
      mm_release() of the old process VM ended up using already free'd memory.
      
      To solve the kernel string lifetime issue, this simply introduces
      "getname_kernel()" that works like the normal user-space getname()
      function, except with the source coming from kernel memory.
      
      As Oleg points out, this also means that we could drop the tcomm[] array
      from 'struct linux_binprm', since the pathname lifetime now covers
      setup_new_exec().  That would be a separate cleanup.
      Reported-by: NIgor Zhbanov <i.zhbanov@samsung.com>
      Tested-by: NSteven Rostedt <rostedt@goodmis.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c4ad8f98
  6. 14 1月, 2014 6 次提交
  7. 07 11月, 2013 1 次提交
    • E
      audit: fix type of sessionid in audit_set_loginuid() · 9175c9d2
      Eric Paris 提交于
      sfr pointed out that with CONFIG_UIDGID_STRICT_TYPE_CHECKS set the audit
      tree would not build.  This is because the oldsessionid in
      audit_set_loginuid() was accidentally being declared as a kuid_t.  This
      patch fixes that declaration mistake.
      
      Example of problem:
      kernel/auditsc.c: In function 'audit_set_loginuid':
      kernel/auditsc.c:2003:15: error: incompatible types when assigning to
      type 'kuid_t' from type 'int'
        oldsessionid = audit_get_sessionid(current);
      Reported-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: NEric Paris <eparis@redhat.com>
      9175c9d2
  8. 06 11月, 2013 11 次提交
  9. 10 7月, 2013 1 次提交
    • J
      audit: fix mq_open and mq_unlink to add the MQ root as a hidden parent audit_names record · 79f6530c
      Jeff Layton 提交于
      The old audit PATH records for mq_open looked like this:
      
        type=PATH msg=audit(1366282323.982:869): item=1 name=(null) inode=6777
        dev=00:0c mode=041777 ouid=0 ogid=0 rdev=00:00
        obj=system_u:object_r:tmpfs_t:s15:c0.c1023
        type=PATH msg=audit(1366282323.982:869): item=0 name="test_mq" inode=26732
        dev=00:0c mode=0100700 ouid=0 ogid=0 rdev=00:00
        obj=staff_u:object_r:user_tmpfs_t:s15:c0.c1023
      
      ...with the audit related changes that went into 3.7, they now look like this:
      
        type=PATH msg=audit(1366282236.776:3606): item=2 name=(null) inode=66655
        dev=00:0c mode=0100700 ouid=0 ogid=0 rdev=00:00
        obj=staff_u:object_r:user_tmpfs_t:s15:c0.c1023
        type=PATH msg=audit(1366282236.776:3606): item=1 name=(null) inode=6926
        dev=00:0c mode=041777 ouid=0 ogid=0 rdev=00:00
        obj=system_u:object_r:tmpfs_t:s15:c0.c1023
        type=PATH msg=audit(1366282236.776:3606): item=0 name="test_mq"
      
      Both of these look wrong to me.  As Steve Grubb pointed out:
      
       "What we need is 1 PATH record that identifies the MQ.  The other PATH
        records probably should not be there."
      
      Fix it to record the mq root as a parent, and flag it such that it
      should be hidden from view when the names are logged, since the root of
      the mq filesystem isn't terribly interesting.  With this change, we get
      a single PATH record that looks more like this:
      
        type=PATH msg=audit(1368021604.836:484): item=0 name="test_mq" inode=16914
        dev=00:0c mode=0100644 ouid=0 ogid=0 rdev=00:00
        obj=unconfined_u:object_r:user_tmpfs_t:s0
      
      In order to do this, a new audit_inode_parent_hidden() function is
      added.  If we do it this way, then we avoid having the existing callers
      of audit_inode needing to do any sort of flag conversion if auditing is
      inactive.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Reported-by: NJiri Jaburek <jjaburek@redhat.com>
      Cc: Steve Grubb <sgrubb@redhat.com>
      Cc: Eric Paris <eparis@redhat.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      79f6530c
  10. 08 5月, 2013 1 次提交
  11. 01 5月, 2013 2 次提交
  12. 30 4月, 2013 1 次提交
  13. 16 4月, 2013 1 次提交
  14. 12 4月, 2013 1 次提交
    • E
      Audit: do not print error when LSMs disabled · ad395abe
      Eric Paris 提交于
      RHBZ: 785936
      
      If the audit system collects a record about one process sending a signal
      to another process it includes in that collection the 'secid' or 'an int
      used to represet an LSM label.'  If there is no LSM enabled it will
      collect a 0.  The problem is that when we attempt to print that record
      we ask the LSM to convert the secid back to a string.  Since there is no
      LSM it returns EOPNOTSUPP.
      
      Most code in the audit system checks if the secid is 0 and does not
      print LSM info in that case.  The signal information code however forgot
      that check.  Thus users will see a message in syslog indicating that
      converting the sid to string failed.  Add the right check.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      ad395abe