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: <0df7f82d-de3b-3e51-ffc1-5aa4e23db62a@intel.com>
Date:   Fri, 29 Sep 2023 09:55:23 -0700
From:   Reinette Chatre <reinette.chatre@...el.com>
To:     Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
        <linux-kselftest@...r.kernel.org>, Shuah Khan <shuah@...nel.org>,
        Maciej Wieczór-Retman 
        <maciej.wieczor-retman@...el.com>,
        Shaopeng Tan <tan.shaopeng@...fujitsu.com>
CC:     <linux-kernel@...r.kernel.org>, <stable@...r.kernel.org>
Subject: Re: [PATCH v3 1/7] selftests/resctrl: Fix uninitialized .sa_flags

Hi Ilpo,

On 9/29/2023 4:20 AM, Ilpo Järvinen wrote:
> signal_handler_unregister() calls sigaction() with uninitializing
> sa_flags in the struct sigaction.
> 
> Make sure sa_flags is always initialized in signal_handler_unregister()
> by initializing the struct sigaction when declaring it.
> 
> Fixes: 73c55fa5ab55 (selftests/resctrl: Commonize the signal handler register/unregister for all tests)

Please place the title line in quotes (checkpatch warning).

> Suggested-by: Reinette Chatre <reinette.chatre@...el.com>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
> Cc: <stable@...r.kernel.org>
> ---
>  tools/testing/selftests/resctrl/resctrl_val.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/selftests/resctrl/resctrl_val.c
> index 51963a6f2186..1e8b90077218 100644
> --- a/tools/testing/selftests/resctrl/resctrl_val.c
> +++ b/tools/testing/selftests/resctrl/resctrl_val.c
> @@ -504,7 +504,7 @@ int signal_handler_register(void)
>   */
>  void signal_handler_unregister(void)
>  {
> -	struct sigaction sigact;
> +	struct sigaction sigact = {};
>  
>  	sigact.sa_handler = SIG_DFL;
>  	sigemptyset(&sigact.sa_mask);

Could you please add this initialization to signal_handler_register()
also? I understand that the particular issue of sa_flags is not 
relevant to that function but there are other uninitialized fields.
I think initializing the struct makes the code more robust without
needing to reason/understand glibc behavior.

Reinette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ