On Thu, Feb 25, 2021 at 6:37 AM Karl Denninger <karl at denninger.net>
wrote:
> On 2/25/2021 04:30, Olivier Certner wrote:
> >> Neither command is what I'd call 'intuitive', so it
would have taken me
> a
> >> long time to find either of them. I cut and pasted the 'git
branch'
> command
> >> and it took me a moment to realize what that meant. Never ran
"grep -l"
> on
> >> a pipe, I guess.
> > You made me laugh! Apart from relatively simple commands, git's
> interface is
> > far from intuitive. That's the reason why I regret that it became
the
> hugely
> > dominant DVCS.
>
> Regression doesn't have to come to a project, but if the tools you
> choose do things like this then you have to work around them as a
> project to avoid the issue, and that might wind up being somewhat of a
> PITA.
>
> This specific issue is IMHO quite severe in terms of operational
> impact. I track -STABLE but don't load "new things" all the
time. For
> security-related things it's more important to know if I've got
> something out there in a specific instance where it may apply (and not
> care in others where it doesn't; aka the recent Xen thing if you're
not
> using Xen.) Otherwise if everything is running as it should do I wish
> to risk introducing bugs along with improvements? If not in a
> security-related context, frequently not.
>
> Well, this used to be easy. Is your "uname" r-number HIGHER than
the
> "when fixed" revision? You're good. Now, nope. Now I have
to go dig
> source to know because there is no longer a "revision number"
that
> monotonically increments with each commit so there is no longer a way to
> have a "point in time" view of the source, as-committed, for a
given
> checked-out version.
>
> IMHO that's a fairly serious regression for the person responsible for
> keeping security-related things up to date and something the project
> should find a way to fix before rolling the next -RELEASE. (Yeah, I know
> that's almost-certain to not happen but it's not like this issue
wasn't
> known since moving things over to git.)
>
We should likely just publish the 'v' number in the advisories. It's
basically a count back to the start of the project. We put that number in
uname already.
You can also find out the 'v' number in the latest advisories by
cloning
the repo and doing the same thing we do in newvers.sh:
% git rev-list --first-parent --count $HASH
and that will tell you. This needn't be on the target machine since the
hashes are stable across the world.
That's kinda the whole reason we did the 'v' number: to provide a
stable,
monotonically increasing number that's unaffected by vendor merges (the
cXXXX number was affected by merges). If you have a 'c' number in your
uname the answer is super simple: you are affected.
The problem, though, can happen when you run a shallow clone or gitup to
get the sources and build from that. In that case the v number is bogus
(hmmm, we should omit it when we have a shallow clone maybe). In that case
you'll need to do the following on a clone somewhere (not necessarily on
the target machine):
% git log --max-count 100000 --oneline $UNAME_HASH | grep $ADVISORY_HASH
The other alternative: you can do a 'git fetch' to pull the new hashes
without doing a merge with what's on the machine. Then you can do
% git log --oneline stable/13..freebsd/stable/13 | grep $ADVISORY_HASH
and if you get a hit, you don't have the patch yet installed. The advantage
of this is that this is work you'll need to do eventually anyway. If you
don't have it, then a
% git merge --ff-only freebsd/stable/13
will pull it in. If it turns out you did have it in the history before the
shallow clone, then you can choose to update or not. If you choose to
update, do the merge. If you choose not, then do nothing. The next 'git
pull --ff-only' will do the right thing, as will repeating this process for
the next advisory. The only harm is a few extra bytes pulled and/or a few
extra compressed revs on the branch.
Of course, the above assumes that you're running the sources == system
binaries. If in doubt, substitute $UNAME_HASH for the bare stable/13 in the
above.
Warner