1. 08 5月, 2007 1 次提交
  2. 13 2月, 2007 2 次提交
  3. 12 2月, 2007 1 次提交
  4. 24 1月, 2007 1 次提交
    • I
      [PATCH] notifiers: fix blocking_notifier_call_chain() scalability · 1b5180b6
      Ingo Molnar 提交于
      while lock-profiling the -rt kernel i noticed weird contention during
      mmap-intense workloads, and the tracer showed the following gem, in one
      of our MM hotpaths:
      
       threaded-2771  1....   65us : sys_munmap (sysenter_do_call)
       threaded-2771  1....   66us : profile_munmap (sys_munmap)
       threaded-2771  1....   66us : blocking_notifier_call_chain (profile_munmap)
       threaded-2771  1....   66us : rt_down_read (blocking_notifier_call_chain)
      
      ouch! a global rw-semaphore taken in one of the most performance-
      sensitive codepaths of the kernel.  And i dont even have oprofile
      enabled! All distro kernels have CONFIG_PROFILING enabled, so this
      scalability problem affects the majority of Linux users.
      
      The fix is to enhance blocking_notifier_call_chain() to only take the
      lock if there appears to be work on the call-chain.
      
      With this patch applied i get nicely saturated system, and much higher
      munmap performance, on SMP systems.
      
      And as a bonus this also fixes a similar scalability bottleneck in the
      thread-exit codepath: profile_task_exit() ...
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Acked-by: NNick Piggin <nickpiggin@yahoo.com.au>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      1b5180b6
  5. 09 12月, 2006 3 次提交
    • O
      [PATCH] sys_setpgid: eliminate unnecessary do_each_task_pid(PIDTYPE_PGID) · f020bc46
      Oleg Nesterov 提交于
      All tasks in the process group have the same sid, we don't need to iterate
      them all to check that the caller of sys_setpgid() doesn't change its
      session.
      Signed-off-by: NOleg Nesterov <oleg@tv-sign.ru>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      f020bc46
    • C
      [PATCH] add process_session() helper routine · 937949d9
      Cedric Le Goater 提交于
      Replace occurences of task->signal->session by a new process_session() helper
      routine.
      
      It will be useful for pid namespaces to abstract the session pid number.
      Signed-off-by: NCedric Le Goater <clg@fr.ibm.com>
      Cc: Kirill Korotaev <dev@openvz.org>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Herbert Poetzl <herbert@13thfloor.at>
      Cc: Sukadev Bhattiprolu <sukadev@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      937949d9
    • P
      [PATCH] tty: ->signal->tty locking · 24ec839c
      Peter Zijlstra 提交于
      Fix the locking of signal->tty.
      
      Use ->sighand->siglock to protect ->signal->tty; this lock is already used
      by most other members of ->signal/->sighand.  And unless we are 'current'
      or the tasklist_lock is held we need ->siglock to access ->signal anyway.
      
      (NOTE: sys_unshare() is broken wrt ->sighand locking rules)
      
      Note that tty_mutex is held over tty destruction, so while holding
      tty_mutex any tty pointer remains valid.  Otherwise the lifetime of ttys
      are governed by their open file handles.  This leaves some holes for tty
      access from signal->tty (or any other non file related tty access).
      
      It solves the tty SLAB scribbles we were seeing.
      
      (NOTE: the change from group_send_sig_info to __group_send_sig_info needs to
             be examined by someone familiar with the security framework, I think
             it is safe given the SEND_SIG_PRIV from other __group_send_sig_info
             invocations)
      
      [schwidefsky@de.ibm.com: 3270 fix]
      [akpm@osdl.org: various post-viro fixes]
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Acked-by: NAlan Cox <alan@redhat.com>
      Cc: Oleg Nesterov <oleg@tv-sign.ru>
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Chris Wright <chrisw@sous-sol.org>
      Cc: Roland McGrath <roland@redhat.com>
      Cc: Stephen Smalley <sds@tycho.nsa.gov>
      Cc: James Morris <jmorris@namei.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Jan Kara <jack@ucw.cz>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      24ec839c
  6. 08 12月, 2006 1 次提交
  7. 22 11月, 2006 1 次提交
    • D
      WorkStruct: Pass the work_struct pointer instead of context data · 65f27f38
      David Howells 提交于
      Pass the work_struct pointer to the work function rather than context data.
      The work function can use container_of() to work out the data.
      
      For the cases where the container of the work_struct may go away the moment the
      pending bit is cleared, it is made possible to defer the release of the
      structure by deferring the clearing of the pending bit.
      
      To make this work, an extra flag is introduced into the management side of the
      work_struct.  This governs auto-release of the structure upon execution.
      
      Ordinarily, the work queue executor would release the work_struct for further
      scheduling or deallocation by clearing the pending bit prior to jumping to the
      work function.  This means that, unless the driver makes some guarantee itself
      that the work_struct won't go away, the work function may not access anything
      else in the work_struct or its container lest they be deallocated..  This is a
      problem if the auxiliary data is taken away (as done by the last patch).
      
      However, if the pending bit is *not* cleared before jumping to the work
      function, then the work function *may* access the work_struct and its container
      with no problems.  But then the work function must itself release the
      work_struct by calling work_release().
      
      In most cases, automatic release is fine, so this is the default.  Special
      initiators exist for the non-auto-release case (ending in _NAR).
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      65f27f38
  8. 04 10月, 2006 2 次提交
    • A
      [PATCH] SRCU: report out-of-memory errors · e6a92013
      Alan Stern 提交于
      Currently the init_srcu_struct() routine has no way to report out-of-memory
      errors.  This patch (as761) makes it return -ENOMEM when the per-cpu data
      allocation fails.
      
      The patch also makes srcu_init_notifier_head() report a BUG if a notifier
      head can't be initialized.  Perhaps it should return -ENOMEM instead, but
      in the most likely cases where this might occur I don't think any recovery
      is possible.  Notifier chains generally are not created dynamically.
      
      [akpm@osdl.org: avoid statement-with-side-effect in macro]
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NPaul E. McKenney <paulmck@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      e6a92013
    • A
      [PATCH] Add SRCU-based notifier chains · eabc0694
      Alan Stern 提交于
      This patch (as751) adds a new type of notifier chain, based on the SRCU
      (Sleepable Read-Copy Update) primitives recently added to the kernel.  An
      SRCU notifier chain is much like a blocking notifier chain, in that it must
      be called in process context and its callout routines are allowed to sleep.
       The difference is that the chain's links are protected by the SRCU
      mechanism rather than by an rw-semaphore, so calling the chain has
      extremely low overhead: no memory barriers and no cache-line bouncing.  On
      the other hand, unregistering from the chain is expensive and the chain
      head requires special runtime initialization (plus cleanup if it is to be
      deallocated).
      
      SRCU notifiers are appropriate for notifiers that will be called very
      frequently and for which unregistration occurs very seldom.  The proposed
      "task notifier" scheme qualifies, as may some of the network notifiers.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NPaul E. McKenney <paulmck@us.ibm.com>
      Acked-by: NChandra Seetharaman <sekharan@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      eabc0694
  9. 02 10月, 2006 3 次提交
  10. 01 10月, 2006 1 次提交
  11. 30 9月, 2006 2 次提交
  12. 26 9月, 2006 1 次提交
    • A
      [PATCH] x86: Add portable getcpu call · 3cfc348b
      Andi Kleen 提交于
      For NUMA optimization and some other algorithms it is useful to have a fast
      to get the current CPU and node numbers in user space.
      
      x86-64 added a fast way to do this in a vsyscall. This adds a generic
      syscall for other architectures to make it a generic portable facility.
      
      I expect some of them will also implement it as a faster vsyscall.
      
      The cache is an optimization for the x86-64 vsyscall optimization. Since
      what the syscall returns is an approximation anyways and user space
      often wants very fast results it can be cached for some time.  The norma
      methods to get this information in user space are relatively slow
      
      The vsyscall is in a better position to manage the cache because it has direct
      access to a fast time stamp (jiffies). For the generic syscall optimization
      it doesn't help much, but enforce a valid argument to keep programs
      portable
      
      I only added an i386 syscall entry for now. Other architectures can follow
      as needed.
      
      AK: Also added some cleanups from Andrew Morton
      Signed-off-by: NAndi Kleen <ak@suse.de>
      3cfc348b
  13. 13 7月, 2006 1 次提交
    • M
      [PATCH] Fix prctl privilege escalation and suid_dumpable (CVE-2006-2451) · abf75a50
      Marcel Holtmann 提交于
      Based on a patch from Ernie Petrides
      
      During security research, Red Hat discovered a behavioral flaw in core
      dump handling. A local user could create a program that would cause a
      core file to be dumped into a directory they would not normally have
      permissions to write to. This could lead to a denial of service (disk
      consumption), or allow the local user to gain root privileges.
      
      The prctl() system call should never allow to set "dumpable" to the
      value 2. Especially not for non-privileged users.
      
      This can be split into three cases:
      
        1) running as root -- then core dumps will already be done as root,
           and so prctl(PR_SET_DUMPABLE, 2) is not useful
      
        2) running as non-root w/setuid-to-root -- this is the debatable case
      
        3) running as non-root w/setuid-to-non-root -- then you definitely
           do NOT want "dumpable" to get set to 2 because you have the
           privilege escalation vulnerability
      
      With case #2, the only potential usefulness is for a program that has
      designed to run with higher privilege (than the user invoking it) that
      wants to be able to create root-owned root-validated core dumps. This
      might be useful as a debugging aid, but would only be safe if the program
      had done a chdir() to a safe directory.
      
      There is no benefit to a production setuid-to-root utility, because it
      shouldn't be dumping core in the first place. If this is true, then the
      same debugging aid could also be accomplished with the "suid_dumpable"
      sysctl.
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      abf75a50
  14. 01 7月, 2006 1 次提交
  15. 26 6月, 2006 2 次提交
  16. 23 6月, 2006 2 次提交
  17. 09 6月, 2006 1 次提交
    • A
      [PATCH] Add a prctl to change the endianness of a process. · 651d765d
      Anton Blanchard 提交于
      This new prctl is intended for changing the execution mode of the
      processor, on processors that support both a little-endian mode and a
      big-endian mode.  It is intended for use by programs such as
      instruction set emulators (for example an x86 emulator on PowerPC),
      which may find it convenient to use the processor in an alternate
      endianness mode when executing translated instructions.
      
      Note that this does not imply the existence of a fully-fledged ABI for
      both endiannesses, or of compatibility code for converting system
      calls done in the non-native endianness mode.  The program is expected
      to arrange for all of its system call arguments to be presented in the
      native endianness.
      
      Switching between big and little-endian mode will require some care in
      constructing the instruction sequence for the switch.  Generally the
      instructions up to the instruction that invokes the prctl system call
      will have to be in the old endianness, and subsequent instructions
      will have to be in the new endianness.
      Signed-off-by: NAnton Blanchard <anton@samba.org>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      651d765d
  18. 01 4月, 2006 1 次提交
    • E
      [PATCH] Make setsid() more robust · 390e2ff0
      Eric W. Biederman 提交于
      The core problem: setsid fails if it is called by init.  The effect in 2.6.16
      and the earlier kernels that have this problem is that if you do a "ps -j 1 or
      ps -ej 1" you will see that init and several of it's children have process
      group and session == 0.  Instead of process group == session == 1.  Despite
      init calling setsid.
      
      The reason it fails is that daemonize calls set_special_pids(1,1) on kernel
      threads that are launched before /sbin/init is called.
      
      The only remaining effect in that current->signal->leader == 0 for init
      instead of 1.  And the setsid call fails.  No one has noticed because
      /sbin/init does not check the return value of setsid.
      
      In 2.4 where we don't have the pidhash table, and daemonize doesn't exist
      setsid actually works for init.
      
      I care a lot about pid == 1 not being a special case that we leave broken,
      because of the container/jail work that I am doing.
      
      - Carefully allow init (pid == 1) to call setsid despite the kernel using
        its session.
      
      - Use find_task_by_pid instead of find_pid because find_pid taking a
        pidtype is going away.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      390e2ff0
  19. 29 3月, 2006 2 次提交
  20. 28 3月, 2006 1 次提交
    • A
      [PATCH] Notifier chain update: API changes · e041c683
      Alan Stern 提交于
      The kernel's implementation of notifier chains is unsafe.  There is no
      protection against entries being added to or removed from a chain while the
      chain is in use.  The issues were discussed in this thread:
      
          http://marc.theaimsgroup.com/?l=linux-kernel&m=113018709002036&w=2
      
      We noticed that notifier chains in the kernel fall into two basic usage
      classes:
      
      	"Blocking" chains are always called from a process context
      	and the callout routines are allowed to sleep;
      
      	"Atomic" chains can be called from an atomic context and
      	the callout routines are not allowed to sleep.
      
      We decided to codify this distinction and make it part of the API.  Therefore
      this set of patches introduces three new, parallel APIs: one for blocking
      notifiers, one for atomic notifiers, and one for "raw" notifiers (which is
      really just the old API under a new name).  New kinds of data structures are
      used for the heads of the chains, and new routines are defined for
      registration, unregistration, and calling a chain.  The three APIs are
      explained in include/linux/notifier.h and their implementation is in
      kernel/sys.c.
      
      With atomic and blocking chains, the implementation guarantees that the chain
      links will not be corrupted and that chain callers will not get messed up by
      entries being added or removed.  For raw chains the implementation provides no
      guarantees at all; users of this API must provide their own protections.  (The
      idea was that situations may come up where the assumptions of the atomic and
      blocking APIs are not appropriate, so it should be possible for users to
      handle these things in their own way.)
      
      There are some limitations, which should not be too hard to live with.  For
      atomic/blocking chains, registration and unregistration must always be done in
      a process context since the chain is protected by a mutex/rwsem.  Also, a
      callout routine for a non-raw chain must not try to register or unregister
      entries on its own chain.  (This did happen in a couple of places and the code
      had to be changed to avoid it.)
      
      Since atomic chains may be called from within an NMI handler, they cannot use
      spinlocks for synchronization.  Instead we use RCU.  The overhead falls almost
      entirely in the unregister routine, which is okay since unregistration is much
      less frequent that calling a chain.
      
      Here is the list of chains that we adjusted and their classifications.  None
      of them use the raw API, so for the moment it is only a placeholder.
      
        ATOMIC CHAINS
        -------------
      arch/i386/kernel/traps.c:		i386die_chain
      arch/ia64/kernel/traps.c:		ia64die_chain
      arch/powerpc/kernel/traps.c:		powerpc_die_chain
      arch/sparc64/kernel/traps.c:		sparc64die_chain
      arch/x86_64/kernel/traps.c:		die_chain
      drivers/char/ipmi/ipmi_si_intf.c:	xaction_notifier_list
      kernel/panic.c:				panic_notifier_list
      kernel/profile.c:			task_free_notifier
      net/bluetooth/hci_core.c:		hci_notifier
      net/ipv4/netfilter/ip_conntrack_core.c:	ip_conntrack_chain
      net/ipv4/netfilter/ip_conntrack_core.c:	ip_conntrack_expect_chain
      net/ipv6/addrconf.c:			inet6addr_chain
      net/netfilter/nf_conntrack_core.c:	nf_conntrack_chain
      net/netfilter/nf_conntrack_core.c:	nf_conntrack_expect_chain
      net/netlink/af_netlink.c:		netlink_chain
      
        BLOCKING CHAINS
        ---------------
      arch/powerpc/platforms/pseries/reconfig.c:	pSeries_reconfig_chain
      arch/s390/kernel/process.c:		idle_chain
      arch/x86_64/kernel/process.c		idle_notifier
      drivers/base/memory.c:			memory_chain
      drivers/cpufreq/cpufreq.c		cpufreq_policy_notifier_list
      drivers/cpufreq/cpufreq.c		cpufreq_transition_notifier_list
      drivers/macintosh/adb.c:		adb_client_list
      drivers/macintosh/via-pmu.c		sleep_notifier_list
      drivers/macintosh/via-pmu68k.c		sleep_notifier_list
      drivers/macintosh/windfarm_core.c	wf_client_list
      drivers/usb/core/notify.c		usb_notifier_list
      drivers/video/fbmem.c			fb_notifier_list
      kernel/cpu.c				cpu_chain
      kernel/module.c				module_notify_list
      kernel/profile.c			munmap_notifier
      kernel/profile.c			task_exit_notifier
      kernel/sys.c				reboot_notifier_list
      net/core/dev.c				netdev_chain
      net/decnet/dn_dev.c:			dnaddr_chain
      net/ipv4/devinet.c:			inetaddr_chain
      
      It's possible that some of these classifications are wrong.  If they are,
      please let us know or submit a patch to fix them.  Note that any chain that
      gets called very frequently should be atomic, because the rwsem read-locking
      used for blocking chains is very likely to incur cache misses on SMP systems.
      (However, if the chain's callout routines may sleep then the chain cannot be
      atomic.)
      
      The patch set was written by Alan Stern and Chandra Seetharaman, incorporating
      material written by Keith Owens and suggestions from Paul McKenney and Andrew
      Morton.
      
      [jes@sgi.com: restructure the notifier chain initialization macros]
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NChandra Seetharaman <sekharan@us.ibm.com>
      Signed-off-by: NJes Sorensen <jes@sgi.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      e041c683
  21. 26 3月, 2006 3 次提交
  22. 24 3月, 2006 3 次提交
    • A
      [PATCH] RLIMIT_CPU: document wrong return value · d3561f78
      Andrew Morton 提交于
      Document the fact that setrlimit(RLIMIT_CPU) doesn't return error codes when
      it should.  I don't think we can fix this without a 2.7.x..
      
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Ulrich Weigand <uweigand@de.ibm.com>
      Cc: Cliff Wickman <cpw@sgi.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      d3561f78
    • A
      [PATCH] RLIMIT_CPU: fix handling of a zero limit · e0661111
      Andrew Morton 提交于
      At present the kernel doesn't honour an attempt to set RLIMIT_CPU to zero
      seconds.  But the spec says it should, and that's what 2.4.x does.
      
      Fixing this for real would involve some complexity (such as adding a new
      it-has-been-set flag to the task_struct, and testing that everwhere, instead
      of overloading the value of it_prof_expires).
      
      Given that a 2.4 kernel won't actually send the signal until one second has
      expired anyway, let's just handle this case by treating the caller's
      zero-seconds as one second.
      
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Ulrich Weigand <uweigand@de.ibm.com>
      Cc: Cliff Wickman <cpw@sgi.com>
      Acked-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      e0661111
    • A
      [PATCH] sys_setrlimit() cleanup · ec9e16ba
      Andrew Morton 提交于
      - Whitespace cleanups
      
      - Make that expression comprehensible.
      
      There's a potential logic change here: we do the "is it_prof_expires equal to
      zero" test after converting it to seconds, rather than doing the comparison
      between raw cputime_t's.
      
      But given that it's in units of seconds anyway, that shouldn't change
      anything.
      
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Ulrich Weigand <uweigand@de.ibm.com>
      Cc: Cliff Wickman <cpw@sgi.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      ec9e16ba
  23. 23 3月, 2006 2 次提交
  24. 08 2月, 2006 1 次提交
  25. 12 1月, 2006 1 次提交