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] [day] [month] [year] [list]
Message-ID: <Yy6Br5dUir4pfcvv@work>
Date:   Fri, 23 Sep 2022 23:03:59 -0500
From:   "Gustavo A. R. Silva" <gustavoars@...nel.org>
To:     Kees Cook <keescook@...omium.org>
Cc:     Christine Caulfield <ccaulfie@...hat.com>,
        David Teigland <teigland@...hat.com>, cluster-devel@...hat.com,
        linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] dlm: Split memcpy() of struct dlm_message flexible array

On Fri, Sep 23, 2022 at 08:52:26PM -0700, Kees Cook wrote:
> To work around a misbehavior of the compiler's ability to see into
> composite flexible array structs (as detailed in the coming memcpy()
> hardening series[1]), split the memcpy() of the header and the payload
> so no false positive run-time overflow warning will be generated.
> 
> [1] https://lore.kernel.org/linux-hardening/20220901065914.1417829-2-keescook@chromium.org/
> 
> Cc: Christine Caulfield <ccaulfie@...hat.com>
> Cc: David Teigland <teigland@...hat.com>
> Cc: cluster-devel@...hat.com
> Reported-by: "Gustavo A. R. Silva" <gustavoars@...nel.org>
> Signed-off-by: Kees Cook <keescook@...omium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@...nel.org>

Thanks!
--
Gustavo

> ---
>  fs/dlm/requestqueue.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/dlm/requestqueue.c b/fs/dlm/requestqueue.c
> index 036a9a0078f6..63f45c3c53a2 100644
> --- a/fs/dlm/requestqueue.c
> +++ b/fs/dlm/requestqueue.c
> @@ -44,7 +44,8 @@ void dlm_add_requestqueue(struct dlm_ls *ls, int nodeid, struct dlm_message *ms)
>  
>  	e->recover_seq = ls->ls_recover_seq & 0xFFFFFFFF;
>  	e->nodeid = nodeid;
> -	memcpy(&e->request, ms, le16_to_cpu(ms->m_header.h_length));
> +	e->request = *ms;
> +	memcpy(&e->request.m_extra, ms->m_extra, length);
>  
>  	atomic_inc(&ls->ls_requestqueue_cnt);
>  	mutex_lock(&ls->ls_requestqueue_mutex);
> -- 
> 2.34.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ