Skip to content
  1. Sep 02, 2009
    • David Howells's avatar
      CRED: Add some configurable debugging [try #6] · e0e81739
      David Howells authored
      Add a config option (CONFIG_DEBUG_CREDENTIALS) to turn on some debug checking
      for credential management.  The additional code keeps track of the number of
      pointers from task_structs to any given cred struct, and checks to see that
      this number never exceeds the usage count of the cred struct (which includes
      all references, not just those from task_structs).
      
      Furthermore, if SELinux is enabled, the code also checks that the security
      pointer in the cred struct is never seen to be invalid.
      
      This attempts to catch the bug whereby inode_has_perm() faults in an nfsd
      kernel thread on seeing cred->security be a NULL pointer (it appears that the
      credential struct has been previously released):
      
      	http://www.kerneloops.org/oops.php?number=252883
      
      
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      e0e81739
  2. Aug 29, 2009
  3. Aug 27, 2009
  4. Aug 23, 2009
    • Paul E. McKenney's avatar
      rcu: Remove CONFIG_PREEMPT_RCU · 6b3ef48a
      Paul E. McKenney authored
      
      
      Now that CONFIG_TREE_PREEMPT_RCU is in place, there is no
      further need for CONFIG_PREEMPT_RCU.  Remove it, along with
      whatever subtle bugs it may (or may not) contain.
      
      Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: laijs@cn.fujitsu.com
      Cc: dipankar@in.ibm.com
      Cc: akpm@linux-foundation.org
      Cc: mathieu.desnoyers@polymtl.ca
      Cc: josht@linux.vnet.ibm.com
      Cc: dvhltc@us.ibm.com
      Cc: niv@us.ibm.com
      Cc: peterz@infradead.org
      Cc: rostedt@goodmis.org
      LKML-Reference: <125097461396-git-send-email->
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      6b3ef48a
    • Paul E. McKenney's avatar
      rcu: Merge preemptable-RCU functionality into hierarchical RCU · f41d911f
      Paul E. McKenney authored
      
      
      Create a kernel/rcutree_plugin.h file that contains definitions
      for preemptable RCU (or, under the #else branch of the #ifdef,
      empty definitions for the classic non-preemptable semantics).
      These definitions fit into plugins defined in kernel/rcutree.c
      for this purpose.
      
      This variant of preemptable RCU uses a new algorithm whose
      read-side expense is roughly that of classic hierarchical RCU
      under CONFIG_PREEMPT. This new algorithm's update-side expense
      is similar to that of classic hierarchical RCU, and, in absence
      of read-side preemption or blocking, is exactly that of classic
      hierarchical RCU.  Perhaps more important, this new algorithm
      has a much simpler implementation, saving well over 1,000 lines
      of code compared to mainline's implementation of preemptable
      RCU, which will hopefully be retired in favor of this new
      algorithm.
      
      The simplifications are obtained by maintaining per-task
      nesting state for running tasks, and using a simple
      lock-protected algorithm to handle accounting when tasks block
      within RCU read-side critical sections, making use of lessons
      learned while creating numerous user-level RCU implementations
      over the past 18 months.
      
      Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: laijs@cn.fujitsu.com
      Cc: dipankar@in.ibm.com
      Cc: akpm@linux-foundation.org
      Cc: mathieu.desnoyers@polymtl.ca
      Cc: josht@linux.vnet.ibm.com
      Cc: dvhltc@us.ibm.com
      Cc: niv@us.ibm.com
      Cc: peterz@infradead.org
      Cc: rostedt@goodmis.org
      LKML-Reference: <12509746134003-git-send-email->
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f41d911f
  5. Aug 21, 2009
    • Linus Torvalds's avatar
      Make bitmask 'and' operators return a result code · f4b0373b
      Linus Torvalds authored
      
      
      When 'and'ing two bitmasks (where 'andnot' is a variation on it), some
      cases want to know whether the result is the empty set or not.  In
      particular, the TLB IPI sending code wants to do cpumask operations and
      determine if there are any CPU's left in the final set.
      
      So this just makes the bitmask (and cpumask) functions return a boolean
      for whether the result has any bits set.
      
      Cc: stable@kernel.org (2.6.30, needed by TLB shootdown fix)
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f4b0373b
    • Casey Dahlin's avatar
      lib/swiotlb.c: Fix strange panic message selection logic when swiotlb fills up · c7084b35
      Casey Dahlin authored
      
      
      swiotlb_full() in lib/swiotlb.c throws one of two panic messages
      based on whether the direction of transfer is from the device
      or to the device. The logic around this is somewhat weird in
      the case of bidirectional transfers. It appears to want to
      throw both in succession, but since its a panic only the first
      makes it.
      
      This patch adds a third, separate error for DMA_BIDIRECTIONAL
      to make things a bit clearer.
      
      Signed-off-by: default avatarCasey Dahlin <cdahlin@redhat.com>
      Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: Becky Bruce <beckyb@kernel.crashing.org>
      [ further fixed the error message ]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      LKML-Reference: <200908202327.n7KNRuqK001504@imap1.linux-foundation.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      c7084b35
    • Kyle McMartin's avatar
      dma-debug: Fix check_unmap null pointer dereference · ec9c96ef
      Kyle McMartin authored
      
      
      While it's debatable whether or not a NULL device argument to
      the DMA API functions is valid... since it certainly isn't
      valid on devices with an IOMMU... dma-debug really shouldn't be
      dereferencing null pointers either.
      
      Guard against that in err_printk and the driver_filter
      functions. A Fedora rawhide user was seeing this in one of the
      dvb drivers resulting in an oops on boot.
      
      [ A patch has been sent for testing to the driver, but I feel
        the dma debugging support should be fixed as well. (There's
        still a pile of legacy garbage in the kernel passing null
        pointers to dma_{alloc,free}_*. :( ]
      
      Signed-off-by: default avatarKyle McMartin <kyle@redhat.com>
      Cc: mchehab@infradead.org
      Cc: Joerg Roedel <joerg.roedel@amd.com>
      LKML-Reference: <20090820011708.GP25206@bombadil.infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      ec9c96ef
  6. Aug 07, 2009
  7. Aug 04, 2009
  8. Jul 31, 2009
  9. Jul 30, 2009
    • Dave Hansen's avatar
      lib: flexible array implementation · 534acc05
      Dave Hansen authored
      Once a structure goes over PAGE_SIZE*2, we see occasional allocation
      failures.  Some people have chosen to switch over to things like vmalloc()
      that will let them keep array-like access to such a large structures.
      But, vmalloc() has plenty of downsides.
      
      Here's an alternative.  I think it's what Andrew was suggesting here:
      
      	http://lkml.org/lkml/2009/7/2/518
      
      I call it a flexible array.  It does all of its work in PAGE_SIZE bits, so
      never does an order>0 allocation.  The base level has
      PAGE_SIZE-2*sizeof(int) bytes of storage for pointers to the second level.
       So, with a 32-bit arch, you get about 4MB (4183112 bytes) of total
      storage when the objects pack nicely into a page.  It is half that on
      64-bit because the pointers are twice the size.  There's a table detailing
      this in the code.
      
      There are kerneldocs for the functions, but here's an
      overview:
      
      flex_array_alloc() - dynamically allocate a base structure
      flex_array_free() - free the array and all of the
      		    second-level pages
      flex_array_free_parts() - free the second-level pages, but
      			  not the base (for static bases)
      flex_array_put() - copy into the array at the given index
      flex_array_get() - copy out of the array at the given index
      flex_array_prealloc() - preallocate the second-level pages
      			between the given indexes to
      			guarantee no allocs will occur at
      			put() time.
      
      We could also potentially just pass the "element_size" into each of the
      API functions instead of storing it internally.  That would get us one
      more base pointer on 32-bit.
      
      I've been testing this by running it in userspace.  The header and patch
      that I've been using are here, as well as the little script I'm using to
      generate the size table which goes in the kerneldocs.
      
      	http://sr71.net/~dave/linux/flexarray/
      
      
      
      [akpm@linux-foundation.org: coding-style fixes]
      Signed-off-by: default avatarDave Hansen <dave@linux.vnet.ibm.com>
      Reviewed-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      534acc05
    • Roland Dreier's avatar
      lib: export generic atomic64_t functions · 3fc7b4b2
      Roland Dreier authored
      
      
      The generic atomic64_t implementation in lib/ did not export the functions
      it defined, which means that modules that use atomic64_t would not link on
      platforms (such as 32-bit powerpc).  For example, trying to build a kernel
      with CONFIG_NET_RDS on such a platform would fail with:
      
          ERROR: "atomic64_read" [net/rds/rds.ko] undefined!
          ERROR: "atomic64_set" [net/rds/rds.ko] undefined!
      
      Fix this by exporting the atomic64_t functions to modules.  (I export the
      entire API even if it's not all currently used by in-tree modules to avoid
      having to continue fixing this in dribs and drabs)
      
      Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
      Acked-by: default avatarPaul Mackerras <paulus@samba.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3fc7b4b2
  10. Jul 28, 2009
  11. Jul 16, 2009
    • Oleg Nesterov's avatar
      kernel: is_current_single_threaded: don't use ->mmap_sem · 967cc537
      Oleg Nesterov authored
      
      
      is_current_single_threaded() can safely miss a freshly forked CLONE_VM
      task, but in this case it must not miss its parent. That is why we take
      mm->mmap_sem for writing to make sure a thread/task with the same ->mm
      can't pass exit_mm() and disappear.
      
      However we can avoid ->mmap_sem and rely on rcu/barriers:
      
      	- if we do not see the exiting parent on thread/process list
      	  we see the result of list_del_rcu(), in this case we must
      	  also see the result of list_add_rcu() which does wmb().
      
      	- if we do see the parent but its ->mm == NULL, we need rmb()
      	  to make sure we can't miss the child.
      
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Acked-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      967cc537
    • Oleg Nesterov's avatar
      kernel: rename is_single_threaded(task) to current_is_single_threaded(void) · 5bb459bb
      Oleg Nesterov authored
      
      
      - is_single_threaded(task) is not safe unless task == current,
        we can't use task->signal or task->mm.
      
      - it doesn't make sense unless task == current, the task can
        fork right after the check.
      
      Rename it to current_is_single_threaded() and kill the argument.
      
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Acked-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      5bb459bb
    • Oleg Nesterov's avatar
      kernel: fix is_single_threaded · d2e3ee9b
      Oleg Nesterov authored
      
      
      - Fix the comment, is_single_threaded(p) actually means that nobody shares
        ->mm with p.
      
        I think this helper should be renamed, and it should not have arguments.
        With or without this patch it must not be used unless p == current,
        otherwise we can't safely use p->signal or p->mm.
      
      - "if (atomic_read(&p->signal->count) != 1)" is not right when we have a
        zombie group leader, use signal->live instead.
      
      - Add PF_KTHREAD check to skip kernel threads which may borrow p->mm,
        otherwise we can return the wrong "false".
      
      - Use for_each_process() instead of do_each_thread(), all threads must use
        the same ->mm.
      
      - Use down_write(mm->mmap_sem) + rcu_read_lock() instead of tasklist_lock
        to iterate over the process list. If there is another CLONE_VM process
        it can't pass exit_mm() which takes the same mm->mmap_sem. We can miss
        a freshly forked CLONE_VM task, but this doesn't matter because we must
        see its parent and return false.
      
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: James Morris <jmorris@namei.org>
      Cc: Roland McGrath <roland@redhat.com>
      Cc: Stephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      d2e3ee9b
  12. Jul 10, 2009
    • Ingo Molnar's avatar
      dma-debug: Fix the overlap() function to be correct and readable · f39d1b97
      Ingo Molnar authored
      
      
      Linus noticed how unclean and buggy the overlap() function is:
      
       - It uses convoluted (and bug-causing) positive checks for
         range overlap - instead of using a more natural negative
         check.
      
       - Even the positive checks are buggy: a positive intersection
         check has four natural cases while we checked only for three,
         missing the (addr < start && addr2 == end) case for example.
      
       - The variables are mis-named, making it non-obvious how the
         check was done.
      
       - It needlessly uses u64 instead of unsigned long. Since these
         are kernel memory pointers and we explicitly exclude highmem
         ranges anyway we cannot ever overflow 32 bits, even if we
         could. (and on 64-bit it doesnt matter anyway)
      
      All in one, this function needs a total revamp. I used Linus's
      suggestions minus the paranoid checks (we cannot overflow really
      because if we get totally bad DMA ranges passed far more things
      break in the systems than just DMA debugging). I also fixed a
      few other small details i noticed.
      
      Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Joerg Roedel <joerg.roedel@amd.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f39d1b97
  13. Jun 25, 2009
  14. Jun 23, 2009
  15. Jun 21, 2009
  16. Jun 19, 2009
    • Arnd Bergmann's avatar
      lib/checksum.c: fix endianess bug · 32a9ff9c
      Arnd Bergmann authored
      
      
      The new generic checksum code has a small dependency on endianess and
      worked only on big-endian systems. I could not find a nice efficient
      way to express this, so I added an #ifdef. Using
      'result += le16_to_cpu(*buff);' would have worked as well, but
      would be slightly less efficient on big-endian systems and IMHO
      would not be clearer.
      
      Also fix a bug that prevents this from working on 64-bit machines.
      If you have a 64-bit CPU and want to use the generic checksum
      code, you should probably do some more optimizations anyway, but
      at least the code should not break.
      
      Reported-by: default avatarMike Frysinger <vapier@gentoo.org>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      32a9ff9c
  17. Jun 18, 2009
    • Florian Fainelli's avatar
      lib: add lib/gcd.c · d2829224
      Florian Fainelli authored
      
      
      This patch adds lib/gcd.c which contains a greatest common divider
      implementation taken from sound/core/pcm_timer.c
      
      Several usages of this new library function will be sent to subsystem
      maintainers.
      
      [akpm@linux-foundation.org: use swap() (pointed out by Joe)]
      [akpm@linux-foundation.org: just add gcd.o to obj-y, remove Kconfig changes]
      Signed-off-by: default avatarFlorian Fainelli <florian@openwrt.org>
      Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Simon Horman <horms@verge.net.au>
      Cc: Julius Volz <juliusv@google.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Patrick McHardy <kaber@trash.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d2829224
  18. Jun 17, 2009
Loading