Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6514715ybi; Wed, 29 May 2019 08:55:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqwYK8j/85iNnUpuQBNLA8zbBgI5IE+8+f9izZWN/F6GorFxNbKmXlNDfYbYS2otUSKo9vOv X-Received: by 2002:aa7:86c3:: with SMTP id h3mr147964390pfo.169.1559145316721; Wed, 29 May 2019 08:55:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559145316; cv=none; d=google.com; s=arc-20160816; b=hK0a7/J5yTedvO3WcFokBJLB26034LRKSBRd4SMyVfMEXx+fwBOfQSJSYZXu7I8C3S Hmo7OftqGhdVgLuF/jmoFlgnSknb/0vIahmSYni4Fkac0gGsJKv0AteqBt2CjZN1xxoS bT0PnOdf7ML64BOt1SamHKj1j4yAJe+6v5MYlGwZCoyZ643ophODyzaBZyQ+yXwziCUs Q41MAyWszttX7TlwChlzv+p1PehN6+2qc9WNYu1k66zLgp+IL/vtJ130qwoGW7WoB5Ww c2HOy/Sg70IMdNoYjKeOm90nmU23GkKXj6DFIRq69QV5KzmfN0215GWNYBYmyIU/4WTp j9fg== 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:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature; bh=Mhbbs/5zWDmSATWlWIaWSZbJKp7jJqyJaP5TnNMG0Cw=; b=sxvaIcx+YAFjiwCwPH7zJe4xYW4fKhsQaEkKCRwTUp5gu7ZrX+w+IXHRsSq/Gppt+c 5oTBK38dd13Yow8gOtzwOKmMjdco7tSKNTtdTtIQUReQG3LpIAsQoM4EaRXpArHuyWnb UY9ju+uBKj9kOMBcEWF1jryQY19cTu7iZKYj+lUQWhFY7BUnIHrCJMLGoMkEGCnC8SZS LJ4LMzWqcZvQli9F1lZsUFbs72DZau0BEpbYBFXGWnqW/ncCK/jwixCygRYMC2/X1Zt5 FLd2hdoQ5m88CsidZCzhYKOWblNWzXyyLVI+s0zYNEeOggYUTjTio5VsU9xrk6fgMN91 udWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=qADd6C9d; 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 q6si25420875pll.226.2019.05.29.08.55.01; Wed, 29 May 2019 08:55:16 -0700 (PDT) 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; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=qADd6C9d; 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 S1727135AbfE2Pxy (ORCPT + 99 others); Wed, 29 May 2019 11:53:54 -0400 Received: from sonic303-8.consmr.mail.bf2.yahoo.com ([74.6.131.47]:38687 "EHLO sonic303-8.consmr.mail.bf2.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727074AbfE2Pxx (ORCPT ); Wed, 29 May 2019 11:53:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1559145231; bh=Mhbbs/5zWDmSATWlWIaWSZbJKp7jJqyJaP5TnNMG0Cw=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=qADd6C9dYyk8KS/JPMsgMG4dSY02lpjCx3eUrn3i8pPoaQZwpwXVOaljGU9u5kB8KHIYPQa9JunT+waccGB55AKFbHuWiQXTLZPfIlOsadSGQWce4R8t5X7yVT3Rxip9j60HgY+G4hVU3/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zHp84kOK1WI7XpTndmJWWe KZOFTdqexV20nvXFEQ8PE0LeK.bjAmHvNwVoKuIiK.PV14pYo_G2SuNRSvYLJ3nhOwW.Y2hx6iZL uIkmj9ZaCEHEdFh0EZHvnY7BoZFTkC2_Dw4mQZ5JDZ_GXOpzoUqK1E0n8NufYZIJ0iB7GMHHS7tW Dp8KhOPlS9WCtb_vXu0v7GLez3rS9Qv8W14odbSUUBpPbCmTBY5hqlaY3kPwBCK5uBzxN5C3wly2 Sl75ILGM34._zWV818b0wwUVtYf692GLllUWrHdN1WZf.Ad3NxwLrBv8kAeRnUCjohfWVyxZqe93 Yj5UeurORKiMUBmXBc2Wja6QWyR0bvHk5BbvMIwgY7A0C._nmVF9mZxJH9tT3jpJwIjPFfQOhM18 mJOFCgs_8nJ2ch1wn6DSN4AE1IiERihrII.S3iQ-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.bf2.yahoo.com with HTTP; Wed, 29 May 2019 15:53:51 +0000 Received: from c-73-223-4-185.hsd1.ca.comcast.net (EHLO [192.168.0.103]) ([73.223.4.185]) by smtp410.mail.bf1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 9da4e0a2a8856f6c7fc42e042e64d391; Wed, 29 May 2019 15:53:47 +0000 (UTC) Subject: Re: [PATCH 3/7] vfs: Add a mount-notification facility To: David Howells , Jann Horn Cc: Al Viro , raven@themaw.net, linux-fsdevel , Linux API , linux-block@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module , kernel list References: <155905930702.7587.7100265859075976147.stgit@warthog.procyon.org.uk> <155905933492.7587.6968545866041839538.stgit@warthog.procyon.org.uk> <14347.1559127657@warthog.procyon.org.uk> From: Casey Schaufler Openpgp: preference=signencrypt Autocrypt: addr=casey@schaufler-ca.com; keydata= mQINBFzV9HABEAC/mmv3jeJyF7lR7QhILYg1+PeBLIMZv7KCzBSc/4ZZipoWdmr77Lel/RxQ 1PrNx0UaM5r6Hj9lJmJ9eg4s/TUBSP67mTx+t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kJq/uLNMvABEBAAGJAjwEGAEIACYWIQQL720fVjJTAhDNQh44pRV8jEPI EQUCXNX0cAIbDAUJEswDAAAKCRA4pRV8jEPIEWkzEACKFUnpp+wIVHpckMfBqN8BE5dUbWJc GyQ7wXWajLtlPdw1nNw0Wrv+ob2RCT7qQlUo6GRLcvj9Fn5tR4hBvR6D3m8aR0AGHbcC62cq I7LjaSDP5j/em4oVL2SMgNTrXgE2w33JMGjAx9oBzkxmKUqprhJomPwmfDHMJ0t7y39Da724 oLPTkQDpJL1kuraM9TC5NyLe1+MyIxqM/8NujoJbWeQUgGjn9uxQAil7o/xSCjrWCP3kZDID vd5ZaHpdl8e1mTExQoKr4EWgaMjmD/a3hZ/j3KfTVNpM2cLfD/QwTMaC2fkK8ExMsz+rUl1H icmcmpptCwOSgwSpPY1Zfio6HvEJp7gmDwMgozMfwQuT9oxyFTxn1X3rn1IoYQF3P8gsziY5 qtTxy2RrgqQFm/hr8gM78RhP54UPltIE96VywviFzDZehMvuwzW//fxysIoK97Y/KBZZOQs+ /T+Bw80Pwk/dqQ8UmIt2ffHEgwCTbkSm711BejapWCfklxkMZDp16mkxSt2qZovboVjXnfuq wQ1QL4o4t1hviM7LyoflsCLnQFJh6RSBhBpKQinMJl/z0A6NYDkQi6vEGMDBWX/M2vk9Jvwa v0cEBfY3Z5oFgkh7BUORsu1V+Hn0fR/Lqq/Pyq+nTR26WzGDkolLsDr3IH0TiAVH5ZuPxyz6 abzjfg== Message-ID: <312a138c-e5b2-4bfb-b50b-40c82c55773f@schaufler-ca.com> Date: Wed, 29 May 2019 08:53:34 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <14347.1559127657@warthog.procyon.org.uk> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="cNkJJFaLGPzGj0MrH4stT0km9ovmzGP9Z" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --cNkJJFaLGPzGj0MrH4stT0km9ovmzGP9Z Content-Type: multipart/mixed; boundary="CGJ0IeN7E9pxspTs8jkc4kNwow51RM68Y"; protected-headers="v1" From: Casey Schaufler To: David Howells , Jann Horn Cc: Al Viro , raven@themaw.net, linux-fsdevel , Linux API , linux-block@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module , kernel list Message-ID: <312a138c-e5b2-4bfb-b50b-40c82c55773f@schaufler-ca.com> Subject: Re: [PATCH 3/7] vfs: Add a mount-notification facility References: <155905930702.7587.7100265859075976147.stgit@warthog.procyon.org.uk> <155905933492.7587.6968545866041839538.stgit@warthog.procyon.org.uk> <14347.1559127657@warthog.procyon.org.uk> In-Reply-To: <14347.1559127657@warthog.procyon.org.uk> --CGJ0IeN7E9pxspTs8jkc4kNwow51RM68Y Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-US On 5/29/2019 4:00 AM, David Howells wrote: > Jann Horn wrote: > >>> +void post_mount_notification(struct mount *changed, >>> + struct mount_notification *notify) >>> +{ >>> + const struct cred *cred =3D current_cred(); >> This current_cred() looks bogus to me. Can't mount topology changes >> come from all sorts of places? For example, umount_mnt() from >> umount_tree() from dissolve_on_fput() from __fput(), which could >> happen pretty much anywhere depending on where the last reference gets= >> dropped? > IIRC, that's what Casey argued is the right thing to do from a security= PoV. > Casey? You need to identify the credential of the subject that triggered the event. If it isn't current_cred(), the cred needs to be passed in to post_mount_notification(), or derived by some other means. > Maybe I should pass in NULL creds in the case that an event is being ge= nerated > because an object is being destroyed due to the last usage[*] being rem= oved. You should pass the cred of the process that removed the last usage. If the last usage was removed by something like the power being turned off on a disk drive a system cred should be used. Someone or something caused the event. It can be important who it was. > [*] Usage, not ref - Superblocks are a bit weird in their accounting. > > David --CGJ0IeN7E9pxspTs8jkc4kNwow51RM68Y-- --cNkJJFaLGPzGj0MrH4stT0km9ovmzGP9Z Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEC+9tH1YyUwIQzUIeOKUVfIxDyBEFAlzuqwkACgkQOKUVfIxD yBEWag//SJA6JpQHXqyOeXOtCod82vVguKxz7q2fheSMMS+T8bB0rX2XTO4rho9D t5wUt9c1+HtGk8HBvbS7vOnjhXso6RshvI2uUEfE0MOQ/Y1FBIqXwrTzpSs8/FVE tv3YFqCWlcaLOfnh/Gl0GvK+o5DGMVFDVsv0j3ke5VihJ4enHnn18AncowE5nVu3 n9GahTQcWaRIgYIHJ9Wr0olwAQsa2TQpj/0wJR3I5ni1hY10wknm9jCIw2L612xU l5rZ73EqvgIjqsq9m1rgZqjH3QypYvTgdDCd9I/AdZmAI8QJ3JISRzZlKGw2o6GL ZIExEzQCVMzGyqEDkTxQQlXjczfF7jHCWQ9+iyyz747JMRrx1Kr6LqZlTJsfQCc0 F+Ytx0D8RVkwkpkrzIQz5eS/R2ib2lYH7Jtk9RhreDagrzkieeyZ3A3Y0feYqIb3 O7tGYBfQVWx5dVjB5nZ7v/aUw7Wc929yiONfiHLxSg8U4xlj0mFSa0HFOYC4DzaG C0NSVb7xvoDfpyt6m9Wv1mF7cJKkLFffeMfqUREZAcNEdiYrg90Ho6cJ5tZVreSu rVgR81R7SSVANygbfauj9X3N3D4fsWxu+D81zz0B9CBgy8GP+p/kWrL45hRC4CLN hG3yC60hUm54xq2H3YT775eyGBcDixyPsh5qmTXQ21MtLLm3W1c= =qEff -----END PGP SIGNATURE----- --cNkJJFaLGPzGj0MrH4stT0km9ovmzGP9Z--