Re: [PATCH 09/11] audit: Allocate fsnotify mark independently of chunk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2018-10-03 18:08, Paul Moore wrote:
> On Tue, Sep 4, 2018 at 12:06 PM Jan Kara <jack@xxxxxxx> wrote:
> > Allocate fsnotify mark independently instead of embedding it inside
> > chunk. This will allow us to just replace chunk attached to mark when
> > growing / shrinking chunk instead of replacing mark attached to inode
> > which is a more complex operation.
> >
> > Signed-off-by: Jan Kara <jack@xxxxxxx>
> > ---
> >  kernel/audit_tree.c | 64 +++++++++++++++++++++++++++++++++++++++++------------
> >  1 file changed, 50 insertions(+), 14 deletions(-)
> >
> > diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
> > index 0cd08b3581f1..481fdc190c2f 100644
> > --- a/kernel/audit_tree.c
> > +++ b/kernel/audit_tree.c
> > @@ -142,10 +148,33 @@ static void audit_mark_put_chunk(struct audit_chunk *chunk)
> >         call_rcu(&chunk->head, __put_chunk);
> >  }
> >
> > +static inline struct audit_tree_mark *audit_mark(struct fsnotify_mark *entry)
> > +{
> > +       return container_of(entry, struct audit_tree_mark, mark);
> > +}
> > +
> > +static struct audit_chunk *mark_chunk(struct fsnotify_mark *mark)
> > +{
> > +       return audit_mark(mark)->chunk;
> > +}
> > +
> 
> ...
> 
> > @@ -426,7 +460,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
> >         if (!old_entry)
> >                 return create_chunk(inode, tree);
> >
> > -       old = container_of(old_entry, struct audit_chunk, mark);
> > +       old = mark_chunk(old_entry)->chunk;
> 
> I'm pretty sure you mean the following instead?
> 
>   old = mark_chunk(old_entry);

Yup, nice catch.  This could have been
	"old = audit_mark(old_entry)->chunk"
but the mark_chunk() helper avoids that.  (It compiles because it got
fixed/replaced in the following patch.)

This is why "old" should be called "old_chunk" and "old_entry" should be
called "old_mark" (which the latter is in the last patch).

> >         /* are we already there? */
> >         spin_lock(&hash_lock);
> 
> paul moore

- RGB

--
Richard Guy Briggs <rgb@xxxxxxxxxx>
Sr. S/W Engineer, Kernel Security, Base Operating Systems
Remote, Ottawa, Red Hat Canada
IRC: rgb, SunRaycer
Voice: +1.647.777.2635, Internal: (81) 32635



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux