Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp446824imj; Thu, 7 Feb 2019 06:47:34 -0800 (PST) X-Google-Smtp-Source: AHgI3IYtDy1VcmpJn4G27t0G1yCOTDD3BAK8GTIt3u8qKASeFxRvwAw0+0U+nI1uWmB+4/L3uYFF X-Received: by 2002:a65:6684:: with SMTP id b4mr388607pgw.55.1549550854898; Thu, 07 Feb 2019 06:47:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549550854; cv=none; d=google.com; s=arc-20160816; b=it2hjm3vbNhYRhoAgENeEZGbUrjiVkLjowZ70TmoV6D6CI7SKDF27DzIv9Eb81VtzM e9SoRuzigVZeaNzclSUX2+jnee+zPSrlry8c+DFxilxccXZBJGF6DN1w++jKA25ko0TH /8xzDrMmoebvsZCNWFdu0XZs6TBNEdR7TX1cOTKtWvXypwtDT289gK40xggaTurz5KI1 AzXI2Eb3KSXOlliEjXu6A+hMvrKMBiKtaP8kUco3T39iTZ6fxpdOwJHvKJUzO5EfIDgG 0gnIKvQZQM/EBTO0pr6FOyi7K7xwWj0lJbqmIc+uGzRmn/TMNFJZ9F+FmrEolYhDyoH9 KQ0w== 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=Lo0pE/LdIa5XCTfkmhSar4AbrYJUpqijxx3CUCnv9ic=; b=UXltqMtSmMbNcOdVur5R4aCc9fRwL/FPGZI9Yf+vMQmeL7bZwh2yc1LwXXDJMPe8bS gJpsEBs5LECg7onKvnq8zifKbhdEaFX9TpsMue8i/hlb2+X58DE1vmMnXYeKKY52AI1k 53W8zMJQa5lBpjY4dDi+/FmxnR9mrA0x03AhUAGPsAxzVZFkBBz89GM32OLJC4jgI0XH N9KcnYnllhXywJTcJBdFGCTl8XPQWLlzh99M0dPdtyF6mnOnE5RzTWpCvPTcW6tX96BG LN4REmWDljrTUJJZwA9TfDfdF/BqKKcc79fo/kWIWCzwYH+KYqhAziVQevxgbv03eoBq c77Q== 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 i190si9663257pfc.116.2019.02.07.06.47.18; Thu, 07 Feb 2019 06:47:34 -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 S1727041AbfBGOrJ (ORCPT + 99 others); Thu, 7 Feb 2019 09:47:09 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:37270 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726558AbfBGOrJ (ORCPT ); Thu, 7 Feb 2019 09:47:09 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.91 #2 (Red Hat Linux)) id 1grkx5-0006BS-2t; Thu, 07 Feb 2019 14:46:55 +0000 Date: Thu, 7 Feb 2019 14:46:55 +0000 From: Al Viro To: Edwin Zimmerman Cc: 'Denis Efremov' , 'Casey Schaufler' , "'Eric W. Biederman'" , 'Eric Paris' , 'Kees Cook' , 'John Johansen' , 'James Morris' , "'Serge E. Hallyn'" , 'Paul Moore' , 'Kentaro Takeda' , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 06/10] security: fix documentation for the path_chmod hook Message-ID: <20190207144654.GB2217@ZenIV.linux.org.uk> References: <0275d06334cdb1d2a87384d7971924a70776b3cb.1549540487.git.efremov@ispras.ru> <20190207134939.GA2217@ZenIV.linux.org.uk> <000001d4beee$caa8eff0$5ffacfd0$@211mainstreet.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000001d4beee$caa8eff0$5ffacfd0$@211mainstreet.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 07, 2019 at 09:09:49AM -0500, Edwin Zimmerman wrote: > > > diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h > > > index cb93972257be..5d6428d0027b 100644 > > > --- a/include/linux/lsm_hooks.h > > > +++ b/include/linux/lsm_hooks.h > > > @@ -304,8 +304,7 @@ > > > * Return 0 if permission is granted. > > > * @path_chmod: > > > * Check for permission to change DAC's permission of a file or directory. > > > - * @dentry contains the dentry structure. > > > - * @mnt contains the vfsmnt structure. > > > + * @path contains the path structure. > > > > May I politely inquire about the value of these comments? How much information > > is provided by refering to an argument as "the dentry structure" or "the path > > structure", especially when there's nothing immediately above that would introduce > > either. "Type of 'dentry' argument is somehow related to struct dentry, > > try and guess what the value might be - we don't care, we just need every > > argument commented"? > > > > Who needs that crap in the first place? > > The comments fill a valuable place to folks like me who are new to the linux security modules. > In my spare time, I'm writing a new LSM specifically geared for parental controls uses, and the > comments in lsm_hooks.h have helped me out more than once. Perhaps the comments could > be inproved by changing them to something like this: > "@[arg] contains the [type] structure, defined in linux/[?].h" Um... The _type_ of argument is visible in declaration already; it doesn't say a damn thing about the value of that argument. In this particular case, dentry/mnt pair (whichever way it gets passed; struct path is exactly such a pair) is actually used to specify the location of file or directory in question, but try to guess that by description given in this "documentation"... As for "defined in"... that's what grep/ctags/etc. are for. Again, the useful information about an argument is _what_ gets passed in it, not just which type it is...