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: Fri, 23 Feb 2024 13:18:22 -0800
From: Reinette Chatre <reinette.chatre@...el.com>
To: Maciej Wieczor-Retman <maciej.wieczor-retman@...el.com>, Fenghua Yu
	<fenghua.yu@...el.com>, Shuah Khan <shuah@...nel.org>
CC: <ilpo.jarvinen@...ux.intel.com>, <linux-kernel@...r.kernel.org>,
	<linux-kselftest@...r.kernel.org>
Subject: Re: [PATCH v3 2/3] selftests/resctrl: Simplify cleanup in ctrl-c
 handler

Hi Maciej,

On 2/22/2024 4:07 AM, Maciej Wieczor-Retman wrote:
  	}
> diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/selftests/resctrl/resctrl_val.c
> index 5a49f07a6c85..0134aa2f896a 100644
> --- a/tools/testing/selftests/resctrl/resctrl_val.c
> +++ b/tools/testing/selftests/resctrl/resctrl_val.c
> @@ -62,6 +62,7 @@ struct imc_counter_config {
>  static char mbm_total_path[1024];
>  static int imcs;
>  static struct imc_counter_config imc_counters_config[MAX_IMCS][2];
> +static const struct resctrl_test *current_test;
>  
>  void membw_initialize_perf_event_attr(int i, int j)
>  {
> @@ -472,7 +473,8 @@ void ctrlc_handler(int signum, siginfo_t *info, void *ptr)
>  	if (bm_pid)
>  		kill(bm_pid, SIGKILL);
>  	umount_resctrlfs();
> -	tests_cleanup();
> +	if (current_test->cleanup)
> +		current_test->cleanup();

Could you please make this more robust with a:

	if (current_test && current_test->cleanup)

>  	ksft_print_msg("Ending\n\n");
>  
>  	exit(EXIT_SUCCESS);
> @@ -482,13 +484,14 @@ void ctrlc_handler(int signum, siginfo_t *info, void *ptr)
>   * Register CTRL-C handler for parent, as it has to kill
>   * child process before exiting.
>   */
> -int signal_handler_register(void)
> +int signal_handler_register(const struct resctrl_test *test)
>  {
>  	struct sigaction sigact = {};
>  	int ret = 0;
>  
>  	bm_pid = 0;
>  
> +	current_test = test;
>  	sigact.sa_sigaction = ctrlc_handler;
>  	sigemptyset(&sigact.sa_mask);
>  	sigact.sa_flags = SA_SIGINFO;

Could you please reset the pointer in signal_handler_unregister()?

Reinette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ