From: "Gustavo A. R. Silva" <gustavoars@kernel.org> To: Kees Cook <keescook@chromium.org> Cc: Christine Caulfield <ccaulfie@redhat.com>, David Teigland <teigland@redhat.com>, cluster-devel@redhat.com, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] dlm: Split memcpy() of struct dlm_message flexible array Date: Fri, 23 Sep 2022 23:03:59 -0500 [thread overview] Message-ID: <Yy6Br5dUir4pfcvv@work> (raw) In-Reply-To: <20220924035226.3359297-1-keescook@chromium.org> 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@redhat.com> > Cc: David Teigland <teigland@redhat.com> > Cc: cluster-devel@redhat.com > Reported-by: "Gustavo A. R. Silva" <gustavoars@kernel.org> > Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.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 >
WARNING: multiple messages have this Message-ID (diff)
From: Gustavo A. R. Silva <gustavoars@kernel.org> To: cluster-devel.redhat.com Subject: [Cluster-devel] [PATCH] dlm: Split memcpy() of struct dlm_message flexible array Date: Fri, 23 Sep 2022 23:03:59 -0500 [thread overview] Message-ID: <Yy6Br5dUir4pfcvv@work> (raw) In-Reply-To: <20220924035226.3359297-1-keescook@chromium.org> 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 at chromium.org/ > > Cc: Christine Caulfield <ccaulfie@redhat.com> > Cc: David Teigland <teigland@redhat.com> > Cc: cluster-devel at redhat.com > Reported-by: "Gustavo A. R. Silva" <gustavoars@kernel.org> > Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.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 >
next prev parent reply other threads:[~2022-09-24 4:04 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-09-24 3:52 [PATCH] dlm: Split memcpy() of struct dlm_message flexible array Kees Cook 2022-09-24 3:52 ` [Cluster-devel] " Kees Cook 2022-09-24 4:03 ` Gustavo A. R. Silva [this message] 2022-09-24 4:03 ` Gustavo A. R. Silva
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=Yy6Br5dUir4pfcvv@work \ --to=gustavoars@kernel.org \ --cc=ccaulfie@redhat.com \ --cc=cluster-devel@redhat.com \ --cc=keescook@chromium.org \ --cc=linux-hardening@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=teigland@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.