Re: [PATCH v10 02/15] livepatch: avoid position-based search if `-z unique-symbol` is available

From: Josh Poimboeuf
Date: Wed Feb 16 2022 - 14:57:52 EST


On Wed, Feb 16, 2022 at 04:06:24PM +0100, Miroslav Benes wrote:
> > > + /*
> > > + * If the LD's `-z unique-symbol` flag is available and enabled,
> > > + * sympos checks are not relevant.
> > > + */
> > > + if (IS_ENABLED(CONFIG_LD_HAS_Z_UNIQUE_SYMBOL))
> > > + sympos = 0;
> > > +
> >
> > Similarly, I don't see a need for this. If the patch is legit then
> > sympos should already be zero. If not, an error gets reported and the
> > patch fails to load.
>
> My concern was that if the patch is not legit (that is, sympos is > 0 for
> some reason), the error would be really cryptic and would not help the
> user at all. So zeroing sympos seems to be a good idea to me. There is no
> harm and the change is very small and compact.

But wouldn't a cryptic error be better than no error at all? A bad
sympos might be indicative of some larger issue, like the wrong symbol
getting patched.

--
Josh