bugmake - Bugs: bug #65324, Fix crash in disable_builtins.

 
 

bug #65324: Fix crash in disable_builtins.

Submitter:  Dmitry Goncharov <dgoncharov>
Submitted:  Sat 17 Feb 2024 04:27:47 AM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  SCM Operating System:  None
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 17 Feb 2024 04:33:47 AM UTC, comment #1: 

Make crashes when -r and MAKEFLAGS= are specified on the command line.
   
On startup make begins to process command line arguments. During processing of "MAKEFLAGS=" make calls reset_makeflags, which in turn calls disable_builtins, which dereferences null suffix_file.



$ ls
makefile
$ cat makefile
all:;
$ ~/src/gmake/make/m64/make -r MAKEFLAGS=
../src/main.c:3476:13: runtime error: member access within null pointer of type 'struct file'
AddressSanitizer:DEADLYSIGNAL
=================================================================
==15066==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000088 (pc 0x560ed1b164e0 bp 0x7ffd870f7ee0 sp 0x7ffd870f7ed0 T0)
==15066==The signal is caused by a READ memory access.
==15066==Hint: address points to the zero page.
    #0 0x560ed1b164e0 in disable_builtins ../src/main.c:3476
    #1 0x560ed1b10e95 in reset_makeflags ../src/main.c:3098
    #2 0x560ed1b712a9 in set_special_var ../src/variable.c:1325
    #3 0x560ed1b72e89 in do_variable_definition ../src/variable.c:1693
    #4 0x560ed1b746a7 in try_variable_definition ../src/variable.c:1889
    #5 0x560ed1b103df in handle_non_switch_argument ../src/main.c:3015
    #6 0x560ed1b110c7 in decode_switches ../src/main.c:3144
    #7 0x560ed1b052ef in main ../src/main.c:1615
    #8 0x7f1abca29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #9 0x7f1abca29e3f in __libc_start_main_impl ../csu/libc-start.c:392
    #10 0x560ed1a94654 in _start (/home/dgoncharov/src/gmake/make/m64/make+0x14c654)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV ../src/main.c:3476 in disable_builtins
==15066==ABORTING
Aborted (core dumped)
$


This is a recent regression. Before a382ac6cd17eedf535407d29bcfc3cef04bbc3bc this was not an issue, because MAKEFLAGS was not marked as special.

Dmitry Goncharov <dgoncharov>
Sat 17 Feb 2024 04:27:47 AM UTC, original submission:  

.

Dmitry Goncharov <dgoncharov>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #55711:  sv65324.diff added by dgoncharov (2KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by dgoncharov (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-02-17 dgoncharov Attached File- Added sv65324.diff, #55711

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code