From: "Zhang, Qiang" <Qiang.Zhang@windriver.com>
To: Eric Dumazet <eric.dumazet@gmail.com>,
"jmaloy@redhat.com" <jmaloy@redhat.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"kuba@kernel.org" <kuba@kernel.org>,
"tuong.t.lien@dektech.com.au" <tuong.t.lien@dektech.com.au>,
"Xue, Ying" <Ying.Xue@windriver.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"tipc-discussion@lists.sourceforge.net"
<tipc-discussion@lists.sourceforge.net>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: 回复: [PATCH v2] tipc: Don't using smp_processor_id() in preemptible code
Date: Wed, 15 Jul 2020 02:12:57 +0000 [thread overview]
Message-ID: <DM6PR11MB2635949FCEAF1EF90B93B5D1FF7E0@DM6PR11MB2635.namprd11.prod.outlook.com> (raw)
In-Reply-To: <bf395370-219a-7c87-deee-7f3edce8c9dc@gmail.com>
________________________________________
发件人: Eric Dumazet <eric.dumazet@gmail.com>
发送时间: 2020年7月14日 22:15
收件人: Zhang, Qiang; jmaloy@redhat.com; davem@davemloft.net; kuba@kernel.org; tuong.t.lien@dektech.com.au; eric.dumazet@gmail.com; Xue, Ying
抄送: netdev@vger.kernel.org; tipc-discussion@lists.sourceforge.net; linux-kernel@vger.kernel.org
主题: Re: [PATCH v2] tipc: Don't using smp_processor_id() in preemptible code
On 7/14/20 1:05 AM, qiang.zhang@windriver.com wrote:
> From: Zhang Qiang <qiang.zhang@windriver.com>
>
> CPU: 0 PID: 6801 Comm: syz-executor201 Not tainted 5.8.0-rc4-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine,
> BIOS Google 01/01/2011
>
> Fixes: fc1b6d6de2208 ("tipc: introduce TIPC encryption & authentication")
> Reported-by: syzbot+263f8c0d007dc09b2dda@syzkaller.appspotmail.com
> Signed-off-by: Zhang Qiang <qiang.zhang@windriver.com>
> ---
> v1->v2:
> add fixes tags.
>
> net/tipc/crypto.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/tipc/crypto.c b/net/tipc/crypto.c
> index 8c47ded2edb6..520af0afe1b3 100644
> --- a/net/tipc/crypto.c
> +++ b/net/tipc/crypto.c
> @@ -399,9 +399,10 @@ static void tipc_aead_users_set(struct tipc_aead __rcu *aead, int val)
> */
> static struct crypto_aead *tipc_aead_tfm_next(struct tipc_aead *aead)
> {
> - struct tipc_tfm **tfm_entry = this_cpu_ptr(aead->tfm_entry);
> + struct tipc_tfm **tfm_entry = get_cpu_ptr(aead->tfm_entry);
>
> *tfm_entry = list_next_entry(*tfm_entry, list);
> + put_cpu_ptr(tfm_entry);
> return (*tfm_entry)->tfm;
> }
>
>
> You have not explained why this was safe.
>
> This seems to hide a real bug.
>
> Presumably callers of this function should have disable preemption, and maybe > interrupts as well.
>
>Right after put_cpu_ptr(tfm_entry), this thread could migrate to another cpu, >and still access
>data owned by the old cpu.
Thanks for you suggest, I will check code again.
next prev parent reply other threads:[~2020-07-15 2:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-14 8:05 [PATCH v2] tipc: Don't using smp_processor_id() in preemptible code qiang.zhang
2020-07-14 14:15 ` Eric Dumazet
2020-07-15 2:12 ` Zhang, Qiang [this message]
2020-07-15 3:53 ` Tuong Tong Lien
2020-07-15 5:27 ` 回复: " Zhang, Qiang
2020-07-15 6:05 ` Zhang, Qiang
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=DM6PR11MB2635949FCEAF1EF90B93B5D1FF7E0@DM6PR11MB2635.namprd11.prod.outlook.com \
--to=qiang.zhang@windriver.com \
--cc=Ying.Xue@windriver.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=jmaloy@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tipc-discussion@lists.sourceforge.net \
--cc=tuong.t.lien@dektech.com.au \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).