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
On 2/25/2021 15:56, Warner Losh wrote:> > On Thu, Feb 25, 2021 at 6:37 AM Karl Denninger <karl at denninger.net > <mailto: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.(list of further "stuff") But that's my entire point Warner. The time (and present items) on a given machine to know whether it is covered by a given advisory under the "svn view of the world" is one command, and no sources.? That is, if the advisory says "r123456" has the fix, then if I do a "uname -v" and get something larger, it's safe. If I get something smaller it's not. I don't need the source on the machine, I don't need svn on the target or, for that matter, do I need to know if the source tree I have on a build machine is coherent with whatever is on the running machine.? I simply need to know if the source that built the code that is running was updated *after* the commit that fixes the problem.? What if the source /isn't on that machine /because you build on some system and then distribute?? Does every machine now have to be coherent with your source repository in order to be able to figure out where you are or worse, it must keep the source from which that specific installation, individually, was built? /What if the source isn't there at all /because you run binary code and update with freebsd-update? Unless I've missed something that's what was lost and IMHO needs to be restored; a way to know that in seconds with nothing other than the operating OS on the box (e.g. via uname) and the advisory with its "greater than X is safe" from the mailing list.? Am I misunderstanding the current state of things in this regard? -- Karl Denninger karl at denninger.net <mailto:karl at denninger.net> /The Market Ticker/ /[S/MIME encrypted email preferred]/ -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4897 bytes Desc: S/MIME Cryptographic Signature URL: <http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20210225/de31fbf3/attachment.bin>
On 2/25/21 3:56 PM, Warner Losh wrote:> [...] > 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. [....]+1 !!! -- George -------------- next part -------------- A non-text attachment was scrubbed... Name: OpenPGP_signature Type: application/pgp-signature Size: 840 bytes Desc: OpenPGP digital signature URL: <http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20210225/05589762/attachment.sig>
On Thu, 25 Feb 2021 at 15:58, Warner Losh <imp at bsdimp.com> wrote:> > 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).I want to clarify one point here - the commit count is already omitted from uname in the case of shallow clones (as Kevin Oberman discovered). Shallow clones certainly have the benefit of limiting the amount of disk space used by the clone. Does that outweigh the loss of the commit count? I had a look at the size of the .git directory with different --depth settings: 262M stable-13-shallow-1/.git 262M stable-13-shallow-10/.git 262M stable-13-shallow-100/.git 281M stable-13-shallow-1000/.git 807M stable-13-shallow-10000/.git I think we can provide a way to include the commit count as long as we're willing to require some minimum clone depth, and will pursue this in the next while. If this works out it will make it into stable/13, but probably not releng/13.0.