From: Omar Sandoval <osandov@osandov.com>
To: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org, linux-debuggers@vger.kernel.org,
kernel-team@fb.com
Subject: Re: [PATCH] x86/unwind/orc: add ELF section with ORC version number
Date: Fri, 9 Jun 2023 16:17:39 -0700 [thread overview]
Message-ID: <ZIOzE4f2xr9CCA45@telecaster> (raw)
In-Reply-To: <20230609224803.275vqw345utsusah@treble>
On Fri, Jun 09, 2023 at 03:48:03PM -0700, Josh Poimboeuf wrote:
> On Fri, Jun 09, 2023 at 03:24:38PM -0700, Omar Sandoval wrote:
> > > Though, instead of
> > > using an incrementing version, Peter had the idea to hash the struct,
> > > like:
> > >
> > > awk '/^struct orc_entry {$/ { p=1 } p { print } /^}/ { p=0 }' arch/x86/include/asm/orc_types.h | sha1sum
> > >
> > > That way we don't have to remember to bump the version number, and it
> > > would be more resilient to partial backports in distros.
> > >
> > > Would something like that work for you?
> >
> > Any sort of unique identifier works for me. One thing that the proposed
> > hash wouldn't catch is if ORC_REG_* or ORC_TYPE_* are ever renumbered
> > (i.e., the meanings of existing values change). It also wouldn't catch
> > if something about the .orc_unwind_ip section changed. But assuming
> > changes like that would be much rarer, it could be handled manually by
> > bumping a "salt" for the hash. E.g., by adding 'BEGIN { print <SALT> }'
> > to the awk script:
> >
> > awk 'BEGIN { print 1 } /^struct orc_entry {$/ { p=1 } p { print } /^}/ { p=0 }' arch/x86/include/asm/orc_types.h | sha1sum
> >
> > I'll defer to you guys whether it's easier to remember to bump a version
> > everytime or only in those rare cases.
>
> I think I'd prefer only bumping it in the rare cases, because we're
> going to end up forgetting either way ;-)
>
> To catch REG/TYPE changes, we could forego awk and just hash the whole
> file, the only downside being that it might introduce unnecessary
> changes if we change a comment or something. But the file changes
> rarely enough.
>
> Or we could tweak the awk to also print ORC_{REG,TYPE}_* pretty easily.
Printing ORC_{REG,TYPE}_* should cover almost everything, and if there's
anything not covered, it can be handled manually, so that sounds good to
me. I'll draft a patch doing that.
Thanks,
Omar
prev parent reply other threads:[~2023-06-09 23:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-08 22:38 [PATCH] x86/unwind/orc: add ELF section with ORC version number Omar Sandoval
2023-06-09 22:04 ` Josh Poimboeuf
2023-06-09 22:24 ` Omar Sandoval
2023-06-09 22:48 ` Josh Poimboeuf
2023-06-09 23:17 ` Omar Sandoval [this message]
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=ZIOzE4f2xr9CCA45@telecaster \
--to=osandov@osandov.com \
--cc=jpoimboe@kernel.org \
--cc=kernel-team@fb.com \
--cc=linux-debuggers@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
/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.