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

Re: [PATCH v2 01/13] hash: add an algo member to struct object_id

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
May 7, 2021, 20:07 UTC
Message-ID
<YJWeF8iaWcegWACa@camp.crustytoothpaste.net>
In-Reply-To
<CAHd-oW4N7GB=E6hFc4GAD-b+1QzTR9+hL-hDXwAQkuss4Y4Ddw@mail.gmail.com>
On 2021-05-07 at 13:58:42, Matheus Tavares Bernardino wrote:
> Hi, brian
Hey,
> 1. Make oidcpy() only copy `hash_algos[src->algo].rawsz` bytes. (But
> then we would probably need to branch in case `src->algo` is zero,
> right?)

Yeah, this will likely incur a performance cost. I'd recommend avoiding this if possible.

> 2. Reintroduce the oid_pad_buffer() function from your v1, and use it
> in parallel-checkout.c:send_one_item(), after oidcpy(). This would
> then zero out the copied uninitialized bytes (with the cost of one
> additional memcpy() per item, but this might be neglectable here).

This is fine with me. I didn't have a use for it anymore, but you've clearly found one, and I think this is probably the best approach here.

> 3. Use oidcpy() as-is, without additional padding, and let Valgrind
> warn. This false-positive warn might not be so problematic after all,
> and maybe I'm just overthinking things :)

I'm okay with this, but I don't know if the other end is security sensitive and might need unused data zeroed. If so, we should definitely avoid this option.

-- 
brian m. carlson (he/him or they/them)
Houston, Texas, US
Previous: Matheus Tavares BernardinoNext: brian m. carlson
Message 4 of 16 in “SHA-256 / SHA-1 interop, part 1”
  1. 00/13 SHA-256 / SHA-1 interop, part 1brian m. carlson, Apr 26, 2021
  2. 01/13 hash: add an algo member to struct object_idbrian m. carlson, Apr 26, 2021
  3. Matheus Tavares BernardinoMay 7, 2021
  4. brian m. carlsonMay 7, 2021
  5. 03/13 http-push: set algorithm when reading object IDbrian m. carlson, Apr 26, 2021
  6. 06/13 builtin/pack-redundant: avoid casting buffers to struct object_idbrian m. carlson, Apr 26, 2021
  7. 02/13 Always use oidread to read into struct object_idbrian m. carlson, Apr 26, 2021
  8. 07/13 hash: set, copy, and use algo field in struct object_idbrian m. carlson, Apr 26, 2021
  9. 10/13 commit-graph: don't store file hashes as struct object_idbrian m. carlson, Apr 26, 2021
  10. 11/13 builtin/pack-objects: avoid using struct object_id for pack hashbrian m. carlson, Apr 26, 2021
  11. 13/13 hex: print objects using the hash algorithm memberbrian m. carlson, Apr 26, 2021
  12. 04/13 hash: add a function to finalize object IDsbrian m. carlson, Apr 26, 2021
  13. 05/13 Use the final_oid_fn to finalize hashing of object IDsbrian m. carlson, Apr 26, 2021
  14. 08/13 hash: provide per-algorithm null OIDsbrian m. carlson, Apr 26, 2021
  15. 09/13 builtin/show-index: set the algorithm for object IDsbrian m. carlson, Apr 26, 2021
  16. 12/13 hex: default to the_hash_algo on zero algorithm valuebrian m. carlson, Apr 26, 2021

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.