Hi,

> tar fails with:
> ./tar: memory exhausted./tar: Error is not recoverable: exiting now

Thanks for reporting this.

For a proper bug report, next time, please not only state the results
(the error message), but also what you did. So that we have a chance
to reproduce and investigate the problem from our side.

From the documentation of 'Scudo'
  https://source.android.com/docs/security/test/scudo
  https://llvm.org/docs/ScudoHardenedAllocator.html
I guess that you have been building GNU tar with CC="clang -fsanitize=scudo".

> C11 (§7.22.3.1) mandates that size must be an integral multiple of alignment.
> Glibc's default allocator historically ignored this constraint, but Scudo 
> strictly enforces it,
> returning EINVAL for aligned_alloc(4096, 10240).

C11 had been superseded by C17 and C23, and as explained in the manual page
https://man7.org/linux/man-pages/man3/aligned_alloc.3.html
it is no longer mandatory that _size_ be a multiple of _alignment_.

> Bug found out to be in gnulib's lib/alignalloc.h .

It's a bit more complicated than that:

  - As mentioned above, the bug is on Scudo's side.

  - Gnulib has a module 'aligned_alloc' that fixes this and similar issues:
    https://www.gnu.org/software/gnulib/manual/html_node/aligned_005falloc.html
    It does so mostly through the configure test, which ought to recognize
    that Scudo's implementation of aligned_alloc is buggy.

  - But Gnulib's 'alignalloc' module does *not* depend on 'aligned_alloc',
    but instead uses aligned_alloc only if it works.

I think the fix should be that Gnulib's 'alignalloc' module reuses the
configure test from the 'aligned_alloc' module. This will simplify the
code in lib/alignalloc.h.

Bruno




Reply via email to