1. 23 6月, 2006 2 次提交
  2. 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
  3. 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
  4. 29 3月, 2006 2 次提交
  5. 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
  6. 26 3月, 2006 3 次提交
  7. 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
  8. 23 3月, 2006 2 次提交
  9. 08 2月, 2006 1 次提交
  10. 12 1月, 2006 2 次提交
  11. 09 1月, 2006 5 次提交
    • O
      [PATCH] simplify k_getrusage() · 0f59cc4a
      Oleg Nesterov 提交于
      Factor out common code for different RUSAGE_xxx cases.
      
      Don't take ->sighand->siglock in RUSAGE_SELF case, suggested by Ravikiran G
      Thirumalai <kiran@scalex86.org>.
      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>
      0f59cc4a
    • O
      [PATCH] setpgid: should not accept ptraced childs · f7dd795e
      Oleg Nesterov 提交于
      sys_setpgid() allows to change ->pgrp of ptraced childs.
      
      'man setpgid' does not tell anything about that, so I consider
      this behaviour is a bug.
      Signed-off-by: NOleg Nesterov <oleg@tv-sign.ru>
      Cc: Oren Laadan <orenl@cs.columbia.edu>
      Cc: Roland McGrath <roland@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      f7dd795e
    • O
      [PATCH] setpgid: should work for sub-threads · e19f247a
      Oren Laadan 提交于
      setsid() does not work unless the calling process is a
      thread_group_leader().
      
      'man setpgid' does not tell anything about that, so I consider this
      behaviour is a bug.
      Signed-off-by: NOren Laadan <orenl@cs.columbia.edu>
      Cc: Oleg Nesterov <oleg@tv-sign.ru>
      Cc: Roland McGrath <roland@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      e19f247a
    • O
      [PATCH] setpgid: should work for sub-threads · ee0acf90
      Oleg Nesterov 提交于
      setpgid(0, pgid) or setpgid(forked_child_pid, pgid) does not work unless
      the calling process is a thread_group_leader().
      
      'man setpgid' does not tell anything about that, so I consider this
      behaviour is a bug.
      Signed-off-by: NOleg Nesterov <oleg@tv-sign.ru>
      Cc: Oren Laadan <orenl@cs.columbia.edu>
      Cc: Roland McGrath <roland@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      ee0acf90
    • E
      [PATCH] Don't attempt to power off if power off is not implemented · 5e38291d
      Eric W. Biederman 提交于
      The problem.  It is expected that /sbin/halt -p works exactly like
      /sbin/halt, when the kernel does not implement power off functionality.
      
      The kernel can do a lot of work in the reboot notifiers and in
      device_shutdown before we even get to machine_power_off.  Some of that
      shutdown is not safe if you are leaving the power on, and it definitely
      gets in the way of using sysrq or pressing ctrl-alt-del.  Since the
      shutdown happens in generic code there is no way to fix this in
      architecture specific code :(
      
      Some machines are kernel oopsing today because of this.
      
      The simple solution is to turn LINUX_REBOOT_CMD_POWER_OFF into
      LINUX_REBOOT_CMD_HALT if power_off functionality is not implemented.
      
      This has the unfortunate side effect of disabling the power off
      functionality on architectures that leave pm_power_off to null and still
      implement something in machine_power_off.  And it will break the build on
      some architectures that don't have a pm_power_off variable at all.
      
      On both counts I say tough.
      
      For architectures like alpha that don't implement the pm_power_off variable
      pm_power_off is declared in linux/pm.h and it is a generic part of our
      power management code, and all architectures should implement it.
      
      For architectures like parisc that have a default power off method in
      machine_power_off if pm_power_off is not implemented or fails.  It is easy
      enough to set the pm_power_off variable.  And nothing bad happens there,
      the machines just stop powering off.
      
      The current semantics are impossible without a flag at the top level so we
      can avoid the problem code if a power off is not implemented.  pm_power_off
      is as good a flag as any with the bonus that it works without modification
      on at least x86, x86_64, powerpc, and ppc today.
      
      Andrew can you pick this up and put this in the mm tree.  Kernels that
      don't compile or don't power off seem saner than kernels that oops or
      panic.  Until we get the arch specific patches for the problem
      architectures this probably isn't smart to push into the stable kernel.
      Unfortunately I don't have the time at the moment to walk through every
      architecture and make them work.  And even if I did I couldn't test it :(
      
      From: Hirokazu Takata <takata@linux-m32r.org>
      
          Add pm_power_off() for build fix of arch/m32r/kernel/process.c.
      
      From: Miklos Szeredi <miklos@szeredi.hu>
      
          UML build fix
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NHayato Fujiwara <fujiwara@linux-m32r.org>
      Signed-off-by: NHirokazu Takata <takata@linux-m32r.org>
      Signed-off-by: NMiklos Szeredi <miklos@szeredi.hu>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      5e38291d
  12. 16 12月, 2005 1 次提交
  13. 13 12月, 2005 1 次提交
  14. 11 11月, 2005 1 次提交
  15. 07 11月, 2005 4 次提交
  16. 23 9月, 2005 1 次提交
  17. 18 9月, 2005 1 次提交
  18. 08 9月, 2005 1 次提交
    • J
      [PATCH] remove a redundant variable in sys_prctl() · 0730ded5
      Jesper Juhl 提交于
      The patch removes a redundant variable `sig' from sys_prctl().
      
      For some reason, when sys_prctl is called with option == PR_SET_PDEATHSIG
      then the value of arg2 is assigned to an int variable named sig.  Then sig
      is tested with valid_signal() and later used to set the value of
      current->pdeath_signal .
      
      There is no reason to use this intermediate variable since valid_signal()
      takes a unsigned long argument, so it can handle being passed arg2
      directly, and if the call to valid_signal is OK, then we know the value of
      arg2 is in the range zero to _NSIG and thus it'll easily fit in a plain int
      and thus there's no problem assigning it later to current->pdeath_signal
      (which is an int).
      
      The patch gets rid of the pointless variable `sig'.
      This reduces the size of kernel/sys.o in 2.6.13-rc6-mm1 by 32 bytes on my
      system.
      
      Patch has been compile tested, boot tested, and just to make damn sure I
      didn't break anything I wrote a quick test app that calls
      prctl(PR_SET_PDEATHSIG ...) with the entire range of values for a
      unsigned long, and it behaves as expected with and without the patch.
      Signed-off-by: NJesper Juhl <jesper.juhl@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      0730ded5
  19. 04 8月, 2005 1 次提交
    • B
      [PATCH] Remove suspend() calls from shutdown path · c36f19e0
      Benjamin Herrenschmidt 提交于
      This removes the calls to device_suspend() from the shutdown path that
      were added sometime during 2.6.13-rc*.  They aren't working properly on
      a number of configs (I got reports from both ppc powerbook users and x86
      users) causing the system to not shutdown anymore.
      
      I think it isn't the right approach at the moment anyway.  We have
      already a shutdown() callback for the drivers that actually care about
      shutdown and the suspend() code isn't yet in a good enough shape to be
      so much generalized.  Also, the semantics of suspend and shutdown are
      slightly different on a number of setups and the way this was patched in
      provides little way for drivers to cleanly differenciate.  It should
      have been at least a different message.
      
      For 2.6.13, I think we should revert to 2.6.12 behaviour and have a
      working suspend back.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      c36f19e0
  20. 30 7月, 2005 1 次提交
  21. 28 7月, 2005 1 次提交
  22. 27 7月, 2005 4 次提交