From: Petr Mladek <pmladek@suse.com>
To: Nicolai Stange <nstange@suse.de>
Cc: Joe Lawrence <joe.lawrence@redhat.com>,
live-patching@vger.kernel.org, linux-kernel@vger.kernel.org,
Josh Poimboeuf <jpoimboe@redhat.com>,
Jessica Yu <jeyu@redhat.com>, Jiri Kosina <jikos@kernel.org>,
Miroslav Benes <mbenes@suse.cz>
Subject: Re: [PATCH v4] livepatch: introduce shadow variable API
Date: Fri, 18 Aug 2017 16:04:45 +0200 [thread overview]
Message-ID: <20170818140445.GC25223@pathway.suse.cz> (raw)
In-Reply-To: <87pobtj8hu.fsf@suse.de>
On Fri 2017-08-18 15:44:29, Nicolai Stange wrote:
> Joe Lawrence <joe.lawrence@redhat.com> writes:
>
> <snip>
> > +
> > +/**
> > + * klp_shadow_get() - retrieve a shadow variable data pointer
> > + * @obj: pointer to parent object
> > + * @id: data identifier
> > + *
> > + * Return: the shadow variable data element, NULL on failure.
> > + */
> > +void *klp_shadow_get(void *obj, unsigned long id)
> > +{
> > + struct klp_shadow *shadow;
> > +
> > + rcu_read_lock();
> > +
> > + hash_for_each_possible_rcu(klp_shadow_hash, shadow, node,
> > + (unsigned long)obj) {
> > +
> > + if (klp_shadow_match(shadow, obj, id)) {
> > + rcu_read_unlock();
> > + return shadow->data;
>
> I had to think a moment about what protects shadow from getting freed by
> a concurrent detach after that rcu_read_unlock(). Then I noticed that if
> obj and the livepatch are alive, then so is shadow, because there
> obviously hasn't been any reason to detach it.
>
> So maybe it would be nice to have an additional comment at
> klp_shadow_detach() that it's the API user's responsibility not to use a
> shadow instance after detaching it...
Good point. In fact, it might make sense to rename the functions:
attach -> create
detach -> destroy
The name detach suggests that the variable is just not connected to
the parent object but that it is still accessible/usable.
Best Regards,
Petr
next prev parent reply other threads:[~2017-08-18 14:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-14 20:02 [PATCH v4] livepatch: shadow variables Joe Lawrence
2017-08-14 20:02 ` [PATCH v4] livepatch: introduce shadow variable API Joe Lawrence
2017-08-15 13:59 ` Josh Poimboeuf
2017-08-16 12:43 ` Miroslav Benes
2017-08-16 13:40 ` Joe Lawrence
2017-08-31 12:45 ` Miroslav Benes
2017-08-17 14:05 ` Petr Mladek
2017-08-17 16:01 ` Joe Lawrence
2017-08-17 16:28 ` Josh Poimboeuf
2017-08-18 9:42 ` Petr Mladek
2017-08-18 19:04 ` Josh Poimboeuf
2017-08-18 13:46 ` Joe Lawrence
2017-08-18 16:18 ` Petr Mladek
2017-08-18 20:25 ` Joe Lawrence
2017-08-21 11:24 ` Petr Mladek
2017-08-18 13:44 ` Nicolai Stange
2017-08-18 14:04 ` Petr Mladek [this message]
2017-08-18 14:19 ` Joe Lawrence
2017-08-18 14:46 ` Nicolai Stange
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170818140445.GC25223@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=jeyu@redhat.com \
--cc=jikos@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=nstange@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome