News for hackers. Stuff that matters.
Re:Git: Malicious repositories can execute remote code while... by stefan_ on Tuesday March 09, 2021 @05:32PM (#26405324)
The commit that fixes this issue:

https://github.com/gitster/git/commit/684dd4c2b414bcf648505e...

(Surprise, the root cause is a cache)

Re:Git: Malicious repositories can execute remote code while... by softwaredoug on Tuesday March 09, 2021 @05:43PM (#26405452)
Another cachelty
Re:Git: Malicious repositories can execute remote code while... by sethammons on Tuesday March 09, 2021 @07:27PM (#26406317)
well played. I think that just got added to my standard vocabulary. Caching has caused more errors and bugs that I've had to deal with than I can recall. My favorite was an off by one error where we returned nicely cached info -- just for the previous user who came through our system! :facepalm: That was a bad one.
Re:Git: Malicious repositories can execute remote code while... by anyfoo on Tuesday March 09, 2021 @09:14PM (#26406978)
That's because essentially, "state" and "caching" are the same thing on some level.

And the problem with state is that you have to make sure all your state transitions don't cause bugs. What we know as a "cache" is essentially creating new state representing existing state, with all new transitions...

Re:Git: Malicious repositories can execute remote code while... by branko_d on Wednesday March 10, 2021 @03:47AM (#26409210)
I like to look at caching as a form of denormalization - introducing redundancy to improve performance. And whenever we have redundancy, we have to make sure all our copies are synchronized, which can be tricky, especially in a concurrent environment.

On the other hand, the whole point of normalization in databases is to avoid redundancy and have "single source of truth".

I find the concepts of normalization and denormalization applicable and helpful outside databases as well, though a different terminology is often used.

Re:Git: Malicious repositories can execute remote code while... by adolph on Wednesday March 10, 2021 @08:55AM (#26411210)
In that light, a cache is a form of partition, so it can be available xor consistent with its source.

https://en.wikipedia.org/wiki/CAP_theorem

Re:Git: Malicious repositories can execute remote code while... by bin_bash on Tuesday March 09, 2021 @09:32PM (#26407086)
Cache is a type of state but not necessarily the other way around
Re:Git: Malicious repositories can execute remote code while... by anyfoo on Tuesday March 09, 2021 @09:35PM (#26407100)
In the efficient implementation of a pure functional language (say Haskell without MVars), what really is the difference between state and cache?

I know this is overly philosophical, and in practical scenarios we readily (although not always unambiguously) differentiate between "cache" and "state", but the point about transitions and that being a major source of bugs still stands.

Re:Git: Malicious repositories can execute remote code while... by eru on Tuesday March 09, 2021 @11:08PM (#26407651)
> In the efficient implementation of a pure functional language (say Haskell without MVars), what really is the difference between state and cache?

If you want to unify state and cache, you might want to go down a different route:

Think of log based filesystems (or a log based data base).

Instead of defining your operations in terms of state, you define them as pure functions of the log.

So your log is full of operations. Writing just means appending a symbolic operation like `write(key, value)` to your log.

And you define the result of `read(key)`: scan backwards through the log until you hit the last instance of `write(x, value)` and the return that `value`.

Now state means: compact your log by replacing a swath of `write` log entries with one big `snapshot` operation that encompasses many key/value pairs.

Alternatively, you can also define state to mean caching your `read` operations.

In this approach, it's no coincidence that the log is a data structure that has a linear shape: the evolution of state over time is also linear.

(With some cleverness you can replace the linear structure with eg a DAG; and then also think about how you merge divergent states.)

Re:Git: Malicious repositories can execute remote code while... by saganus on Tuesday March 09, 2021 @07:42PM (#26406429)
Here goes the obligatory

> There are only two hard things in Computer Science...

Re:Git: Malicious repositories can execute remote code while... by jholman on Tuesday March 09, 2021 @08:49PM (#26406832)
I can never remember what they are, though. To avoid this problem, I think I wrote them down on a post-it, but I had too many post-its on my desk so I got rid of them all, and now I can't remember.
Re:Git: Malicious repositories can execute remote code while... by llarsson on Wednesday March 10, 2021 @01:04AM (#26408295)
The two most difficult ones are naming things, cache invalidation, and off-by-one errors. HTH. ;)
Re:Git: Malicious repositories can execute remote code while... by Xelbair on Wednesday March 10, 2021 @03:24AM (#26409073)
I prefer the ordered version.

three most difficult things in CS:

2) Naming Things

1) Cache Invalidation

4) off by one errors

3) Concurrency

Re:Git: Malicious repositories can execute remote code while... by csunbird on Wednesday March 10, 2021 @04:49AM (#26409576)
Another version, about distributed systems:

There are only two hard problems in distributed systems:

2. Exactly-once delivery

1. Guaranteed order of messages

2. Exactly-once delivery

Re:Git: Malicious repositories can execute remote code while... by Viliam1234 on Wednesday March 10, 2021 @06:19PM (#26417845)
two most difficult things in CS:

0) naming things

1) cache invalidation

42) asynchronous callbacks

2) off by one errors

Re:Git: Malicious repositories can execute remote code while... by zaphirplane on Wednesday March 10, 2021 @02:26AM (#26408761)
They are likely making a joke about caching the answer
Re:Git: Malicious repositories can execute remote code while... by samb1729 on Wednesday March 10, 2021 @01:28AM (#26408418)
What does HTH mean?
Re:Git: Malicious repositories can execute remote code while... by mattacular on Wednesday March 10, 2021 @07:44AM (#26410651)
"Hope this helps" (sometimes used sarcastically)
Re:Git: Malicious repositories can execute remote code while... by sgn on Wednesday March 10, 2021 @01:42AM (#26408506)
Hope That Help, HTH.
Re:Git: Malicious repositories can execute remote code while... by kzrdude on Wednesday March 10, 2021 @02:31AM (#26408786)
"Hope this helps"

I see it with HAND "have a nice day" too

Re:Git: Malicious repositories can execute remote code while... by _puk on Wednesday March 10, 2021 @03:12AM (#26408995)
I've always read it as "Happy To Help".

I see that's wrong, but ignorance has made the internet seem just that little bit warmer all these years!

Re:Git: Malicious repositories can execute remote code while... by gwd on Wednesday March 10, 2021 @05:33AM (#26409848)
I think it could probably mean "Happy to help" if said in response to a thanks of some sort. Saying it before someone has said thanks is a bit presumptuous. :-)
Re:Git: Malicious repositories can execute remote code while... by bryanrasmussen on Wednesday March 10, 2021 @04:32AM (#26409475)
this reminds me I was dumpster diving at a place with lots of post-it notes and there was one that said 2HCS => whatchamacallit, CI!

what that you?

on edit: I'm going to let that 'what that you' stand because one of the hardest things about HN posts is grammatical correctitude.

Re:Git: Malicious repositories can execute remote code while... by joubert on Tuesday March 09, 2021 @08:53PM (#26406854)
> wrote them down on a post-it

You write it on local media and kept it on-premises?

Cloud is the new thing, I hear.

Re:Git: Malicious repositories can execute remote code while... by ampdepolymerase on Tuesday March 09, 2021 @09:37PM (#26407115)
The Post-it was but a cache.
Re:Git: Malicious repositories can execute remote code while... by mrathys on Wednesday March 10, 2021 @03:08AM (#26408979)
I would consider the Post-it as persistent storage or the backup. Your memory would be the cache :D
Re:Git: Malicious repositories can execute remote code while... by taf2 on Tuesday March 09, 2021 @07:27PM (#26406324)
Yeah but the speed.
Re:Git: Malicious repositories can execute remote code while... by AbraKdabra on Tuesday March 09, 2021 @07:22PM (#26406286)
Oh man...
Re:Git: Malicious repositories can execute remote code while... by brundolf on Wednesday March 10, 2021 @12:07AM (#26407993)
It's amazing how often exploits come down to optimizations. The general form being "the domain logic is X, and is secure, but we faked around it in this one case to make it faster, and it turns out we made a bad assumption while doing so". Meltdown fits this description too.
Re:Git: Malicious repositories can execute remote code while... by saagarjha on Wednesday March 10, 2021 @02:56AM (#26408914)
Optimizations come from making assumptions, and bugs come from mistaken assumptions.
Re:Git: Malicious repositories can execute remote code while... by gfiorav on Wednesday March 10, 2021 @10:23PM (#26419817)
Same with bugs. Hate to be the mantra guy but:

1. Make it work

2. Make it right

3. Make it fast (make sure you need to) a.k.a. optimize

4. Make it scale

Re:Git: Malicious repositories can execute remote code while... by Agentlien on Tuesday March 09, 2021 @11:26PM (#26407760)
I am really fascinated by the responses to this comment. So many people exclaiming how many issues are caused by caches. In ten years as a fulltime programmer the only cache issues I've seen are cache misses. It probably has to do with one's field. I'm a game developer mainly dealing with graphics programming.
Re:Git: Malicious repositories can execute remote code while... by ironmagma on Wednesday March 10, 2021 @12:10AM (#26408017)
The key problem (as I understand it) is that updating a cache properly requires knowing the exact graph of relations that an entry in the cache has to other entries. So that when that entry changes, you can propagate that change throughout the cache to other concerned entries which need to be recomputed. But knowing that exact graph is too complex a task to be trivial, it seems in this case. Basically it sounds like the non-visual version of rerendering UI when a state changes, which is hard enough even with visual feedback.
Re:Git: Malicious repositories can execute remote code while... by josefx on Wednesday March 10, 2021 @01:24AM (#26408395)
A lot of threading issues are also cache related. Forget to properly mark access to shared variables and suddenly every thread /CPU core ends up with its own locally cached version of it.
Re:Git: Malicious repositories can execute remote code while... by Agentlien on Wednesday March 10, 2021 @01:46AM (#26408549)
Yes, but this is such a well understood danger that I've never really been bitten by it in practice.

Along the same lines a lot of GPU programming tutorials warn of inconsistencies between threads and it has never been a problem since I just assume I cannot rely on consistency or order of execution, seeing each thread as separate and independent.

Re:Git: Malicious repositories can execute remote code while... by pabs3 on Tuesday March 09, 2021 @09:10PM (#26406953)
I wish folks who announce security issues would link to the patches for the issues they are announcing. This should become standard practice.
Re:Git: Malicious repositories can execute remote code while... by segfaultbuserr on Tuesday March 09, 2021 @05:53PM (#26405556)
Difficult problems in programming:

(1) cache invalidation

(2) off-by-one errors

Re:Git: Malicious repositories can execute remote code while... by mattiasfestin on Tuesday March 09, 2021 @05:58PM (#26405620)
The classical three problems.
Re:Git: Malicious repositories can execute remote code while... by xarope on Tuesday March 09, 2021 @06:06PM (#26405692)
I thought the two hardest problems were:

1) naming

2) cache invalidation

...

3) off-by-one errors

Re:Git: Malicious repositories can execute remote code while... by Ancapistani on Tuesday March 09, 2021 @07:31PM (#26406351)
I'm pretty sure it's:

1) naming

4) concurr2) cache invalidationency

...

3) off-by-one errors

Re:Git: Malicious repositories can execute remote code while... by hesdeadjim on Tuesday March 09, 2021 @08:21PM (#26406678)
Love this.
Re:Git: Malicious repositories can execute remote code while... by edgyquant on Tuesday March 09, 2021 @10:02PM (#26407258)
You forgot

0) Race consegmentation fault (core dumped)

(I know I was ninja’d but didn’t see until after)

Re:Git: Malicious repositories can execute remote code while... by account42 on Wednesday March 10, 2021 @07:44AM (#26410652)
FWIW, your version has the nice touch of also introducing a 0th item.
Re:Git: Malicious repositories can execute remote code while... by waheoo on Tuesday March 09, 2021 @06:49PM (#26406045)
I feel like we should have solved the naming problem as an industry by now.

Alas.

Re:Git: Malicious repositories can execute remote code while... by layer8 on Tuesday March 09, 2021 @07:24PM (#26406302)
It’s actually the hardest one of the three, being outside the grasp of formal methods.
Re:Git: Malicious repositories can execute remote code while... by kreeben on Wednesday March 10, 2021 @05:30AM (#26409824)
To solve this problem we would need to first understand the human mind, how it stores data, how it does computation, and how it interacts with names. So we would need the same set of information that we would need for creating AGI. A solution is probably only a couple of months/decades away.
Re:Git: Malicious repositories can execute remote code while... by waheoo on Wednesday March 10, 2021 @07:47AM (#26410668)
I really have to disagree, why can't you devise a formal method?

- a good name should be descriptive

- avoid being overly clever, call a spade a spade

- don't optimise for generalisation, naming things is a time to be specific

- aim for short but not at the expense of losing context

- avoid redundancy in naming of things nearby, leverage spatial context

- avoid qualifiers or type information where possible - type should be obvious from context and use, if it's not qualify or refactor

Anything else?

Re:Git: Malicious repositories can execute remote code while... by layer8 on Wednesday March 10, 2021 @07:55PM (#26418746)
Those aren’t formal definitions. “Formal” means, at the very least, that the specification is done in a formal language, and usually that conformance to the specification can be checked mechanically, that is, by a computer.

https://en.m.wikipedia.org/wiki/Formal_methods

Re:Git: Malicious repositories can execute remote code while... by bouncycastle on Tuesday March 09, 2021 @08:26PM (#26406710)
shouldn't your list start from 0?
Re:Git: Malicious repositories can execute remote code while... by gdavisson on Wednesday March 10, 2021 @04:26AM (#26409428)
There are three kinds of programmers:

  1) Those who number lists starting at 1.
  1) Those who number lists starting at 0.
  2.5) Stan Kelly-Bootle, who proposed a compromise.
Re:Git: Malicious repositories can execute remote code while... by edgyquant on Tuesday March 09, 2021 @10:02PM (#26407263)
That’s the joke
Re:Git: Malicious repositories can execute remote code while... by eru on Tuesday March 09, 2021 @11:09PM (#26407659)
Fortunately, many off-by-one errors can be caught with more ergonomic tooling.

For the simplest example: compare the old C-style for loop vs a Python style for-each loop.

Re:Git: Malicious repositories can execute remote code while... by Gene_Parmesan on Wednesday March 10, 2021 @03:29AM (#26409109)
I don't find I ever make off-by-one errors with simple collection iteration; at some point "i < len" becomes tattooed on your brain stem. The off-by-one errors I tend to make are related to implementation details of certain data structures or algs. Really, I would describe them more as "thinking at the margins can be challenging." Correctly handling doubly linked lists, that sort of thing.

Oh, and slicing. I will never get Python slicing right the first time. The fact that the range is [begin, end) is just never the way I expect it to work.

Re:Git: Malicious repositories can execute remote code while... by Ygg2 on Wednesday March 10, 2021 @04:40AM (#26409525)
But slicing 0..len and for (i=0; i< len) are literally the same thing.

In [0, len) ')' means less than. As in 0≤ x< len.

Re:Git: Malicious repositories can execute remote code while... by user-the-name on Wednesday March 10, 2021 @07:10AM (#26410390)
(3) remembering the joke
Re:Git: Malicious repositories can execute remote code while... by echelon on Tuesday March 09, 2021 @06:06PM (#26405693)
Per your downvotes - I used to hate jokes on Hacker News and downvote them when I saw them, but I've become more ambivalent. They're a way of amicably sharing culture and experiences with other engineers that transcend any differences in age, gender, race, background, etc.

The formulation of this joke I tend to see is,

The two hardest problems in programming:

(1) cache invalidation

(2) appropriately naming things

(3) off-by-one errors

Re:Git: Malicious repositories can execute remote code while... by Twisol on Tuesday March 09, 2021 @06:14PM (#26405748)
It's barely even a joke to me anymore -- it's just too real for me to laugh.

(Cache invalidation is essentially the same problem as managing mutable state -- "Out of the Tar Pit" frames mutable state as either essential or incidental, the latter being rederivable in principle from essential state. Incidental mutable state is no more and no less than a cache, and usually one with an informal and undocumented invalidation policy.)

(And naming things has a very real technical counterpart in addressing, which comes up obviously in networking, but you can also see its shadows in quite a lot of concerns around architecture and modularity.)

Re:Git: Malicious repositories can execute remote code while... by imoverclocked on Tuesday March 09, 2021 @06:43PM (#26405995)
Humor is often the most efficient way to communicate/accept the truth.
Re:Git: Malicious repositories can execute remote code while... by pablius on Tuesday March 09, 2021 @09:36PM (#26407111)
To make the truth seem like an acceptable parallel universe, and then join it.
Re:Git: Malicious repositories can execute remote code while... by JBiserkov on Tuesday March 09, 2021 @07:06PM (#26406173)
The two hardest problems in programming:

(1) cache invalidation

(3) off-by-one errors

(2) appropriately naming things

(4) parallel execution [leading to race conditions / ordering bugs]

Re:Git: Malicious repositories can execute remote code while... by lifeisstillgood on Tuesday March 09, 2021 @07:10PM (#26406205)
I think you win a bad in-joke award - the first annual Turing-Dad joke award.
Re:Git: Malicious repositories can execute remote code while... by rileymat2 on Tuesday March 09, 2021 @07:26PM (#26406311)
Minor quibble, it should be the three hardest problems.
Re:Git: Malicious repositories can execute remote code while... by bluejekyll on Tuesday March 09, 2021 @07:29PM (#26406336)
It should be, but the increments were run in parallel on nonvolatile memory.
Re:Git: Malicious repositories can execute remote code while... by scubbo on Tuesday March 09, 2021 @08:09PM (#26406594)
The two hardest problems in computer science are:

1) Naming 3) Cache Invalidation 2) Off-by-one errors 3) In-order once-only delivery of distributed messages

And an almost fanatical devotion to the Pope

Re:Git: Malicious repositories can execute remote code while... by froh on Tuesday March 09, 2021 @09:21PM (#26407024)
I love it told like this: https://news.ycombinator.com/item?id=26406351

1) naming

4) concurr2) cache invalidation

ency

3) off-by-one errors

Re:Git: Malicious repositories can execute remote code while... by nicklaf on Tuesday March 09, 2021 @08:51PM (#26406838)
(5) feature creep
Re:Git: Malicious repositories can execute remote code while... by slavik81 on Tuesday March 09, 2021 @07:05PM (#26406167)
They had this bug before in other code unrelated to caching. To me, that suggests a deeper root.
Re:Git: Malicious repositories can execute remote code while... by de6u99er on Tuesday March 09, 2021 @09:57PM (#26407228)
Strange. The guy who fixed the issue works at Microsoft, but uses his gmx email for Github.
Re:Git: Malicious repositories can execute remote code while... by enneff on Tuesday March 09, 2021 @11:27PM (#26407765)
And the guy who announced the new Git release works for Google, but uses his pobox.com email for Git development.
Re:Git: Malicious repositories can execute remote code while... by skzv on Wednesday March 10, 2021 @04:29AM (#26409448)
Yes, actually, Googlers are encouraged to use their personal Github accounts.
Re:Git: Malicious repositories can execute remote code while... by enneff on Wednesday March 10, 2021 @04:07PM (#26416272)
That is true but the git release has nothing to do with GitHub accounts.
Re:Git: Malicious repositories can execute remote code while... by saagarjha on Wednesday March 10, 2021 @04:51AM (#26409596)
But probably their work email when doing things on company time?
Re:Git: Malicious repositories can execute remote code while... by enneff on Wednesday March 10, 2021 @04:06PM (#26416252)
Nope. This is an example of someone working on company time using their personal email.
Re:Git: Malicious repositories can execute remote code while... by saagarjha on Thursday March 11, 2021 @05:09AM (#26422324)
Right, which is (AFAIK) not usually recommended except for side projects or ones where there is already an existing relationship under a personal email address.
Re:Git: Malicious repositories can execute remote code while... by eru on Tuesday March 09, 2021 @11:10PM (#26407665)
I think you just got a glimpse of a vast sea of internal policy and compliance issues.
Re:Git: Malicious repositories can execute remote code while... by balp on Wednesday March 10, 2021 @12:00AM (#26407946)
Or that the opensource hobby is much more longlived that something as temporary as an employer.
Re:Git: Malicious repositories can execute remote code while... by skrebbel on Wednesday March 10, 2021 @01:28AM (#26408420)
Wait, there are people who use real, in-use email addresses in publicly hosted git repos? I mean, it's likely his spamcatcher address, no?
Re:Git: Malicious repositories can execute remote code while... by lixtra on Wednesday March 10, 2021 @12:22AM (#26408081)
> (Surprise, the root cause is a cache)

Couldn’t it just as well be attributed to improper file path normalization? If we had only lower case ASCII file systems it would not have caused a problem.

Re:Git: Malicious repositories can execute remote code while... by yxhuvud on Wednesday March 10, 2021 @12:51AM (#26408232)
Things can have more than one cause that act together.