Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2767523rwb; Thu, 29 Sep 2022 14:59:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6SLghCt/2r28ZuAichBzCWGpZNnxt0/13HFqswrmf0Rc3vT8rzDaRX9nQfCQmG0hT429m7 X-Received: by 2002:a63:89c7:0:b0:43c:e4e4:7aa with SMTP id v190-20020a6389c7000000b0043ce4e407aamr4803086pgd.33.1664488740273; Thu, 29 Sep 2022 14:59:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664488740; cv=none; d=google.com; s=arc-20160816; b=02/P1sgZwl4xnu9ey7x03FklY0oBV4XiDtq2QVXPhc271Pg2iiL5iy8tbGBM007Hw0 roA/3KSUCNF5sD9BVrBDfzA9Z1YqSQDSpDHU3A3NkhbXk7z5kh2GP4bdn6+/wR7J7PYa SjsIUn+QCWJYZpLSdnH+lB8WHI3KfiwEitJ4psowZPqLca5A2XDU+UklDVQSoh0jpHRI pXSssz4yXt0N1aMkjvjQ5ygOBDn0Yp4Q1LfyljStqdNezLDf6NLibuwl2FWNnJdNt4Ej OHg9sCMcVLZihaBVt8xgCViYlSz2g/Aoq9YAwDrw1nX1WdKsYYHDuWOBQgVNU1KGZsO9 grMg== 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 :dkim-signature; bh=BHyZXwz0JpdIs839aZuS4LVragG1ByLHmjarMItcZwU=; b=xtiPHmaMP9Lw+Q08cRE7Rnkfm9iMthvkEa5B55cxGQrayRi5GfFWacJayLj2VDWEAa cylOCwxpuztLunmbC6NHBsZNK9qu6wjniPb4f0EVZNOnClEl4aMvkyBBzKoND8r+ne/V IGSgdTvC/k4osFr+FploM17AvReAWjKqnZkwUAwlewHjVX3Y3OAsdvd0wCs64w7RkHqo t1H39imcUOE+aQR7woAqyyW+3clXD8YNjm/wWVOnIzGG+2UvkBfmylFwWRRP+NWrgzRV h2o3U1b1DKJZmkYEG3ZFaZK2G+CATnsV4B0xdEQo9TGB94vDFWKafQla3FEBKBnCcG0S 0YEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=KOsF3K4i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g21-20020a056a001a1500b00542be097b0dsi539562pfv.3.2022.09.29.14.58.48; Thu, 29 Sep 2022 14:59:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=KOsF3K4i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229448AbiI2VPe (ORCPT + 99 others); Thu, 29 Sep 2022 17:15:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229502AbiI2VPc (ORCPT ); Thu, 29 Sep 2022 17:15:32 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A02565E326; Thu, 29 Sep 2022 14:15:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=BHyZXwz0JpdIs839aZuS4LVragG1ByLHmjarMItcZwU=; b=KOsF3K4ixph6tVuWA1nGXJ4JN1 oreveL4oBOsfZ98hMXtlgpTWlYRQe9nZF4IIdbUuFc9aCHiQUub43l4guA73tEr5akI0p18O9OVzj xMpTcRpd9MwJwxdvcte9eL6rzE0iTh5Xtnn2Rh5ibQRD2m1e3MTPh5G0ZYSwleCdR0Sjk8GXhIlAj NgDuDttPXT5627G6g+6CiEOglO8MpPBbWFvro2WIl8uyjuX6/IgLADZWgt50g/csDCZgmL+oSaiSJ /6GYHWste/6KiaQ24RbUp4x76FhGjhbJDDORF7tHyIXIJQaHNDzVyO8q0smSnO7XJcmhya7EAQ/yE LcWu3AXg==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1oe0sQ-0055y5-2H; Thu, 29 Sep 2022 21:15:27 +0000 Date: Thu, 29 Sep 2022 22:15:26 +0100 From: Al Viro To: Linus Torvalds Cc: David Laight , "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" , "Eric W. Biederman" , "Serge E. Hallyn" Subject: Re: [PATCH 3/4] proc: Point /proc/net at /proc/thread-self/net instead of /proc/self/net Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 29, 2022 at 08:34:52PM +0100, Al Viro wrote: > On Thu, Sep 29, 2022 at 12:05:32PM -0700, Linus Torvalds wrote: > > On Thu, Sep 29, 2022 at 12:00 PM Al Viro wrote: > > > > > > Which is insane, especially since the entire problem is due to wanting > > > that directory to be different for different threads... > > > > Absolutely. This is all due to Apparmor (a) basing things on pathnames > > and (b) then getting those pathnames wrong. > > > > Which is why I'm just suggesting we short-circuit the path-name part, > > and not make this be a real symlink that actually walks a real path. > > > > The proc handling uses "readlink" to make it *look* like a > > symlink, but then "get_link" to actually look it up (and never walk it > > as a path). > > > > Something similar? > > Apparmor takes mount+dentry and turns that into pathname. Then acts > upon the resulting string. *AFTER* the original had been resolved. > IOW, it doesn't see the symlink contents - only the location where the > entire thing ends up. > > AFAICS, the only way to make it STFU is either > * fix the idiotic policy > or > * make the per-thread directory show up as /proc//net > > As in "../.. from there lands you in /proc". Because that's what > apparmor does to generate the string it treats as the pathname... FWIW, what e.g. debian profile for dhclient has is @{PROC}/@{pid}/net/dev r, Note that it's not @{PROC}/net/dev r, precisely because the rules are applied after the pathname got resolved. *IF* we want that rule to allow opening /proc/net/dev, we'd better have it yield a dentry in procfs that would have "dev" as ->d_name, with its parent having "net" as ->d_name and its grandparent being the child of procfs root with ->d_name containing decimal representation of PID. Worse, original poster in _this_ thread wants the same /proc/net/dev to to yield different files for different threads belonging to the same process and we'd need _all_ of them to have identical chain of ->d_name occuring on the way to root.