1. 24 3月, 2011 1 次提交
    • N
      vsprintf: Introduce %pB format specifier · 0f77a8d3
      Namhyung Kim 提交于
      The %pB format specifier is for stack backtrace. Its handler
      sprint_backtrace() does symbol lookup using (address-1) to
      ensure the address will not point outside of the function.
      
      If there is a tail-call to the function marked "noreturn",
      gcc optimized out the code after the call then causes saved
      return address points outside of the function (i.e. the start
      of the next function), so pollutes call trace somewhat.
      
      This patch adds the %pB printk mechanism that allows architecture
      call-trace printout functions to improve backtrace printouts.
      Signed-off-by: NNamhyung Kim <namhyung@gmail.com>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: linux-arch@vger.kernel.org
      LKML-Reference: <1300934550-21394-1-git-send-email-namhyung@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0f77a8d3
  2. 14 1月, 2011 2 次提交
    • A
      lib/vsprintf.c: fix vscnprintf() if @size is == 0 · b921c69f
      Anton Arapov 提交于
      vscnprintf() should return 0 if @size is == 0.  Update the comment for it,
      as @size is unsigned.
      
      This change based on the code of commit
      b903c0b8 ("lib: fix scnprintf() if @size
      is == 0") moves the real fix into vscnprinf() from scnprintf() and makes
      scnprintf() call vscnprintf(), thus avoid code duplication.
      Signed-off-by: NAnton Arapov <aarapov@redhat.com>
      Acked-by: NChangli Gao <xiaosuo@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b921c69f
    • 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
  3. 27 10月, 2010 2 次提交
  4. 10 8月, 2010 1 次提交
  5. 05 7月, 2010 1 次提交
  6. 25 5月, 2010 2 次提交
  7. 25 4月, 2010 1 次提交
  8. 15 4月, 2010 1 次提交
  9. 15 3月, 2010 2 次提交
  10. 07 3月, 2010 3 次提交
  11. 14 1月, 2010 1 次提交
  12. 12 1月, 2010 1 次提交
  13. 11 1月, 2010 1 次提交
  14. 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
  15. 18 12月, 2009 1 次提交
  16. 16 12月, 2009 10 次提交
  17. 05 11月, 2009 4 次提交
  18. 02 10月, 2009 1 次提交
  19. 23 9月, 2009 1 次提交
  20. 22 9月, 2009 1 次提交
  21. 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