bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: Segmentation Fault on Exported Resursively Expanded Variable


From: MIAOW Miao
Subject: Re: Re: Segmentation Fault on Exported Resursively Expanded Variable
Date: Tue, 16 Jan 2024 06:59:30 +0000

Thank you for investing in this problem.

I reproduced the problem both in a virtual machine with newly installed fedora 39 and a ubuntu 22.04 laptop with original GNU make 4.4.1.
My commands to build on original GNU make 4.4.1 are as follows:

cd make-4.4.1
autoreconf -vfi
autoupdate -vf
./configure CFLAGS="-Og -g -ggdb" LDFLAGS="-Og -g -ggdb"
make

The following files are attatched to this email
  • Full command line history on ubuntu and fedora
  • Binary of make that build with symbols for debug on fedora
  • Coredump on fedora
My backtrace is basically consistent with that of Carlqvist <hc94@poolhem.se>.
It seems to me that (*ep)[nl] goes beyond the bound of string ep when recursively_expand_for_file()  processing the variable name.

#0  recursively_expand_for_file (v=v@entry=0xad5740, file=file@entry=0x0) at src/expand.c:119
119           if ((*ep)[nl] == '=' && strncmp (*ep, v->name, nl) == 0)
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.38-14.fc39.x86_64
(gdb) bt
#0  recursively_expand_for_file (v=v@entry=0xad5740, file=file@entry=0x0) at src/expand.c:119
...
#20 0x000000000041acec in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at src/main.c:2918
(gdb) p *ep
$1 = 0x7ffde9e95fdc "OLDPWD=/tmp"
(gdb) p nl
$2 = 41
(gdb) p *v
$3 = {name = 0xad5700 "THIS_LONG_VARIABLE_NAME_PRODUCE_THE_ERROR", ...

On Mon, 15 Jan 2024 14:37:31 -0500 Paul Smith <psmith@gnu.org> wrote:
On Mon, 2024-01-15 at 11:21 +0000, MIAOW Miao wrote:
> I found name of exported resursively expanded variable with $(shell
> ...) cannot be too long in gnu make version >= 4.4, otherwise a
> segmentation fault is triggled. I'm not sure if variable-name-too-
> long is a bug. However, make is
> supposed to tell me what's going wrong.
>
> Here is a Makefile that can reproduce the segmentation fault:
> > THIS_LONG_VARIABLE_NAME_PREDUCE_THE_ERROR= $(shell echo hello)
> > exportTHIS_LONG_VARIABLE_NAME_PREDUCE_THE_ERROR
> >
> > all: ; echo "abc"

I was not able to reproduce this problem, either with my own build of
GNU Make 4.4.1 or with a binary extracted from the RPM from the link
you provided.  I tried running under valgrind and with a binary
compiled with ASAN, with and withoug debugging enabled, ran the test
1000 times.  I also tried GNU Make 4.4.

If you can generate a coredump please examine it with GDB and send
along at least the backtrace.
Best regards,
Yiren Guo

Attachment: cmd-ubuntu2204.log
Description: cmd-ubuntu2204.log

Attachment: cmd-fedora39.log
Description: cmd-fedora39.log

Attachment: make
Description: make

Attachment: core.23565
Description: core.23565


reply via email to

[Prev in Thread] Current Thread [Next in Thread]