Re: [RFC][PATCH 2/4] lsm: Add missing return values doc in lsm_hooks.h and fix formatting

From: Paul Moore
Date: Tue Nov 15 2022 - 21:23:18 EST


On Tue, Nov 15, 2022 at 12:57 PM Roberto Sassu
<roberto.sassu@xxxxxxxxxxxxxxx> wrote:
>
> From: Roberto Sassu <roberto.sassu@xxxxxxxxxx>
>
> Ensure that for non-void LSM hooks there is a description of the return
> values. Also replace spaces with tab for indentation, remove empty lines
> between the hook description and the list of parameters and add the period
> at the end of the parameter description.
>
> Finally, replace the description of the sb_parse_opts_str hook, which was
> removed with commit 757cbe597fe8 ("LSM: new method: ->sb_add_mnt_opt()"),
> with one for the new hook sb_add_mnt_opt.
>
> Signed-off-by: Roberto Sassu <roberto.sassu@xxxxxxxxxx>
> ---
> include/linux/lsm_hooks.h | 123 ++++++++++++++++++++++++++------------
> 1 file changed, 86 insertions(+), 37 deletions(-)

...

> diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
> index f40b82ca91e7..c0c570b7eabd 100644
> --- a/include/linux/lsm_hooks.h
> +++ b/include/linux/lsm_hooks.h
> @@ -176,18 +183,22 @@
> * Set the security relevant mount options used for a superblock
> * @sb the superblock to set security mount options for
> * @opts binary data structure containing all lsm mount data
> + * Return 0 on success, error on failure.
> * @sb_clone_mnt_opts:
> * Copy all security options from a given superblock to another
> * @oldsb old superblock which contain information to clone
> * @newsb new superblock which needs filled in
> - * @sb_parse_opts_str:
> - * Parse a string of security data filling in the opts structure
> - * @options string containing all mount options known by the LSM
> - * @opts binary data structure usable by the LSM
> + * Return 0 on success, error on failure.
> + * @add_mnt_opt:
> + * Add a new mount option @option with value @val and length @len to the
> + * existing mount options @mnt_opts.
> + * Return 0 if the option was successfully added, a negative value
> + * otherwise.

I really appreciate the effort to improve the LSM hook comments/docs,
but the "sb_add_mnt_opt" hook was removed in 52f982f00b22
("security,selinux: remove security_add_mnt_opt()").

--
paul-moore.com