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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 22 Sep 2021 17:49:55 +0100
From:   James Clark <james.clark@....com>
To:     Leo Yan <leo.yan@...aro.org>
Cc:     acme@...nel.org, leo.yan@...aro.com,
        linux-perf-users@...r.kernel.org,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] perf tests: Improve temp file cleanup in
 test_arm_coresight.sh



On 22/09/2021 15:08, Leo Yan wrote:
> Hi James,
> 
> On Wed, Sep 22, 2021 at 02:40:54PM +0100, James Clark wrote:
> 
> [...]
> 
>>>>  cleanup_files()
>>>>  {
>>>>  	rm -f ${perfdata}
>>>>  	rm -f ${file}
>>>> +	rm -f "${perfdata}.old"
>>>> +	trap - exit term int
>>>> +	kill -2 $$
>>>
>>> Here it always sends signal SIGINT to current PID with $$, another
>>> choice is to send signal based on the incoming signal type, like below:
>>>
>>>   [[ "$1" = "int" ]] || kill -SIGINT $$
>>>   [[ "$1" = "term" ]] || kill -SIGTERM $$
>>
>> Yes I thought that this might be an issue, but I tested it in a few different
>> scenarios. Especially when running it under the normal ./perf test command and
>> it didn't seem to cause an issue whether it passed or failed. So I'm not sure
>> if it's worth changing or not. Maybe it is in case it gets copy pasted into
>> another shell test?
> 
> I think it's not very necessary to send signal again with command
> "kill -2 $$" at here.
> 
> "kill -2 $$" sends the signal to the shell process itself rather than
> propagating signal to its parent process.  And the up level's script
> should can detect an error with the returned exit code.
> 
> So below change should be sufficient?
> 
> cleanup_files()
> {
> 	rm -f ${perfdata}
> 	rm -f ${file}
> +       rm -f "${perfdata}.old"
> +       exit $glb_err
> }
> 
> Sorry if I miss anything at here and cause noise.

The problem with not re-sending the sigint is that if you want to run the
script in a bash while loop like:

  while ! tests/shell/test_arm_coresight.sh; do echo loop; done

Then it's impossible to exit with Ctrl-C and delete the temp files at the
same time. It exits if we don't trap sigint like it is at the moment, but
then it leaves the temporary files. This change is so we can have both
behaviours of Ctrl-C in a loop and keep the cleanup working.


> 
> Thanks,
> Leo
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ