Skip to content
  1. Mar 20, 2014
    • Richard Guy Briggs's avatar
      audit: allow user processes to log from another PID namespace · 5a3cb3b6
      Richard Guy Briggs authored
      
      
      Still only permit the audit logging daemon and control to operate from the
      initial PID namespace, but allow processes to log from another PID namespace.
      
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      (informed by ebiederman's c776b5d2)
      
      Signed-off-by: default avatarRichard Guy Briggs <rgb@redhat.com>
      5a3cb3b6
    • Richard Guy Briggs's avatar
      audit: anchor all pid references in the initial pid namespace · f1dc4867
      Richard Guy Briggs authored
      
      
      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: default avatarRichard Guy Briggs <rgb@redhat.com>
      f1dc4867
    • Richard Guy Briggs's avatar
      audit: convert PPIDs to the inital PID namespace. · c92cdeb4
      Richard Guy Briggs authored
      
      
      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: default avatarRichard Guy Briggs <rgb@redhat.com>
      c92cdeb4
    • Richard Guy Briggs's avatar
      pid: get pid_t ppid of task in init_pid_ns · ad36d282
      Richard Guy Briggs authored
      
      
      Added the functions task_ppid_nr_ns() and task_ppid_nr() to abstract the lookup
      of the PPID (real_parent's pid_t) of a process, including rcu locking, in the
      arbitrary and init_pid_ns.
      This provides an alternative to sys_getppid(), which is relative to the child
      process' pid namespace.
      
      (informed by ebiederman's 6c621b7e)
      Cc: stable@vger.kernel.org
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: default avatarRichard Guy Briggs <rgb@redhat.com>
      ad36d282
    • Richard Guy Briggs's avatar
      audit: rename the misleading audit_get_context() to audit_take_context() · 4a3eb726
      Richard Guy Briggs authored
      
      
      "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: default avatarRichard Guy Briggs <rgb@redhat.com>
      4a3eb726
    • AKASHI Takahiro's avatar
      audit: Add generic compat syscall support · 4b588411
      AKASHI Takahiro authored
      
      
      lib/audit.c provides a generic function for auditing system calls.
      This patch extends it for compat syscall support on bi-architectures
      (32/64-bit) by adding lib/compat_audit.c.
      What is required to support this feature are:
       * add asm/unistd32.h for compat system call names
       * select CONFIG_AUDIT_ARCH_COMPAT_GENERIC
      
      Signed-off-by: default avatarAKASHI Takahiro <takahiro.akashi@linaro.org>
      Acked-by: default avatarRichard Guy Briggs <rgb@redhat.com>
      Signed-off-by: default avatarEric Paris <eparis@redhat.com>
      4b588411
    • AKASHI Takahiro's avatar
      audit: Add CONFIG_HAVE_ARCH_AUDITSYSCALL · 7a017721
      AKASHI Takahiro authored
      
      
      Currently AUDITSYSCALL has a long list of architecture depencency:
             depends on AUDIT && (X86 || PARISC || PPC || S390 || IA64 || UML ||
      		SPARC64 || SUPERH || (ARM && AEABI && !OABI_COMPAT) || ALPHA)
      The purpose of this patch is to replace it with HAVE_ARCH_AUDITSYSCALL
      for simplicity.
      
      Signed-off-by: default avatarAKASHI Takahiro <takahiro.akashi@linaro.org>
      Acked-by: Will Deacon <will.deacon@arm.com> (arm)
      Acked-by: Richard Guy Briggs <rgb@redhat.com> (audit)
      Acked-by: Matt Turner <mattst88@gmail.com> (alpha)
      Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
      Signed-off-by: default avatarEric Paris <eparis@redhat.com>
      7a017721
    • 蔡正龙's avatar
      015d991f
    • Eric W. Biederman's avatar
      audit: Send replies in the proper network namespace. · 099dd235
      Eric W. Biederman authored
      
      
      In perverse cases of file descriptor passing the current network
      namespace of a process and the network namespace of a socket used by
      that socket may differ.  Therefore use the network namespace of the
      appropiate socket to ensure replies always go to the appropiate
      socket.
      
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      Acked-by: default avatarRichard Guy Briggs <rgb@redhat.com>
      Signed-off-by: default avatarEric Paris <eparis@redhat.com>
      099dd235
    • Eric W. Biederman's avatar
      audit: Use struct net not pid_t to remember the network namespce to reply in · 638a0fd2
      Eric W. Biederman authored
      
      
      While reading through 3.14-rc1 I found a pretty siginficant mishandling
      of network namespaces in the recent audit changes.
      
      In struct audit_netlink_list and audit_reply add a reference to the
      network namespace of the caller and remove the userspace pid of the
      caller.  This cleanly remembers the callers network namespace, and
      removes a huge class of races and nasty failure modes that can occur
      when attempting to relook up the callers network namespace from a pid_t
      (including the caller's network namespace changing, pid wraparound, and
      the pid simply not being present).
      
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      Acked-by: default avatarRichard Guy Briggs <rgb@redhat.com>
      Signed-off-by: default avatarEric Paris <eparis@redhat.com>
      638a0fd2
    • William Roberts's avatar
      audit: Audit proc/<pid>/cmdline aka proctitle · 3f1c8250
      William Roberts authored
      
      
      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: default avatarWilliam Roberts <wroberts@tresys.com>
      Signed-off-by: default avatarEric Paris <eparis@redhat.com>
      3f1c8250
    • William Roberts's avatar
      proc: Update get proc_pid_cmdline() to use mm.h helpers · 21a6457a
      William Roberts authored
      
      
      Re-factor proc_pid_cmdline() to use get_cmdline() helper
      from mm.h.
      
      Acked-by: default avatarDavid Rientjes <rientjes@google.com>
      Acked-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      Acked-by: default avatarRichard Guy Briggs <rgb@redhat.com>
      
      Signed-off-by: default avatarWilliam Roberts <wroberts@tresys.com>
      Acked-by: default avatarRichard Guy Briggs <rgb@redhat.com>
      Signed-off-by: default avatarEric Paris <eparis@redhat.com>
      21a6457a
  2. Mar 08, 2014
  3. Jan 20, 2014
  4. Jan 18, 2014
  5. Jan 17, 2014
  6. Jan 16, 2014
    • Robert Richter's avatar
      perf/x86/amd/ibs: Fix waking up from S3 for AMD family 10h · bee09ed9
      Robert Richter authored
      
      
      On AMD family 10h we see following error messages while waking up from
      S3 for all non-boot CPUs leading to a failed IBS initialization:
      
       Enabling non-boot CPUs ...
       smpboot: Booting Node 0 Processor 1 APIC 0x1
       [Firmware Bug]: cpu 1, try to use APIC500 (LVT offset 0) for vector 0x400, but the register is already in use for vector 0xf9 on another cpu
       perf: IBS APIC setup failed on cpu #1
       process: Switch to broadcast mode on CPU1
       CPU1 is up
       ...
       ACPI: Waking up from system sleep state S3
      
      Reason for this is that during suspend the LVT offset for the IBS
      vector gets lost and needs to be reinialized while resuming.
      
      The offset is read from the IBSCTL msr. On family 10h the offset needs
      to be 1 as offset 0 is used for the MCE threshold interrupt, but
      firmware assings it for IBS to 0 too. The kernel needs to reprogram
      the vector. The msr is a readonly node msr, but a new value can be
      written via pci config space access. The reinitialization is
      implemented for family 10h in setup_ibs_ctl() which is forced during
      IBS setup.
      
      This patch fixes IBS setup after waking up from S3 by adding
      resume/supend hooks for the boot cpu which does the offset
      reinitialization.
      
      Marking it as stable to let distros pick up this fix.
      
      Signed-off-by: default avatarRobert Richter <rric@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Cc: <stable@vger.kernel.org> v3.2..
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Link: http://lkml.kernel.org/r/1389797849-5565-1-git-send-email-rric.net@gmail.com
      
      
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      bee09ed9
    • Peter Zijlstra's avatar
      x86, mm, perf: Allow recursive faults from interrupts · c026b359
      Peter Zijlstra authored
      
      
      Waiman managed to trigger a PMI while in a emulate_vsyscall() fault,
      the PMI in turn managed to trigger a fault while obtaining a stack
      trace. This triggered the sig_on_uaccess_error recursive fault logic
      and killed the process dead.
      
      Fix this by explicitly excluding interrupts from the recursive fault
      logic.
      
      Reported-and-Tested-by: default avatarWaiman Long <waiman.long@hp.com>
      Fixes: e00b12e6 ("perf/x86: Further optimize copy_from_user_nmi()")
      Cc: Aswin Chandramouleeswaran <aswin@hp.com>
      Cc: Scott J Norton <scott.norton@hp.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20140110200603.GJ7572@laptop.programming.kicks-ass.net
      
      
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      c026b359