From: Nicolai Stange <nstange@suse.de>
To: Joe Lawrence <joe.lawrence@redhat.com>
Cc: 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>, Petr Mladek <pmladek@suse.com>
Subject: Re: [PATCH v4] livepatch: introduce shadow variable API
Date: Fri, 18 Aug 2017 15:44:29 +0200 [thread overview]
Message-ID: <87pobtj8hu.fsf@suse.de> (raw)
In-Reply-To: <1502740963-31310-2-git-send-email-joe.lawrence@redhat.com> (Joe Lawrence's message of "Mon, 14 Aug 2017 16:02:43 -0400")
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...
Thanks,
Nicolai
> + }
> + }
> +
> + rcu_read_unlock();
> +
> + return NULL;
> +}
> +EXPORT_SYMBOL_GPL(klp_shadow_get);
<snap>
--
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
next prev parent reply other threads:[~2017-08-18 13:44 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 [this message]
2017-08-18 14:04 ` Petr Mladek
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=87pobtj8hu.fsf@suse.de \
--to=nstange@suse.de \
--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=pmladek@suse.com \
/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 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.