1. 23 Sep, 2007 2 commits
    • Tom Alsberg's avatar
      CPU time limit patch / setrlimit(RLIMIT_CPU, 0) cheat fix · 652a44b1
      Tom Alsberg authored
      CPU time limit patch / setrlimit(RLIMIT_CPU, 0) cheat fix
      
      As discovered here today, the change in Kernel 2.6.17 intended to inhibit
      users from setting RLIMIT_CPU to 0 (as that is equivalent to unlimited) by
      "cheating" and setting it to 1 in such a case, does not make a difference,
      as the check is done in the wrong place (too late), and only applies to the
      profiling code.
      
      On all systems I checked running kernels above 2.6.17, no matter what the
      hard and soft CPU time limits were before, a user could escape them by
      issuing in the shell (sh/bash/zsh) "ulimit -t 0", and then the user's
      process was not ever killed.
      
      Attached is a trivial patch to fix that.  Simply moving the check to a
      slightly earlier location (specifically, before the line that actually
      assigns the limit - *old_rlim = new_rlim), does the trick.
      
      Do note that at least the zsh (but not ash, dash, or bash) shell has the
      problem of "caching" the limits set by the ulimit command, so when running
      zsh the fix will not immediately be evident - after entering "ulimit -t 0",
      "ulimit -a" will show "-t: cpu time (seconds) 0", even though the actual
      limit as returned by getrlimit(...) will be 1.  It can be verified by
      opening a subshell (which will not have the values of the parent shell in
      cache) and checking in it, or just by running a CPU intensive command like
      "echo '65536^1048576' | bc" and verifying that it dumps core after one
      second.
      
      Regardless of whether that is a misfeature in the shell, perhaps it would
      be better to return -EINVAL from setrlimit in such a case instead of
      cheating and setting to 1, as that does not really reflect the actual state
      of the process anymore.  I do not however know what the ground for that
      decision was in the original 2.6.17 change, and whether there would be any
      "backward" compatibility issues, so I preferred not to touch that right
      now.
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      652a44b1
    • Andi Kleen's avatar
      [PATCH] x86_64: Zero extend all registers after ptrace in 32bit entry path. · 0d4a3931
      Andi Kleen authored
      Strictly it's only needed for eax.
      
      It actually does a little more than strictly needed -- the other registers
      are already zero extended.
      
      Also remove the now unnecessary and non functional compat task check
      in ptrace.
      
      This is CVE-2007-4573
      
      Found by Wojciech Purczynski
      Signed-off-by: default avatarAndi Kleen <ak@suse.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
      0d4a3931
  2. 08 Sep, 2007 2 commits
  3. 28 Aug, 2007 4 commits
  4. 25 Aug, 2007 32 commits