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]
Message-ID: <TYAPR01MB6330FFB9E5BA7CCDC652EE3F8B149@TYAPR01MB6330.jpnprd01.prod.outlook.com>
Date:   Thu, 1 Dec 2022 08:20:08 +0000
From:   "Shaopeng Tan (Fujitsu)" <tan.shaopeng@...itsu.com>
To:     'Reinette Chatre' <reinette.chatre@...el.com>,
        Fenghua Yu <fenghua.yu@...el.com>,
        Shuah Khan <shuah@...nel.org>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>,
        Shuah Khan <skhan@...uxfoundation.org>
Subject: RE: [PATCH v4 4/5] selftests/resctrl: Cleanup properly when an error
 occurs in CAT test

Hi Reinette,

> On 11/30/2022 12:32 AM, Shaopeng Tan (Fujitsu) wrote:
> 
> > Removing ctrl_handler() is only part of the fix in the next version(v5).
> > All fixes as follows.
> >
> > --- a/tools/testing/selftests/resctrl/cat_test.c
> > +++ b/tools/testing/selftests/resctrl/cat_test.c
> > @@ -98,12 +98,17 @@ void cat_test_cleanup(void)
> >         remove(RESULT_FILE_NAME2);
> >  }
> >
> > +static void ctrlc_handler_child(int signum, siginfo_t *info, void
> > +*ptr) {
> > +       exit(EXIT_SUCCESS);
> > +}
> > +
> 
> Could you please elaborate why this is necessary?

If enter "ctrl-c" when running "resctrl_tests -t cat",
SIGINT will be sent to all processes (parent&child).

At this time, the child process receives a SIGINT signal, but does not take any action.
In this case the parent process may not call ctrlc_handler() as expected.
Therefore, ctrlc_handler_child() is necessary.

It may be better to ignore the signal, then code can be simple as follows.
----
        if (bm_pid == 0) {
                param.mask = l_mask_1;
                strcpy(param.ctrlgrp, "c1");
                strcpy(param.mongrp, "m1");
                param.span = cache_size * n / count_of_bits;
                strcpy(param.filename, RESULT_FILE_NAME1);
                param.num_of_runs = 0;
                param.cpu_no = sibling_cpu_no;
                /* Ignore the signal,and wait to be cleaned up by the parent process */
                sigfillset(&sigact.sa_mask);
                sigact.sa_handler = SIG_IGN;
                //sigact.sa_sigaction = ctrlc_handler_child;  //delete
                if (sigaction(SIGINT, &sigact, NULL) ||
                    sigaction(SIGTERM, &sigact, NULL) ||
                    sigaction(SIGHUP, &sigact, NULL))
                        perror("# sigaction");
        } else {
----

Best regards,
Shaopeng Tan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ