Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Feb 2021 13:56:41 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Karl Denninger <karl@denninger.net>
Cc:        FreeBSD-STABLE Mailing List <freebsd-stable@freebsd.org>
Subject:   Re: How do I know if my 13-stable has security patches?
Message-ID:  <CANCZdfo2zq1fR5q7X47QFAFt00WrfvSzyqg4vDVbRwdGGXgfMQ@mail.gmail.com>
In-Reply-To: <001a5401-c334-5937-4ce3-315ff89e34be@denninger.net>
References:  <CAN6yY1tTt%2BEn6hzMYrjm2fRkUPBAuN9t8%2BR27Z3To_sJRbfUVA@mail.gmail.com> <1748076.jFELhIj8lM@ravel> <CAN6yY1sehRjej7vf3B_TPsg%2BecpDLG=naQ2oiMZ=DATs3PUGzQ@mail.gmail.com> <3308997.ajJYar8FF2@ravel> <001a5401-c334-5937-4ce3-315ff89e34be@denninger.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Feb 25, 2021 at 6:37 AM Karl Denninger <karl@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfo2zq1fR5q7X47QFAFt00WrfvSzyqg4vDVbRwdGGXgfMQ>