git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Gitorious should use CRC128 / 256 / 512 instead of SHA-1

From
Michal Suchánek <msuchanek@suse.de>
Date
Jan 16, 2023, 09:13 UTC
Message-ID
<20230116091346.GC16547@kitsune.suse.cz>
In-Reply-To
<b1984123-569a-c290-8048-158c1c5e08b4@selasky.org>
On Mon, Jan 16, 2023 at 08:17:58AM +0100, Hans Petter Selasky wrote:
Show 21 quoted lines
> On 1/15/23 14:53, Michal Suchánek wrote:
> > > Many people think that bit errors cannot happen because the memory uses ECC
> > > and the file system uses cryptographic hashes to verify the integrity of the
> > > data. But what many people forget about is that when copying data from
> > > memory to disk, typically using a DMA channel data is copied w/o any kind of
> > > integrity protection, because the integrity protection is not end-to-end.
> > > The integrity protection is only per-link.
> >
> > So long as all links have integrity protection it's end-to-end.
> >
> 
> Hi Michael,
> 
> You clearly don't see what this is about! Only if the same CRC mechanism is
> end-to-end, you don't have any good integrity mechanism at all!
> 
> Let me try to explain what this is about in very simple words. Because
> memcpy() does not copy the ECC CRC values along with the data, it is an
> unsafe memory copy mechanism, which may introduce bit-errors without
> noticing. It does not help to only have ECC RAM or for that sake protect the
> PCI links.

The ECC protects against 1bit errors - so long as only 1 bit is flipped along that path it is corrected.

If you have bigger errors ECC can sometimes detect them and your system crashes or whatever, and sometimes they go unnoticed.

It does not make sense to copy around that CRC. It is used to recover the corrupted bit, and when that data is copied to a new location a new CRC is calculated that can detect an error in that location. Copying that checksum around would only accumulate the errors.

Of course, that assumes that the corruption happens only in the cheaper external long-term storage, and data does not get corrupted as it goes through your CPU where it is stored only a few CPU cycles at a time. It is mostly the case but when you need extreme reliability system-level schemes that mitigate this possibility do exist.

Thanks
Michal
Previous: Hans Petter SelaskyNext: Hans Petter Selasky
Message 12 of 16 in “Gitorious should use CRC128 / 256 / 512 instead of SHA-1”
  1. Hans Petter SelaskyJan 13, 2023
  2. brian m. carlsonJan 14, 2023
  3. Junio C HamanoJan 15, 2023
  4. demerphqJan 15, 2023
  5. Hans Petter SelaskyJan 16, 2023
  6. Hans Petter SelaskyJan 16, 2023
  7. rsbecker@nexbridge.comJan 16, 2023
  8. Hans Petter SelaskyJan 16, 2023
  9. Junio C HamanoJan 16, 2023
  10. Michal SuchánekJan 15, 2023
  11. Hans Petter SelaskyJan 16, 2023
  12. Michal SuchánekJan 16, 2023
  13. Hans Petter SelaskyJan 16, 2023
  14. rsbecker@nexbridge.comJan 16, 2023
  15. Hans Petter SelaskyJan 16, 2023
  16. Michal SuchánekJan 16, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.