Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1709293

Re: [PATCH v3] livepatch: introduce shadow variable API

From Miroslav Benes <mbenes@suse.cz>
Newsgroups linux.kernel
Subject Re: [PATCH v3] livepatch: introduce shadow variable API
Date 2017-08-11 08:30 +0200
Message-ID <udbCi-8qm-21@gated-at.bofh.it> (permalink)
References <u8hfj-6G8-11@gated-at.bofh.it> <u8hfj-6G8-9@gated-at.bofh.it> <ucWWC-6Yt-21@gated-at.bofh.it> <ucYc1-7WK-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> > > +/*
> > > + * klp_shadow_set() - initialize a shadow variable
> > > + * @shadow:	shadow variable to initialize
> > > + * @obj:	pointer to parent object
> > > + * @id:		data identifier
> > > + * @data:	pointer to data to attach to parent
> > > + * @size:	size of attached data
> > > + */
> > > +static inline void klp_shadow_set(struct klp_shadow *shadow, void *obj,
> > > +				  unsigned long id, void *data, size_t size)
> > > +{
> > > +	shadow->obj = obj;
> > > +	shadow->id = id;
> > > +
> > > +	if (data)
> > > +		memcpy(shadow->data, data, size);
> > > +}
> > > +
> > > +/**
> > > + * klp_shadow_add() - add a shadow variable to the hashtable
> > > + * @shadow:	shadow variable to add
> > > + */
> > > +static inline void klp_shadow_add(struct klp_shadow *shadow)
> > > +{
> > > +	hash_add_rcu(klp_shadow_hash, &shadow->node,
> > > +		     (unsigned long)shadow->obj);
> > > +}
> > 
> > It would be nice to add a comment that a caller must hold klp_shadow_lock 
> > spinlock.
> 
> Since shadow_match(), klp_shadow_set(), and klp_shadow_add() are all in
> the same boat, I can mention the lock for those functions as well. 

Yes, please.

> BTW,
> is there a convention to drop the "klp_" for static, local routines?  I
> should be consistent here.

Oh, I didn't notice missing "klp_" in shadow_match. We have a prefix 
everywhere, so add it, please.

Thanks,
Miroslav

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: [PATCH v3] livepatch: introduce shadow variable API Miroslav Benes <mbenes@suse.cz> - 2017-08-10 16:50 +0200
  Re: [PATCH v3] livepatch: introduce shadow variable API Joe Lawrence <joe.lawrence@redhat.com> - 2017-08-10 18:10 +0200
    Re: [PATCH v3] livepatch: introduce shadow variable API Miroslav Benes <mbenes@suse.cz> - 2017-08-11 08:30 +0200

csiph-web