Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13910665ybl; Sun, 29 Dec 2019 23:58:08 -0800 (PST) X-Google-Smtp-Source: APXvYqzpHypr9U4uJfrvvu1vui4i7RnH9S+mb7tbkkLJldIo8cGejFC2VhrNweP6LacxBN968CQf X-Received: by 2002:a9d:4692:: with SMTP id z18mr70870671ote.163.1577692687551; Sun, 29 Dec 2019 23:58:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577692687; cv=none; d=google.com; s=arc-20160816; b=yRA1jpgdyYNeJpsEa/z52MCSgmqkzPBv/K9KRGWK8CX/8AiUzWv31DluOjqGkCozf3 aodYnONY8tscHQnJTV9pZKE3p6tVO13dQJ8WluES0RxnjPWgzUSp2iYDuk1cstkdzPW5 I5Y+gmqf56NYV6Nh5g1GPvQIXbzHMJD2TNe98hRGm7xnlvtKHB6pZVA54w0cIOieN7Xg lPnVLxJ1sQnqyOaoSVFL7ZlDuoz8VmZLm4BdXm3mHbLWTi18qLyqpv7AN6sY3oVJXcg5 rMJFP8oMq2dgHb7h29ZffoQZOuOrsA+E3gUd2RQ7VFxeXleG1KSuhe54awgBC5VKidfm Db1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=UPYZanyjmH24ggFQ0lPuYSWOsbulZsh973CIm+qG+bk=; b=nsn7Kq9GeV+C8jHyAXU/LzSgSAJqxqRX3CggARUVKb1mx7XXaJnDBibMQEbyGvAGEW U6xaS6axZqK1kSF7i6QrI72szovSukuNwBC16/ee25sw+Iqj6ryzZqk6FOJuKolK+6ID /yX8tlvOQGVFMxdv5C3uiq3mZP27SH+NBAjLhYbpJHtF/657sZlEDYBmpcsqD74ptYKr +TmPEG8dG1FyChVlffW8kFCAiE97avzuzUlFNgdvIvREapMihG978VnOWQMS6QIX9yCt Z5Y4+lAMUX8YAzv3V27Cy4progi8dyv9vigoWWXJrHI27qMNNQnBOgNoaGqEuNF26t25 DOAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Cx3+XC85; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1si23311250otq.21.2019.12.29.23.57.43; Sun, 29 Dec 2019 23:58:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Cx3+XC85; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727225AbfL3HyH (ORCPT + 99 others); Mon, 30 Dec 2019 02:54:07 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:37650 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727158AbfL3HyH (ORCPT ); Mon, 30 Dec 2019 02:54:07 -0500 Received: by mail-lj1-f194.google.com with SMTP id o13so21075942ljg.4 for ; Sun, 29 Dec 2019 23:54:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UPYZanyjmH24ggFQ0lPuYSWOsbulZsh973CIm+qG+bk=; b=Cx3+XC85If9Oc3+SnG+zaiVL3sW0ltnO4/9ZE8Ra0eb06emSRYR1g1CetfkcslqRDu zngUIRfNBEw2+zHB+1VIS6HcdT6io8j0lKAIdKyWkqzg0NCQXe4euoQAsTWtdle3aXn2 1oukdDy3yiimYe6rjVLG8s6wv0hhJ97hy/Dzw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UPYZanyjmH24ggFQ0lPuYSWOsbulZsh973CIm+qG+bk=; b=Bmb6YJSyL6xDDfo+sPOgMBPVgfOo9EUUaKZi48LhkAAuTK/v4gCb6GSNriemKgoJXB Ibb5W/Wio59bHPSIDp8SC9E60UuYKKJJpRIqpDaWnVUlT8H6eAFqI08D5Z1mQ30eSXA1 5eixyb+GKWCC+13I+aaCbRpfSVU7xBg7iIUJGoCzXZcpm9gWeAZxy3rf3/UK7jablqs3 7TGyI/eKA92JP+QrPedK+TfmlsNICK8PgfxJAxt2ikFCd50Y/Nay7/0/1XVOy202chxp 5fgYbcqJgOSdTifzInnrZ0K0N1AraFjCu1lWGY4Yf2XFYTkdTGYjFDJ4QlSuNlRuEieK LKjA== X-Gm-Message-State: APjAAAXEBBXTK/+Vc+1Gy8XlalVRzlCQbls2qjEGxkXXsO0Gx0w5KahP 2vSkFgn9eP/GoAB3ro4gmgKX/FI20nc= X-Received: by 2002:a2e:9806:: with SMTP id a6mr36877385ljj.178.1577692445057; Sun, 29 Dec 2019 23:54:05 -0800 (PST) Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com. [209.85.208.181]) by smtp.gmail.com with ESMTPSA id w9sm17051030ljh.106.2019.12.29.23.54.03 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 29 Dec 2019 23:54:04 -0800 (PST) Received: by mail-lj1-f181.google.com with SMTP id h23so32496716ljc.8 for ; Sun, 29 Dec 2019 23:54:03 -0800 (PST) X-Received: by 2002:a2e:9041:: with SMTP id n1mr37567234ljg.133.1577692443206; Sun, 29 Dec 2019 23:54:03 -0800 (PST) MIME-Version: 1.0 References: <20191230052036.8765-1-cyphar@cyphar.com> <20191230054413.GX4203@ZenIV.linux.org.uk> <20191230054913.c5avdjqbygtur2l7@yavin.dot.cyphar.com> <20191230072959.62kcojxpthhdwmfa@yavin.dot.cyphar.com> In-Reply-To: <20191230072959.62kcojxpthhdwmfa@yavin.dot.cyphar.com> From: Linus Torvalds Date: Sun, 29 Dec 2019 23:53:47 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RFC 0/1] mount: universally disallow mounting over symlinks To: Aleksa Sarai Cc: Al Viro , David Howells , Eric Biederman , stable , Christian Brauner , Serge Hallyn , dev@opencontainers.org, Linux Containers , Linux API , linux-fsdevel , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 29, 2019 at 11:30 PM Aleksa Sarai wrote: > > BUG: kernel NULL pointer dereference, address: 0000000000000000 Would you mind building with debug info, and then running the oops through scripts/decode_stacktrace.sh which makes those addresses much more legible. > #PF: supervisor instruction fetch in kernel mode > #PF: error_code(0x0010) - not-present page Somebody jumped through a NULL pointer. > RAX: 0000000000000000 RBX: ffff906d0cc3bb40 RCX: 0000000000000abc > RDX: 0000000000000089 RSI: ffff906d74623cc0 RDI: ffff906d74475df0 > RBP: ffff906d74475df0 R08: ffffd70b7fb24c20 R09: ffff906d066a5000 > R10: 0000000000000000 R11: 8080807fffffffff R12: ffff906d74623cc0 > R13: 0000000000000089 R14: ffffb70b82963dc0 R15: 0000000000000080 > FS: 00007fbc2a8f0540(0000) GS:ffff906dcf500000(0000) knlGS:0000000000000000 > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > CR2: ffffffffffffffd6 CR3: 00000003c68f8001 CR4: 00000000003606e0 > Call Trace: > __lookup_slow+0x94/0x160 And "__lookup_slow()" has two indirect calls (they aren't obvious with retpoline, but look for something like call __x86_indirect_thunk_rax which is the modern sad way of doing "call *%rax"). One is for revalidatinging an old dentry, but the one I _suspect_ you trigger is this one: old = inode->i_op->lookup(inode, dentry, flags); but I thought we only could get here if we know it's a directory. How did we miss the "d_can_lookup()", which is what should check that yes, we can call that ->lookup() routine. This is why I have that suspicion that it's somehow that O_PATH fd opened in another process without O_PATH causes confusion... So what I think has happened is that because of the O_PATH thing, we've ended up with an inode that has never been truly opened (because O_PATH skips that part), but then with the /proc//fd/xyz open, we now have a file descriptor that _looks_ like it is valid, and we're treating that inode as if it can be used. But I'm handwaving. Linus