Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp693156pxa; Thu, 27 Aug 2020 13:09:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAzAyB4kMLV9tflAzqXj7GEomxA/O5CtSAuVMu5keWzjvYxYBPnrpZyFAb7fewDCndVyc0 X-Received: by 2002:a17:906:d143:: with SMTP id br3mr19018684ejb.213.1598558948189; Thu, 27 Aug 2020 13:09:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598558948; cv=none; d=google.com; s=arc-20160816; b=ubrv48fVIArRJPKaT2NuXa4lhufg1YsIYQnk6fW0kk+iO1Vo3y7BMo8d/XeFzy3jv0 nn2rbOuFD8M+VFp2unT5f1yZDBWTl2yUNrxRB3yebw+L35RZptHG4kIRm68jNks4nSqp b06mIzsVm6RdeyZAZUDDfz3qBA2CYXTLyFm4T8nXdgSKGQdpfjdCECqJtp7CBTJf6lap OSl9YSzXrrp9uW0Wpk3UYoA7SH1HtSrRZBkEI9KCtj10OpJdCUdEnjqRbwjKsLy1j0rj ba43nIhBbzn7e9aI/lEENsPVAh4IuJrr4e6oLtM5DrK0iJCJAEULFvdzWUj/JxoexZT2 sVPw== 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=J3OIlTK7H0tMwQNVMc+b75mQttKSieumC0EM/JEHYhs=; b=B4nbfjLp7sCVK/knrmHOkSwGwYMArsP9Dn5fwGTbDGvj6/UnPJpZCzIKjYsKm2NpEO nvibI7zu1rujgmwnU1amX0VBtRrc29D57s1c92fZvbHCnEKzOcN4BkKeXJ1GNp1tbYhM Q0aNQtNft8KOPVEwPypdbQGcdUEsjKDLiJJKkk0kfssngNvvcUZZJw/f38zHYyk6irpf p1qA6Q/HZ4AfRovKyqB8jeuPuo4Ya+w8GrA6matEY9zpI5SYZZuJLKqB3lGXs2ggdfPT aM9W+NvKtF8gLlgkl5C4vCV7nKHPl6ZItEsIC7gvF6jhcoK0/v8qWf/XGKXJV+TSraxf NEGg== 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 cd8si1896007ejb.421.2020.08.27.13.08.45; Thu, 27 Aug 2020 13:09:08 -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 S1726854AbgH0UIJ (ORCPT + 99 others); Thu, 27 Aug 2020 16:08:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726266AbgH0UIJ (ORCPT ); Thu, 27 Aug 2020 16:08:09 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35C7EC061264; Thu, 27 Aug 2020 13:08:09 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kBOBl-005k79-Px; Thu, 27 Aug 2020 20:08:01 +0000 Date: Thu, 27 Aug 2020 21:08:01 +0100 From: Al Viro To: Ross Zwisler Cc: linux-kernel@vger.kernel.org, Mattias Nissler , Aleksa Sarai , Andrew Morton , Benjamin Gordon , David Howells , Dmitry Torokhov , Jesse Barnes , linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org, Matthew Wilcox , Micah Morton , Raul Rangel , Shuah Khan , Ross Zwisler Subject: Re: [PATCH v9 1/2] Add a "nosymfollow" mount option. Message-ID: <20200827200801.GB1236603@ZenIV.linux.org.uk> References: <20200827170947.429611-1-zwisler@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200827170947.429611-1-zwisler@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 27, 2020 at 11:09:46AM -0600, Ross Zwisler wrote: > From: Mattias Nissler > > For mounts that have the new "nosymfollow" option, don't follow symlinks > when resolving paths. The new option is similar in spirit to the > existing "nodev", "noexec", and "nosuid" options, as well as to the > LOOKUP_NO_SYMLINKS resolve flag in the openat2(2) syscall. Various BSD > variants have been supporting the "nosymfollow" mount option for a long > time with equivalent implementations. > > Note that symlinks may still be created on file systems mounted with > the "nosymfollow" option present. readlink() remains functional, so > user space code that is aware of symlinks can still choose to follow > them explicitly. > > Setting the "nosymfollow" mount option helps prevent privileged > writers from modifying files unintentionally in case there is an > unexpected link along the accessed path. The "nosymfollow" option is > thus useful as a defensive measure for systems that need to deal with > untrusted file systems in privileged contexts. > > More information on the history and motivation for this patch can be > found here: > > https://sites.google.com/a/chromium.org/dev/chromium-os/chromiumos-design-docs/hardening-against-malicious-stateful-data#TOC-Restricting-symlink-traversal > > Signed-off-by: Mattias Nissler > Signed-off-by: Ross Zwisler > Reviewed-by: Aleksa Sarai > --- > Changes since v8 [1]: > * Look for MNT_NOSYMFOLLOW in link->mnt->mnt_flags so we are testing > the link itself rather than the directory holding the link. (Al Viro) > * Rebased onto v5.9-rc2. AFAICS, it applies clean to -rc1; what was the rebase about?