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=-6.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 5E21CC433E1 for ; Thu, 27 Aug 2020 20:08:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 399CA20848 for ; Thu, 27 Aug 2020 20:08:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726839AbgH0UIJ (ORCPT ); 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-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@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?