lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Sun, 22 Mar 2009 08:34:49 +0300
From:	Peter Lojkin <ia6432@...ox.ru>
To:	linux-kernel@...r.kernel.org
Subject: Re: [Bug #12911] Limiting cpu time doesn't work

Hello,

additional info on subject.
problem first apeared in 2.6.27-git9 and RLIMIT_CPU actually works on process that sets limit but not on its children. examples:

test1.c
#include <sys/time.h>
#include <sys/resource.h>

int main() {
  struct rlimit a;
  a.rlim_cur=3;
  a.rlim_max=5;
  setrlimit(RLIMIT_CPU, &a);
  while(1);
  return 0;
}

test1 dies with "CPU time limit exceeded" after 3sec as expected, but

test2.c
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>

int main() {
  struct rlimit a;
  int status;

  a.rlim_cur=3;
  a.rlim_max=5;
  setrlimit(RLIMIT_CPU, &a);
  if (0==fork())
    while(1);
  else
    wait(&status);
  return 0;
}

test2 not get killed. checking limits on child process show that limits set correctly.

two equivalent examples for shell:
sh -c "ulimit -t 3; while true; do true; done"
sh -c "ulimit -t 3; sh -c 'while true; do true; done'"

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ