Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2008619pxk; Sat, 19 Sep 2020 09:21:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwNjue/TgjfX/sIo4Z9qWY1hSv4dIgqm/TISCkcGz7DOywUGI4rdTXn61g9QyUY6s1+PJg X-Received: by 2002:a17:906:cc99:: with SMTP id oq25mr30159686ejb.292.1600532501610; Sat, 19 Sep 2020 09:21:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600532501; cv=none; d=google.com; s=arc-20160816; b=vHkP3aMBHU7PoTy/LrK/iYrf3Kxj6NqktyErjtKKa75lf87mAACgvhYR2xVnfw50l+ 09bEUGWLH4CpF+KmlCCB493vG1XKl8cYH0+l4Bq4eIBhTOuy3bryqCcxbDlJmw+f5q2f T2ft4btrQrG0hAGas6xGu89MNd1zgzn8rsac8DKgs4H976WNOL9Hy+453m2dlPIAV6ZZ SQ+CxOwdTBM8VsUheesZ5vJ4ti3WdLBTmvdtwRKDKAbFwDPC6meWa6OxQFfFDPPe+nwh neeyM9jjiCSg9GYTjKvTcbf1o6dv+479sHPBTKySUsAxzMtYI5I1uyeu/Sdig8Fv1C7J JKvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=pFPZOq63akmsNFsrNb/FuB3z9lNvO0fLqAAuNRoxv2A=; b=SWL6R2wfNu5uQ8STMxY+U7pdSCRzig1odij2HOzpwk3DlSMKUhlsLWu49S8Ba5H+dl ixj6hJ0M2qnZm/oREgdZRPNzIMK3D98FtSO3JUhhaOKXgWxYQrqE27vD6nQkJNBAe05V //OcfprHGREd1gpvdbW/RjmkhKm7Si3as0PLp5+xgJAmXP8xvTH4RFORXWe/puDK+1Nx Mv8/kmGrw1SyUQAjMQhkKHkFe0U2vgJ7eaeivjmCvl1KRW8/69bRz5guPkFUOlqcRGEf GcuD9uf7FvirbPR6xfOjA8p7NOYH6QZNMbyckaqML7lpiJ6CPW3WI48VU8Lmd1DaCdSf fShA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cx12si5677295edb.298.2020.09.19.09.21.17; Sat, 19 Sep 2020 09:21:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726618AbgISQRh (ORCPT + 99 others); Sat, 19 Sep 2020 12:17:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726463AbgISQRh (ORCPT ); Sat, 19 Sep 2020 12:17:37 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4984C0613CE; Sat, 19 Sep 2020 09:17:36 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJfYF-001pPE-5f; Sat, 19 Sep 2020 16:17:27 +0000 Date: Sat, 19 Sep 2020 17:17:27 +0100 From: Al Viro To: Greg KH Cc: Eric Biggers , linux-fsdevel@vger.kernel.org, Anant Thazhemadam , linux-kernel-mentees@lists.linuxfoundation.org, syzbot+4191a44ad556eacc1a7a@syzkaller.appspotmail.com, linux-kernel@vger.kernel.org Subject: Re: [Linux-kernel-mentees] [PATCH] fs: fix KMSAN uninit-value bug by initializing nd in do_file_open_root Message-ID: <20200919161727.GG3421308@ZenIV.linux.org.uk> References: <20200916052657.18683-1-anant.thazhemadam@gmail.com> <20200916054157.GC825@sol.localdomain> <20200917002238.GO3421308@ZenIV.linux.org.uk> <20200919144451.GF2712238@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200919144451.GF2712238@kroah.com> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 19, 2020 at 04:44:51PM +0200, Greg KH wrote: > > ->dir_uid and ->dir_mode are set when link_path_walk() resolves the pathname > > to directory + final component. They are used when deciding whether to reject > > a trailing symlink (on fs.protected_symlinks setups) and whether to allow > > creation in sticky directories (on fs.protected_regular and fs.protected_fifos > > setups). Both operations really need the results of successful link_path_walk(). > > > > I don't see how that could be not a false positive. If we hit the use in > > may_create_in_sticky(), we'd need the combination of > > * pathname that consists only of slashes (or it will be initialized) > > * LAST_NORM in nd->last_type, which is flat-out impossible, since > > we are left with LAST_ROOT for such pathnames. The same goes for > > may_follow_link() use - we need WALK_TRAILING in flags to hit it in the > > first place, which can come from two sources - > > return walk_component(nd, WALK_TRAILING); > > in lookup_last() (and walk_component() won't go anywhere near the > > call chain leading to may_follow_link() without LAST_NORM in nd->last_type) > > and > > res = step_into(nd, WALK_TRAILING, dentry, inode, seq); > > in open_last_lookups(), which also won't go anywhere near that line without > > LAST_NORM in the nd->last_type. > > > > IOW, unless we manage to call that without having called link_path_walk() > > at all or after link_path_walk() returning an error, we shouldn't hit > > that. And if we *do* go there without link_path_walk() or with an error > > from link_path_walk(), we have a much worse problem. > > > > I want to see the details of reproducer. If it's for real, we have a much > > more serious problem; if it's a false positive, the right place to deal > > with it would be elsewhere (perhaps on return from link_path_walk() with > > a slashes-only pathname), but in any case it should only be done after we > > manage to understand what's going on. > > Reproducer is pretty simple: > https://syzkaller.appspot.com/text?tag=ReproC&x=13974b2f100000 > > Now if that is actually valid or not, I don't know... Lovely... That would get an empty path and non-directory for a starting point, but it should end up with LAST_ROOT in nd->last_type. Which should not be able to reach the readers of those fields... Which kernel had that been on?