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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 7 May 2014 19:19:14 +0200
From:	Stephane Eranian <eranian@...gle.com>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	Namhyung Kim <namhyung@...nel.org>, Jiri Olsa <jolsa@...hat.com>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Ingo Molnar <mingo@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Namhyung Kim <namhyung.kim@....com>
Subject: Re: [PATCH v3 2/3] perf record: Propagate exit status of a command
 line workload

On Wed, May 7, 2014 at 5:04 PM, Peter Zijlstra <peterz@...radead.org> wrote:
> On Wed, Apr 30, 2014 at 09:24:08AM +0900, Namhyung Kim wrote:
>> Hi Jiri and Peter,
>>
>> On Tue, 29 Apr 2014 13:37:47 +0200, Jiri Olsa wrote:
>> > On Tue, Apr 29, 2014 at 01:19:39PM +0200, Peter Zijlstra wrote:
>> >> On Tue, Apr 29, 2014 at 12:56:54PM +0200, Jiri Olsa wrote:
>> >> >
>> >> >   perf_counter tools: Propagate signals properly
>> >> >   commit f7b7c26e01e51fe46097e11f179dc71ce7950084
>> >> >   Author: Peter Zijlstra <a.p.zijlstra@...llo.nl>
>> >> >   Date:   Wed Jun 10 15:55:59 2009 +0200
>> >> >
>> >> > but I dont think we need to do that
>> >>
>> >> But but but, then you're re-introducing that fail again? That no good.
>>
>> FYI, it's already gone with 804f7ac78803 ("perf record: handle death by
>> SIGTERM").
>>
>> >
>> > well, I was trying the testcase you mentioned in the changelog
>> > and it seemed to work for me.. ;-) I guess I was lucky to hit
>> > the bash time window..
>> >
>> >   while :; do perf stat ./foo ; done
>> >
>> > so how does this work? bash will kill the loop if perf's wait
>> > status is WIFSIGNALED?
>>
>> I'm not sure but isn't it *bash* to catch signal and terminate the
>> loop?  It seems the wait status of child has no business with the loop
>> termination.  Am I missing something?
>>
>>   $ cat suicide.c
>>   #include <signal.h>
>>
>>   int main(void)
>>   {
>>     raise(SIGTERM);
>>     return 0;
>>   }
>>
>
> SIGTERM isn't the problem. SIGINT is. Typically when you run:
>
> while :; do perf stat ./foo ; done
>
> Its foo that is running, so when you press ^C, you'll SIGINT foo. foo
> will then exit, perf stat will notice the exit, exit itself and because
> the loop doesn't look at the return value of perf stat, simply
> continues.
>
> What I want, and fixed back then, is that if you press ^C foo
> terminates, perf stat/record/etc. will finish, but then terminate with
> the same signal. In that case bash finally sees the SIGINT and will in
> fact terminate the loop.
>
> try:
>
> $ while :; do ./foo /bin/sleep 5 ; done
>
> and try and break out using ^C
>
What I usually do here is hit ^Z, then kill the job.
But I agree it would be nicer to handle this case automatically.

> ---
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> #include <signal.h>
> #include <sys/types.h>
> #include <sys/wait.h>
>
> int main(int argc, char *argv[], char *envp[])
> {
>         pid_t pid = fork();
>         if (!pid) /* child */ {
>                 execve(argv[1], argv+1, envp);
>                 perror("execve");
>                 return;
>         }
>
>         signal(SIGINT, SIG_IGN);
>         waitpid(pid, NULL, 0);
>         return 0;
> }
--
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