Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp695465pxa; Thu, 27 Aug 2020 13:12:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzg4ZLBVnEI5pJomjwNMV/oSVhZkXVfwIOEAamK6+0ZTeaHFl0e47Nr7Wp0jre4Ck7pKGXe X-Received: by 2002:a17:906:b210:: with SMTP id p16mr18840862ejz.312.1598559173275; Thu, 27 Aug 2020 13:12:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598559173; cv=none; d=google.com; s=arc-20160816; b=NgP4Y3KK3C9vRRTiZqZGEsTfr/agUddTrkbwHPy2hfdMahkOpX7Lraa2i/LQ2R6fS+ c15ZPh65XSSuACRzO48RHsW/VKnKY3m7O6f+UwdWB/GLljX/5u39F/8u75hTiDr6MZj2 RI4r04pDafA9hCin4C0QG5pnpWJg7NxdOVegUMW1DRXRyOzWlGpImdeWTOYzPhiXxWVH gonMujsFisNxbiZlvQAZCxRfQeVnrI9xR6uTdbWKieUXq2xcp62lwp+YrcW6MTySoxHf x03KI7k4QDRUMs+hWn30RlrQv/z66Ysf7yp7VKCOm1l4X1+AcEJwjJKQ3Bvs8Jf/s9+r AVjQ== 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=zBMHCFtcnNeBsKgOKigGoInH1of51NH3TPYUiY7j3l4=; b=lVGq5Eh9iWbkVbrxGLEDGzQuNamsJg4UVGh6j1nOR4wlKaGG+J4DqDALLa7920MzIG wU0C6HDJPnGe5sjYdgmCOZn7eJEKWHWjQbOJ0M4MCc9CBnU1pz3cbsKMEADJRpUApLd0 zZq73UT2y4NISS4ro9FehJCQjCDzl4IRbGdtzydv1Ww+BSUZu2xFKsWlIjBRz0psB706 F44xuvRklWM8McGvIePf4bTVoBDPe1klmKQjgp3y8Wm9bTk7sxRE6xaIiOQ34ynCa881 fF3BBJOKGoZEQgxFrCM8JNNsXa9F2CpnM3VIWZUL2oNLkPXZUfSAo/SQFaOGQlrsL2G/ ZskA== 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 i15si1927406ejy.710.2020.08.27.13.12.29; Thu, 27 Aug 2020 13:12:53 -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 S1726871AbgH0UKR (ORCPT + 99 others); Thu, 27 Aug 2020 16:10:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726321AbgH0UKQ (ORCPT ); Thu, 27 Aug 2020 16:10:16 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A13B4C061264; Thu, 27 Aug 2020 13:10:16 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kBODv-005kB0-12; Thu, 27 Aug 2020 20:10:15 +0000 Date: Thu, 27 Aug 2020 21:10:15 +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: <20200827201015.GC1236603@ZenIV.linux.org.uk> References: <20200827170947.429611-1-zwisler@google.com> <20200827200801.GB1236603@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200827200801.GB1236603@ZenIV.linux.org.uk> 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 09:08:01PM +0100, Al Viro wrote: > 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? Applied (to -rc1) and pushed