Subject: bug#53136: 28.0.90; segfault in lock_file

From: Po Lu <[email-masked]>
Date: Wed, 12 Jan 2022 11:04:53 +0800

Paul Eggert <[email-masked]> writes:

> On 1/10/22 17:05, Po Lu wrote:
>> Po Lu <[email-masked]> writes:
>> 
>>> That was an unrelated problem.  This bug is on GNU/Linux, when running
>>> under Valgrind.  (I was trying to find the GC bug from last month.)
>> It happens with valgrind-3.18.1-7.fc35, but not
>> valgrind-3.17.0-13.fc35.
>> Paul, any idea why this may be?  Thanks.
>
> Looking at the 3.18.1 release notes:
>
> https://valgrind.org/docs/manual/dist.news.html
>
> what jumps out at me are these entries:
>
>  * glibc 2.34, which moved various functions from libpthread.so into
>    libc.so, is now supported.
>  407589  [Linux] Add support for C11 aligned_alloc() and GNU reallocarray()
>  442061  very slow execution under Fedora 34 (readdwarf3)
>
> It could be that these changes caused a bug in Valgrind. I think Emacs
> is using aligned_alloc and reallocarray.
>
> I tried building Emacs master (savannah) on both Ubuntu 21.10 x86-64,
> which has valgrind-3.17.0, and on Fedora 35 x86-64, which has
> valgrind-3.18.1, and both instances worked for me. I was running the
> Fedora 35 instance on an AMD Phenom II X4 910e.

> I merely stole a lock using an interactive Emacs as my test,
> though. What test are you using to reproduce the bug?

(lock-file "~/any/nonexistent/file/with/a/very/long/path") will
consistently reproduce the bug.