From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Petr Mladek <pmladek@suse.com>
Cc: Joe Lawrence <joe.lawrence@redhat.com>,
live-patching@vger.kernel.org, linux-kernel@vger.kernel.org,
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 14:04:47 -0500 [thread overview]
Message-ID: <20170818190447.jyflvqdteg64ddij@treble> (raw)
In-Reply-To: <20170818094250.GA25223@pathway.suse.cz>
On Fri, Aug 18, 2017 at 11:42:50AM +0200, Petr Mladek wrote:
> On Thu 2017-08-17 12:01:33, Joe Lawrence wrote:
> > On 08/17/2017 10:05 AM, Petr Mladek wrote:
> > >> diff --git a/kernel/livepatch/shadow.c b/kernel/livepatch/shadow.c
> > >> new file mode 100644
> > >> index 000000000000..0ebd4b635e4f
> > >> --- /dev/null
> > >> +++ b/kernel/livepatch/shadow.c
> > >> +/**
> > >> + * klp_shadow_match() - verify a shadow variable matches given <obj, id>
> > >> + * @shadow: shadow variable to match
> > >> + * @obj: pointer to parent object
> > >> + * @id: data identifier
> > >> + *
> > >> + * Return: true if the shadow variable matches.
> > >> + *
> > >> + * Callers should hold the klp_shadow_lock.
> > >> + */
> > >> +static inline bool klp_shadow_match(struct klp_shadow *shadow, void *obj,
> > >> + unsigned long id)
> > >> +{
> > >> + return shadow->obj == obj && shadow->id == id;
> > >> +}
> > >
> > > Do we really need this function? It is called only in situations
> > > where shadow->obj == obj is always true. Especially the use in
> > > klp_shadow_detach_all() is funny because we pass shadow->obj as
> > > the shadow parameter.
> >
> > Personal preference. Abstracting out all of the routines that operated
> > on the shadow variables (setting up, comparison) did save some code
> > lines and centralized these common bits.
>
> I take this back. We actually need to check obj because different
> objects might have the same hash.
>
> I think that I did the same mistake also the last time. I hope that
> I will be able to fix this in my mind faster than "never" vs. "newer"
> typo that I do for years.
It's an easy mistake to make. hash_for_each_possible() is not
intuitive, IMO. Maybe some brave soul should fix it.
--
Josh
next prev parent reply other threads:[~2017-08-18 19: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 [this message]
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
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=20170818190447.jyflvqdteg64ddij@treble \
--to=jpoimboe@redhat.com \
--cc=jeyu@redhat.com \
--cc=jikos@kernel.org \
--cc=joe.lawrence@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®