From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E9C8C43381 for ; Mon, 25 Mar 2019 22:50:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5732C2082F for ; Mon, 25 Mar 2019 22:50:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730384AbfCYWuI (ORCPT ); Mon, 25 Mar 2019 18:50:08 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:56656 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729204AbfCYWuH (ORCPT ); Mon, 25 Mar 2019 18:50:07 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92 #3 (Red Hat Linux)) id 1h8YPn-0000cr-PD; Mon, 25 Mar 2019 22:49:59 +0000 Date: Mon, 25 Mar 2019 22:49:59 +0000 From: Al Viro To: Daniel Borkmann Cc: Linus Torvalds , syzbot , Alexei Starovoitov , linux-fsdevel , Linux List Kernel Mailing , syzkaller-bugs Subject: Re: KASAN: use-after-free Read in path_lookupat Message-ID: <20190325224959.GQ2217@ZenIV.linux.org.uk> References: <0000000000006946d2057bbd0eef@google.com> <20190325045744.GK2217@ZenIV.linux.org.uk> <20190325211405.GP2217@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Mon, Mar 25, 2019 at 11:04:53PM +0100, Daniel Borkmann wrote: > +static void bpf_destroy_inode_deferred(struct rcu_head *head) > +{ > + struct inode *inode = container_of(head, struct inode, i_rcu); > + enum bpf_type type; > + > + if (S_ISLNK(inode->i_mode)) > + kfree(inode->i_link); > + if (!bpf_inode_type(inode, &type)) > + bpf_any_put(inode->i_private, type); > + free_inode_nonrcu(inode); > +} Umm... Can bpf_any_put() can be called in that context? It's going to run in softirq; if that's OK (I'm not familiar enough with BPF guts to tell), sure, that's probably the best approach. Note, BTW, that it's obviously -stable fodder, so any splitting of ->destroy_inode() would live on top of that fix.