All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Smack: Restore the smackfsdef mount option
@ 2019-05-20 22:48 Casey Schaufler
  2019-05-21 22:25 ` Casey Schaufler
  2019-05-28 12:23 ` David Howells
  0 siblings, 2 replies; 9+ messages in thread
From: Casey Schaufler @ 2019-05-20 22:48 UTC (permalink / raw)
  To: LKML, Al Viro, dhowells; +Cc: jose.bollo, casey, Linux Security Module list

The 5.1 mount system rework changed the smackfsdef mount option
to smackfsdefault. This fixes the regression by making smackfsdef
treated the same way as smackfsdefault. The change was made in
commit c3300aaf95fb4 from Al Viro.

Reported-by: Jose Bollo <jose.bollo@iot.bzh>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
---
  security/smack/smack_lsm.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index b9abcdb36a73..915cf598e164 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -68,6 +68,7 @@ static struct {
  	int len;
  	int opt;
  } smk_mount_opts[] = {
+	{"smackfsdef", sizeof("smackfsdef") - 1, Opt_fsdefault},
  	A(fsdefault), A(fsfloor), A(fshat), A(fsroot), A(fstransmute)
  };
  #undef A
@@ -682,6 +683,7 @@ static int smack_fs_context_dup(struct fs_context *fc,
  }
  
  static const struct fs_parameter_spec smack_param_specs[] = {
+	fsparam_string("fsdef",		Opt_fsdefault),
  	fsparam_string("fsdefault",	Opt_fsdefault),
  	fsparam_string("fsfloor",	Opt_fsfloor),
  	fsparam_string("fshat",		Opt_fshat),


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] Smack: Restore the smackfsdef mount option
  2019-05-20 22:48 [PATCH] Smack: Restore the smackfsdef mount option Casey Schaufler
@ 2019-05-21 22:25 ` Casey Schaufler
  2019-05-28 12:23 ` David Howells
  1 sibling, 0 replies; 9+ messages in thread
From: Casey Schaufler @ 2019-05-21 22:25 UTC (permalink / raw)
  To: LKML, Al Viro, dhowells; +Cc: jose.bollo, Linux Security Module list

On 5/20/2019 3:48 PM, Casey Schaufler wrote:
> The 5.1 mount system rework changed the smackfsdef mount option
> to smackfsdefault. This fixes the regression by making smackfsdef
> treated the same way as smackfsdefault. The change was made in
> commit c3300aaf95fb4 from Al Viro.
>
> Reported-by: Jose Bollo <jose.bollo@iot.bzh>
> Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>

Al, Dave, is this patch in keeping with the intent
of the mount rework? Is there a different way I should
do it? Do you want to take it as a fix for the mount
work, or should I push it?

Thank you.

> ---
> ??security/smack/smack_lsm.c | 2 ++
> ??1 file changed, 2 insertions(+)
>
> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
> index b9abcdb36a73..915cf598e164 100644
> --- a/security/smack/smack_lsm.c
> +++ b/security/smack/smack_lsm.c
> @@ -68,6 +68,7 @@ static struct {
> ???????? int len;
> ???????? int opt;
> ??} smk_mount_opts[] = {
> +?????? {"smackfsdef", sizeof("smackfsdef") - 1, Opt_fsdefault},
> ???????? A(fsdefault), A(fsfloor), A(fshat), A(fsroot), A(fstransmute)
> ??};
> ??#undef A
> @@ -682,6 +683,7 @@ static int smack_fs_context_dup(struct fs_context 
> *fc,
> ??}
>
> ??static const struct fs_parameter_spec smack_param_specs[] = {
> +?????? fsparam_string("fsdef",?????????????? Opt_fsdefault),
> ???????? fsparam_string("fsdefault",?????? Opt_fsdefault),
> ???????? fsparam_string("fsfloor",?????? Opt_fsfloor),
> ???????? fsparam_string("fshat",?????????????? Opt_fshat),
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Smack: Restore the smackfsdef mount option
  2019-05-20 22:48 [PATCH] Smack: Restore the smackfsdef mount option Casey Schaufler
  2019-05-21 22:25 ` Casey Schaufler
@ 2019-05-28 12:23 ` David Howells
  2019-05-28 15:51   ` Casey Schaufler
  2019-05-28 16:22   ` David Howells
  1 sibling, 2 replies; 9+ messages in thread
From: David Howells @ 2019-05-28 12:23 UTC (permalink / raw)
  To: Casey Schaufler
  Cc: dhowells, LKML, Al Viro, jose.bollo, Linux Security Module list

Casey Schaufler <casey@schaufler-ca.com> wrote:

> The change was made in commit c3300aaf95fb4 from Al Viro.

This should be in a "Fixes:" tag?

> +	fsparam_string("fsdef",		Opt_fsdefault),
>  	fsparam_string("fsdefault",	Opt_fsdefault),
>  	fsparam_string("fsfloor",	Opt_fsfloor),
>  	fsparam_string("fshat",		Opt_fshat),

Would it be better to delete the "fsdefault" line?

Also, should all of these be prefixed with "smack"?  So:

  	fsparam_string("smackfsdef",	Opt_fsdefault),
  	fsparam_string("smackfsfloor",	Opt_fsfloor),
  	fsparam_string("smackfshat",	Opt_fshat),	

David

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Smack: Restore the smackfsdef mount option
  2019-05-28 12:23 ` David Howells
@ 2019-05-28 15:51   ` Casey Schaufler
  2019-05-28 16:22   ` David Howells
  1 sibling, 0 replies; 9+ messages in thread
From: Casey Schaufler @ 2019-05-28 15:51 UTC (permalink / raw)
  To: David Howells
  Cc: LKML, Al Viro, jose.bollo, Linux Security Module list, casey

On 5/28/2019 5:23 AM, David Howells wrote:
> Casey Schaufler <casey@schaufler-ca.com> wrote:
>
>> The change was made in commit c3300aaf95fb4 from Al Viro.
> This should be in a "Fixes:" tag?

Thanks. I wasn't sure how to properly apply that.

>
>> +	fsparam_string("fsdef",		Opt_fsdefault),
>>  	fsparam_string("fsdefault",	Opt_fsdefault),
>>  	fsparam_string("fsfloor",	Opt_fsfloor),
>>  	fsparam_string("fshat",		Opt_fshat),
> Would it be better to delete the "fsdefault" line?

If it hadn't slipped into the 5.1 release I would
say to remove it, but now it would be a regression.

>
> Also, should all of these be prefixed with "smack"?  So:
>
>   	fsparam_string("smackfsdef",	Opt_fsdefault),
>   	fsparam_string("smackfsfloor",	Opt_fsfloor),
>   	fsparam_string("smackfshat",	Opt_fshat),	

No. smack_fs_parameters takes care of that.

>
> David


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Smack: Restore the smackfsdef mount option
  2019-05-28 12:23 ` David Howells
  2019-05-28 15:51   ` Casey Schaufler
@ 2019-05-28 16:22   ` David Howells
  2019-05-28 16:41     ` Casey Schaufler
  2019-05-28 18:54     ` David Howells
  1 sibling, 2 replies; 9+ messages in thread
From: David Howells @ 2019-05-28 16:22 UTC (permalink / raw)
  To: Casey Schaufler
  Cc: dhowells, LKML, Al Viro, jose.bollo, Linux Security Module list

Casey Schaufler <casey@schaufler-ca.com> wrote:

> > Also, should all of these be prefixed with "smack"?  So:
> >
> >   	fsparam_string("smackfsdef",	Opt_fsdefault),
> >   	fsparam_string("smackfsfloor",	Opt_fsfloor),
> >   	fsparam_string("smackfshat",	Opt_fshat),	
> 
> No. smack_fs_parameters takes care of that.

It does?  *Blink*.

smack_fs_parameters.name is just for decorating messages, if that's what
you're looking at.

David

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Smack: Restore the smackfsdef mount option
  2019-05-28 16:22   ` David Howells
@ 2019-05-28 16:41     ` Casey Schaufler
  2019-05-28 18:54     ` David Howells
  1 sibling, 0 replies; 9+ messages in thread
From: Casey Schaufler @ 2019-05-28 16:41 UTC (permalink / raw)
  To: David Howells
  Cc: LKML, Al Viro, jose.bollo, Linux Security Module list, casey

On 5/28/2019 9:22 AM, David Howells wrote:
> Casey Schaufler <casey@schaufler-ca.com> wrote:
>
>>> Also, should all of these be prefixed with "smack"?  So:
>>>
>>>   	fsparam_string("smackfsdef",	Opt_fsdefault),
>>>   	fsparam_string("smackfsfloor",	Opt_fsfloor),
>>>   	fsparam_string("smackfshat",	Opt_fshat),	
>> No. smack_fs_parameters takes care of that.
> It does?  *Blink*.

Well, something does. I can't say that I 100% understand all
of how the new mount code handles the mount options. Y'all made
sweeping changes, and the code works the way it used to except
for the awkward change from smackfsdef to smackfsdefault. It
took no small amount of head scratching and experimentation to
convince myself that the fix I proposed was correct.

>
> smack_fs_parameters.name is just for decorating messages, if that's what
> you're looking at.
>
> David


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Smack: Restore the smackfsdef mount option
  2019-05-28 16:22   ` David Howells
  2019-05-28 16:41     ` Casey Schaufler
@ 2019-05-28 18:54     ` David Howells
  2019-05-28 19:57       ` Casey Schaufler
  1 sibling, 1 reply; 9+ messages in thread
From: David Howells @ 2019-05-28 18:54 UTC (permalink / raw)
  To: Casey Schaufler
  Cc: dhowells, LKML, Al Viro, jose.bollo, Linux Security Module list

Casey Schaufler <casey@schaufler-ca.com> wrote:

> > Casey Schaufler <casey@schaufler-ca.com> wrote:
> >
> >>> Also, should all of these be prefixed with "smack"?  So:
> >>>
> >>>   	fsparam_string("smackfsdef",	Opt_fsdefault),
> >>>   	fsparam_string("smackfsfloor",	Opt_fsfloor),
> >>>   	fsparam_string("smackfshat",	Opt_fshat),	
> >> No. smack_fs_parameters takes care of that.
> > It does?  *Blink*.
> 
> Well, something does. I can't say that I 100% understand all
> of how the new mount code handles the mount options. Y'all made
> sweeping changes, and the code works the way it used to except
> for the awkward change from smackfsdef to smackfsdefault. It
> took no small amount of head scratching and experimentation to
> convince myself that the fix I proposed was correct.

Ah...  I suspect the issue is that smack_sb_eat_lsm_opts() strips the prefix
for an unconverted filesystem, but smack_fs_context_parse_param() doesn't
(which it shouldn't).

Can you try grabbing my mount-api-viro branch from:

	https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git

and testing setting smack options on a tmpfs filesystem?

You might need to try modifying samples/vfs/test-fsmount.c to make it mount a
trmpfs filesystem through the new mount UAPI.

David

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Smack: Restore the smackfsdef mount option
  2019-05-28 18:54     ` David Howells
@ 2019-05-28 19:57       ` Casey Schaufler
  2019-05-28 20:24         ` Casey Schaufler
  0 siblings, 1 reply; 9+ messages in thread
From: Casey Schaufler @ 2019-05-28 19:57 UTC (permalink / raw)
  To: David Howells; +Cc: LKML, Al Viro, jose.bollo, Linux Security Module list

On 5/28/2019 11:54 AM, David Howells wrote:
> Casey Schaufler <casey@schaufler-ca.com> wrote:
>
>>> Casey Schaufler <casey@schaufler-ca.com> wrote:
>>>
>>>>> Also, should all of these be prefixed with "smack"?  So:
>>>>>
>>>>>   	fsparam_string("smackfsdef",	Opt_fsdefault),
>>>>>   	fsparam_string("smackfsfloor",	Opt_fsfloor),
>>>>>   	fsparam_string("smackfshat",	Opt_fshat),	
>>>> No. smack_fs_parameters takes care of that.
>>> It does?  *Blink*.
>> Well, something does. I can't say that I 100% understand all
>> of how the new mount code handles the mount options. Y'all made
>> sweeping changes, and the code works the way it used to except
>> for the awkward change from smackfsdef to smackfsdefault. It
>> took no small amount of head scratching and experimentation to
>> convince myself that the fix I proposed was correct.
> Ah...  I suspect the issue is that smack_sb_eat_lsm_opts() strips the prefix
> for an unconverted filesystem, but smack_fs_context_parse_param() doesn't
> (which it shouldn't).
>
> Can you try grabbing my mount-api-viro branch from:
>
> 	https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git
>
> and testing setting smack options on a tmpfs filesystem?

My fedora system won't boot because smackfsdef isn't recognized. :(
I will put in my fix and retry.

>
> You might need to try modifying samples/vfs/test-fsmount.c to make it mount a
> trmpfs filesystem through the new mount UAPI.
>
> David

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Smack: Restore the smackfsdef mount option
  2019-05-28 19:57       ` Casey Schaufler
@ 2019-05-28 20:24         ` Casey Schaufler
  0 siblings, 0 replies; 9+ messages in thread
From: Casey Schaufler @ 2019-05-28 20:24 UTC (permalink / raw)
  To: David Howells
  Cc: LKML, Al Viro, jose.bollo, Linux Security Module list, casey

On 5/28/2019 12:57 PM, Casey Schaufler wrote:
> On 5/28/2019 11:54 AM, David Howells wrote:
>> Casey Schaufler <casey@schaufler-ca.com> wrote:
>>
>>>> Casey Schaufler <casey@schaufler-ca.com> wrote:
>>>>
>>>>>> Also, should all of these be prefixed with "smack"?  So:
>>>>>>
>>>>>>   	fsparam_string("smackfsdef",	Opt_fsdefault),
>>>>>>   	fsparam_string("smackfsfloor",	Opt_fsfloor),
>>>>>>   	fsparam_string("smackfshat",	Opt_fshat),	
>>>>> No. smack_fs_parameters takes care of that.
>>>> It does?  *Blink*.
>>> Well, something does. I can't say that I 100% understand all
>>> of how the new mount code handles the mount options. Y'all made
>>> sweeping changes, and the code works the way it used to except
>>> for the awkward change from smackfsdef to smackfsdefault. It
>>> took no small amount of head scratching and experimentation to
>>> convince myself that the fix I proposed was correct.
>> Ah...  I suspect the issue is that smack_sb_eat_lsm_opts() strips the prefix
>> for an unconverted filesystem, but smack_fs_context_parse_param() doesn't
>> (which it shouldn't).
>>
>> Can you try grabbing my mount-api-viro branch from:
>>
>> 	https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git
>>
>> and testing setting smack options on a tmpfs filesystem?
> My fedora system won't boot because smackfsdef isn't recognized. :(
> I will put in my fix and retry.

No joy there, either. Now it accepts smackfsdef, but doesn't
recognize smackfsroot. I don't have this problem with vanilla
5.1.

>
>> You might need to try modifying samples/vfs/test-fsmount.c to make it mount a
>> trmpfs filesystem through the new mount UAPI.
>>
>> David


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-05-28 20:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-20 22:48 [PATCH] Smack: Restore the smackfsdef mount option Casey Schaufler
2019-05-21 22:25 ` Casey Schaufler
2019-05-28 12:23 ` David Howells
2019-05-28 15:51   ` Casey Schaufler
2019-05-28 16:22   ` David Howells
2019-05-28 16:41     ` Casey Schaufler
2019-05-28 18:54     ` David Howells
2019-05-28 19:57       ` Casey Schaufler
2019-05-28 20:24         ` Casey Schaufler

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.