1. 14 1月, 2011 1 次提交
    • D
      kptr_restrict for hiding kernel pointers from unprivileged users · 455cd5ab
      Dan Rosenberg 提交于
      Add the %pK printk format specifier and the /proc/sys/kernel/kptr_restrict
      sysctl.
      
      The %pK format specifier is designed to hide exposed kernel pointers,
      specifically via /proc interfaces.  Exposing these pointers provides an
      easy target for kernel write vulnerabilities, since they reveal the
      locations of writable structures containing easily triggerable function
      pointers.  The behavior of %pK depends on the kptr_restrict sysctl.
      
      If kptr_restrict is set to 0, no deviation from the standard %p behavior
      occurs.  If kptr_restrict is set to 1, the default, if the current user
      (intended to be a reader via seq_printf(), etc.) does not have CAP_SYSLOG
      (currently in the LSM tree), kernel pointers using %pK are printed as 0's.
       If kptr_restrict is set to 2, kernel pointers using %pK are printed as
      0's regardless of privileges.  Replacing with 0's was chosen over the
      default "(null)", which cannot be parsed by userland %p, which expects
      "(nil)".
      
      [akpm@linux-foundation.org: check for IRQ context when !kptr_restrict, save an indent level, s/WARN/WARN_ONCE/]
      [akpm@linux-foundation.org: coding-style fixup]
      [randy.dunlap@oracle.com: fix kernel/sysctl.c warning]
      Signed-off-by: NDan Rosenberg <drosenberg@vsecurity.com>
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Cc: James Morris <jmorris@namei.org>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Thomas Graf <tgraf@infradead.org>
      Cc: Eugene Teo <eugeneteo@kernel.org>
      Cc: Kees Cook <kees.cook@canonical.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Eric Paris <eparis@parisplace.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      455cd5ab
  2. 27 10月, 2010 2 次提交
  3. 10 8月, 2010 1 次提交
  4. 05 7月, 2010 1 次提交
  5. 25 5月, 2010 2 次提交
  6. 25 4月, 2010 1 次提交
  7. 15 4月, 2010 1 次提交
  8. 15 3月, 2010 2 次提交
  9. 07 3月, 2010 3 次提交
  10. 14 1月, 2010 1 次提交
  11. 12 1月, 2010 1 次提交
  12. 11 1月, 2010 1 次提交
  13. 08 1月, 2010 1 次提交
    • J
      lib/vsprintf.c: Add %pMF to format FDDI bit reversed MAC addresses · bc7259a2
      Joe Perches 提交于
      On Mon, 2010-01-04 at 23:43 +0000, Maciej W. Rozycki wrote:
      > The example below shows an address, and the sequence of bits or symbols
      > that would be transmitted when the address is used in the Source Address
      > or Destination Address fields on the MAC header.  The transmission line
      > shows the address bits in the order transmitted, from left to right.  For
      > IEEE 802 LANs these correspond to actual bits on the medium.  The FDDI
      > symbols line shows how the FDDI PHY sends the address bits as encoded
      > symbols.
      >
      >         MSB:            35:7B:12:00:00:01
      >         Canonical:      AC-DE-48-00-00-80
      >         Transmission:   00110101 01111011 00010010 00000000 00000000 00000001
      >         FDDI Symbols:   35 7B 12 00 00 01"
      >
      > Please note that this address has its group bit clear.
      >
      >  This notation is also defined in the "FDDI MEDIA ACCESS CONTROL-2
      > (MAC-2)" (X3T9/92-120) document although that book does not have a need
      > to use the MSB form and it's skipped.
      
      Adds 6 bytes to object size for x86
      
      New:
      $ size lib/vsprintf.o
         text	   data	    bss	    dec	    hex	filename
         8664	      0	      2	   8666	   21da	lib/vsprintf.o
      $ size lib/vsprintf.o
         text    data     bss     dec     hex filename
         8658       0       2    8660    21d4 lib/vsprintf.o
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bc7259a2
  14. 18 12月, 2009 1 次提交
  15. 16 12月, 2009 10 次提交
  16. 05 11月, 2009 4 次提交
  17. 02 10月, 2009 1 次提交
  18. 23 9月, 2009 1 次提交
  19. 22 9月, 2009 1 次提交
  20. 18 9月, 2009 2 次提交
    • S
      vsnprintf: remove duplicate comment of vsnprintf · 0efb4d20
      Steven Rostedt 提交于
      Remove the duplicate comment of bstr_printf that is the same as the
      vsnprintf.
      
      Add the 's' option to the comment for the pointer function. This is
      more of an internal function so the little duplication of the comment
      here is OK.
      Reported-by: NZhaolei <zhaolei@cn.fujitsu.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      0efb4d20
    • S
      vsprintf: add %ps that is the same as %pS but is like %pf · 91adcd2c
      Steven Rostedt 提交于
      On PowerPC64 function pointers do not point directly at the functions,
      but instead point to pointers to the functions. The output of %pF expects
      to point to a pointer to the function, whereas %pS will show the function
      itself.
      
      mcount returns the direct pointer to the function and not the pointer to
      the pointer. Thus %pS must be used to show this. The function tracer
      requires printing of the functions without offsets and uses the %pf
      instead.
      
       %pF produces run_local_timers+0x4/0x1f
       %pf produces just run_local_timers
      
      For PowerPC64, we need to use the direct pointer, and we only have
      %pS which will produce .run_local_timers+0x4/0x1f
      
      This patch creates a %ps that matches the %pf as %pS matches %pF.
      
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Zhao Lei <zhaolei@cn.fujitsu.com>
      Acked-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      91adcd2c
  21. 29 8月, 2009 1 次提交
  22. 30 4月, 2009 1 次提交
    • F
      vsprintf: introduce %pf format specifier · 0c8b946e
      Frederic Weisbecker 提交于
      A printf format specifier which would allow us to print a pure
      function name has been suggested by Andrew Morton a couple of
      months ago.
      
      The current %pF is very convenient to print a function symbol,
      but often we only want to print the name of the function, without
      its asm offset.
      
      That's what  %pf does in this patch.  The lowecase f has been chosen
      for its intuitive meaning of a 'weak kind of %pF'.
      
      The support for this new format would be welcome by the tracing code
      where the need to print pure function names is often needed. This is
      also true for other parts of the kernel:
      
      $ git-grep -E "kallsyms_lookup\(.+?\)"
      arch/blackfin/kernel/traps.c:   symname = kallsyms_lookup(address, &symsize, &offset, &modname, namebuf);
      arch/powerpc/xmon/xmon.c:               name = kallsyms_lookup(pc, &size, &offset, NULL, tmpstr);
      arch/sh/kernel/cpu/sh5/unwind.c:        sym = kallsyms_lookup(pc, NULL, &offset, NULL, namebuf);
      arch/x86/kernel/ftrace.c:       kallsyms_lookup((unsigned long) syscall, NULL, NULL, NULL, str);
      kernel/kprobes.c:               sym = kallsyms_lookup((unsigned long)p->addr, NULL,
      kernel/lockdep.c:       return kallsyms_lookup((unsigned long)key, NULL, NULL, NULL, str);
      kernel/trace/ftrace.c:  kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
      kernel/trace/ftrace.c:  kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
      kernel/trace/ftrace.c:  kallsyms_lookup((unsigned long)rec->ops->func, NULL, NULL, NULL, str);
      kernel/trace/ftrace.c:  kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
      kernel/trace/ftrace.c:  kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
      kernel/trace/ftrace.c:  kallsyms_lookup(rec->ip, NULL, NULL, &modname, str);
      kernel/trace/ftrace.c:  kallsyms_lookup(*ptr, NULL, NULL, NULL, str);
      kernel/trace/trace_functions.c: kallsyms_lookup(ip, NULL, NULL, NULL, str);
      kernel/trace/trace_output.c:    kallsyms_lookup(address, NULL, NULL, NULL, str);
      
      Changes in v2:
      
      - Add the explanation of the %pf role for vsnprintf() and bstr_printf()
      
      - Change the comments by dropping the "asm offset" notion and only
        define the %pf against the actual function offset notion.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: NMike Frysinger <vapier@gentoo.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Zhaolei <zhaolei@cn.fujitsu.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <20090415154817.GC5989@nowhere>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0c8b946e