Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1256424ybc; Tue, 12 Nov 2019 17:29:27 -0800 (PST) X-Google-Smtp-Source: APXvYqwSTMtQLmW1eIAxQANkYp1myFLjKHkEFFocX97vxdSvKgmqM2eWQoa3MmIIQ5iuFBXFIJ2+ X-Received: by 2002:a17:906:52d3:: with SMTP id w19mr355717ejn.268.1573608567863; Tue, 12 Nov 2019 17:29:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573608567; cv=none; d=google.com; s=arc-20160816; b=AFXbJFsU5qQGT7pVWZgE++0px7D5F+SkxODLMidGivuOiTFNM0nvucvLTWKgwAT5xQ ljAZv5VNaIiuHwf1P35TxXJuYvHGhOo1Lh9bPUlpHldbqdyR323AaPg3UgKE/QZlfkvg e2p5Szg4odIciuOjfCBH3CLeFvZT5XWN3sNuw+Q7KamQswjxGlPID7bGWgMhQ2AV2MHH uFJX24dIu2gZWmJhzituA7JWRvcR3LqU3/xWPTKLSI9YOQ1HkZQN7JIVOsAtmRsOvuHq iB+K1ALDZgy5ZHHE+Cj/9gETLNrWkJxMfaBkN+fNi0Y9QiKIZFyEh6Ei76UnMPvvQn8P f0Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=fl7DKmCMPzuE8HQIn7chcezDlgP8uxtDw5kY0LH5QEc=; b=RJE/tfGc3muTvt5Qbsc3lTbEa21M7+9mV7ispfmQ0k9vt+nkjWFjJRrCeoAAOJq08P W/K0PVZ9WLyp1B1g8dyywAAtRoayObZtr6fmhpa8QKXgJRwCSg+MdZ8JsQBKw/EiaSSn snkMKo/7HC5s8HHUQNWFDjT46R3IknmVbh3RoyVD3cJ1HsqPIlkvGSvVDraJd3yfDj7g 2lzKKvFn446tRoSZSxtdNbbNKuDysf5ZkBYwjbytvOsR6vcDFxRWvY6R6S5jk6vLqAB/ CbbuLsQ5G1NQAyWRJe3TRjV3W+N50L9SMlc7pDpMMsaZOaABh+bCgCRV8XJmdlXORTge 4oMA== ARC-Authentication-Results: i=1; mx.google.com; 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 f13si203293ejt.61.2019.11.12.17.29.03; Tue, 12 Nov 2019 17:29:27 -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; 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 S1727166AbfKMB1E (ORCPT + 99 others); Tue, 12 Nov 2019 20:27:04 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:38684 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726960AbfKMB1E (ORCPT ); Tue, 12 Nov 2019 20:27:04 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1iUhOU-0006xS-Cx; Wed, 13 Nov 2019 01:24:26 +0000 Date: Wed, 13 Nov 2019 01:24:26 +0000 From: Al Viro To: Aleksa Sarai Cc: Jeff Layton , "J. Bruce Fields" , Arnd Bergmann , David Howells , Shuah Khan , Shuah Khan , Ingo Molnar , Peter Zijlstra , Christian Brauner , David Drysdale , Andy Lutomirski , Linus Torvalds , Eric Biederman , Andrew Morton , Alexei Starovoitov , Kees Cook , Jann Horn , Tycho Andersen , Chanho Min , Oleg Nesterov , Rasmus Villemoes , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Christian Brauner , Aleksa Sarai , containers@lists.linux-foundation.org, linux-alpha@vger.kernel.org, linux-api@vger.kernel.org, libc-alpha@sourceware.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-xtensa@linux-xtensa.org, sparclinux@vger.kernel.org Subject: Re: [PATCH v15 2/9] namei: LOOKUP_NO_MAGICLINKS: block magic-link resolution Message-ID: <20191113012426.GY26530@ZenIV.linux.org.uk> References: <20191105090553.6350-1-cyphar@cyphar.com> <20191105090553.6350-3-cyphar@cyphar.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191105090553.6350-3-cyphar@cyphar.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 05, 2019 at 08:05:46PM +1100, Aleksa Sarai wrote: > @@ -1078,6 +1079,10 @@ const char *get_link(struct nameidata *nd) > } else { > res = get(dentry, inode, &last->done); > } > + if (nd->flags & LOOKUP_MAGICLINK_JUMPED) { > + if (unlikely(nd->flags & LOOKUP_NO_MAGICLINKS)) > + return ERR_PTR(-ELOOP); > + } Minor nit - the first check probably wants unlikely() more than the second one; it's probably noise anyway, but most of the symlinks traversed are not going to be procfs ones, so you get test + branch taken most of the time. OTOH, that just might compile into fetch nd->flags and with LOOKUP_MAGICLINK_JUMPED | LOOKUP_NO_MAGICLINKS compare with the same constant unlikely branch when equal Anyway, that's no more than a minor nit and can be dealt with later (if at all)