All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ima: Reflect correct permissions for policy
@ 2018-04-20 13:28 Petr Vorel
  2018-05-07 21:00 ` Mimi Zohar
  2018-05-16 21:34 ` Mimi Zohar
  0 siblings, 2 replies; 4+ messages in thread
From: Petr Vorel @ 2018-04-20 13:28 UTC (permalink / raw)
  To: linux-integrity; +Cc: Petr Vorel, Mimi Zohar

Kernel configured as CONFIG_IMA_READ_POLICY=y && CONFIG_IMA_WRITE_POLICY=n
keeps 0600 mode after loading policy. Remove write permission to state
that policy file no longer be written.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 security/integrity/ima/ima_fs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c
index fa540c0469da..c1265127d1b6 100644
--- a/security/integrity/ima/ima_fs.c
+++ b/security/integrity/ima/ima_fs.c
@@ -434,6 +434,8 @@ static int ima_release_policy(struct inode *inode, struct file *file)
 	ima_policy = NULL;
 #elif defined(CONFIG_IMA_WRITE_POLICY)
 	clear_bit(IMA_FS_BUSY, &ima_fs_flags);
+#elif defined(CONFIG_IMA_READ_POLICY)
+	inode->i_mode &= ~S_IWUSR;
 #endif
 	return 0;
 }
-- 
2.12.3

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

* Re: [PATCH] ima: Reflect correct permissions for policy
  2018-04-20 13:28 [PATCH] ima: Reflect correct permissions for policy Petr Vorel
@ 2018-05-07 21:00 ` Mimi Zohar
  2018-05-16 21:34 ` Mimi Zohar
  1 sibling, 0 replies; 4+ messages in thread
From: Mimi Zohar @ 2018-05-07 21:00 UTC (permalink / raw)
  To: Petr Vorel, linux-integrity

On Fri, 2018-04-20 at 15:28 +0200, Petr Vorel wrote:
> Kernel configured as CONFIG_IMA_READ_POLICY=y && CONFIG_IMA_WRITE_POLICY=n
> keeps 0600 mode after loading policy. Remove write permission to state
> that policy file no longer be written.
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>

Queued in the next-integrity branch.

thanks,

Mimi
> ---
>  security/integrity/ima/ima_fs.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c
> index fa540c0469da..c1265127d1b6 100644
> --- a/security/integrity/ima/ima_fs.c
> +++ b/security/integrity/ima/ima_fs.c
> @@ -434,6 +434,8 @@ static int ima_release_policy(struct inode *inode, struct file *file)
>  	ima_policy = NULL;
>  #elif defined(CONFIG_IMA_WRITE_POLICY)
>  	clear_bit(IMA_FS_BUSY, &ima_fs_flags);
> +#elif defined(CONFIG_IMA_READ_POLICY)
> +	inode->i_mode &= ~S_IWUSR;
>  #endif
>  	return 0;
>  }

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

* Re: [PATCH] ima: Reflect correct permissions for policy
  2018-04-20 13:28 [PATCH] ima: Reflect correct permissions for policy Petr Vorel
  2018-05-07 21:00 ` Mimi Zohar
@ 2018-05-16 21:34 ` Mimi Zohar
  2018-05-18 14:45   ` Petr Vorel
  1 sibling, 1 reply; 4+ messages in thread
From: Mimi Zohar @ 2018-05-16 21:34 UTC (permalink / raw)
  To: Petr Vorel, linux-integrity; +Cc: Matthew Garrett

Hi Peter,

On Fri, 2018-04-20 at 15:28 +0200, Petr Vorel wrote:
> Kernel configured as CONFIG_IMA_READ_POLICY=y && CONFIG_IMA_WRITE_POLICY=n
> keeps 0600 mode after loading policy. Remove write permission to state
> that policy file no longer be written.
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  security/integrity/ima/ima_fs.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c
> index fa540c0469da..c1265127d1b6 100644
> --- a/security/integrity/ima/ima_fs.c
> +++ b/security/integrity/ima/ima_fs.c
> @@ -434,6 +434,8 @@ static int ima_release_policy(struct inode *inode, struct file *file)
>  	ima_policy = NULL;
>  #elif defined(CONFIG_IMA_WRITE_POLICY)
>  	clear_bit(IMA_FS_BUSY, &ima_fs_flags);
> +#elif defined(CONFIG_IMA_READ_POLICY)
> +	inode->i_mode &= ~S_IWUSR;
>  #endif
>  	return 0;
>  }

Thinking about this again, do we need to take the i_rwsem lock and
call simple_setattr() as Matthew did in "EVM: Allow runtime
modification of the set of verified xattrs"?

thanks,

Mimi

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

* Re: [PATCH] ima: Reflect correct permissions for policy
  2018-05-16 21:34 ` Mimi Zohar
@ 2018-05-18 14:45   ` Petr Vorel
  0 siblings, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2018-05-18 14:45 UTC (permalink / raw)
  To: Mimi Zohar; +Cc: linux-integrity, Matthew Garrett

Hi Mimi, Matthew,

> Hi Peter,

> On Fri, 2018-04-20 at 15:28 +0200, Petr Vorel wrote:
> > Kernel configured as CONFIG_IMA_READ_POLICY=y && CONFIG_IMA_WRITE_POLICY=n
> > keeps 0600 mode after loading policy. Remove write permission to state
> > that policy file no longer be written.

> > Signed-off-by: Petr Vorel <pvorel@suse.cz>
> > ---
> >  security/integrity/ima/ima_fs.c | 2 ++
> >  1 file changed, 2 insertions(+)

> > diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c
> > index fa540c0469da..c1265127d1b6 100644
> > --- a/security/integrity/ima/ima_fs.c
> > +++ b/security/integrity/ima/ima_fs.c
> > @@ -434,6 +434,8 @@ static int ima_release_policy(struct inode *inode, struct file *file)
> >  	ima_policy = NULL;
> >  #elif defined(CONFIG_IMA_WRITE_POLICY)
> >  	clear_bit(IMA_FS_BUSY, &ima_fs_flags);
> > +#elif defined(CONFIG_IMA_READ_POLICY)
> > +	inode->i_mode &= ~S_IWUSR;
> >  #endif
> >  	return 0;
> >  }

> Thinking about this again, do we need to take the i_rwsem lock and
> call simple_setattr() as Matthew did in "EVM: Allow runtime
> modification of the set of verified xattrs"?

Not really sure, I didn't know that EVM is supposed to be used also for sysfs.
Matthew, does it make sense to you?

> thanks,

> Mimi


Kind regards,
Petr

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

end of thread, other threads:[~2018-05-18 14:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-20 13:28 [PATCH] ima: Reflect correct permissions for policy Petr Vorel
2018-05-07 21:00 ` Mimi Zohar
2018-05-16 21:34 ` Mimi Zohar
2018-05-18 14:45   ` Petr Vorel

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.