bugmake - Bugs: bug #63260, Avoid infinite recursion.

 
 

bug #63260: Avoid infinite recursion.

Submitter:  Dmitry Goncharov <dgoncharov>
Submitted:  Sun 23 Oct 2022 03:10:12 PM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  4.4 Operating System:  POSIX-Based
Fixed Release:  4.4 Triage Status:  Medium Effort
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 25 Oct 2022 10:18:46 PM UTC, comment #5: 

Thanks, Paul. This indeed fixes the infinite recursion on reiserfs.

Dmitry Goncharov <dgoncharov>
Mon 24 Oct 2022 06:49:34 AM UTC, comment #4: 

Thanks for finding this Dmitry.

I kept your change for posixos.c but I used a different method of fixing setup_tmpfile().  It worked for me with various tests including bad TMPDIR etc.  Hope it's OK for you.

I also added code to detect when the TMPDIR variable is set to a bad value and show a useful error (hopefully), and fall back to using the default.

I hope this will fix the odd output-sync issues on some platforms.

Paul D. Smith <psmith>
Group administrator
Sun 23 Oct 2022 04:22:23 PM UTC, comment #3: 

The same effect can be seen on a filesystem which supports O_TMPFILE, if TMPDIR is set to a non existing directory.

Dmitry Goncharov <dgoncharov>
Sun 23 Oct 2022 03:26:00 PM UTC, comment #2: 

I am not adding a test. Existing tests in features/output-sync fail.

Dmitry Goncharov <dgoncharov>
Sun 23 Oct 2022 03:22:58 PM UTC, comment #1: 

The current make enters infinite recursion on a filesystem that does not support O_TMPFILE.


$ cat makefile
all:; $(info hello, world)
$ # current make from master
$ ~/src/gmake/make/m64/make -Orecurse
Segmentation fault (core dumped)


This is the relevant part of the calls stack (many lines omitted)

...
    #240 0x55df2f9322ca in setup_tmpfile ../src/output.c:212
    #241 0x55df2f93356f in output_start ../src/output.c:348
    #242 0x55df2f933695 in outputs ../src/output.c:364
    #243 0x55df2f934d01 in fatal ../src/output.c:481
    #244 0x55df2f934f2e in pfatal_with_name ../src/output.c:501
    #245 0x55df2f9892b9 in os_anontmp ../src/posixos.c:846
    #246 0x55df2f930f60 in get_tmpfd ../src/misc.c:637
    #247 0x55df2f93226e in output_tmpfd ../src/output.c:189
    #248 0x55df2f9322ca in setup_tmpfile ../src/output.c:212


This patch has two parts.

1. A change in output.c avoids infinite recursion. With the change in output.c alone make no longer crashes. Instead make exits with an error message when the attempt to open a temp file fails.

2. A change in posixos.c allows make to failover to tmpfile + dup when open with O_TMPFILE fails. This change is required on any filesystem where O_TMPFILE is not supported. E.g. the test above was performed on reiserfs.

Dmitry Goncharov <dgoncharov>
Sun 23 Oct 2022 03:10:12 PM 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 #53896:  sv63260.fix added by dgoncharov (3KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -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.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-10-24 psmith StatusNone Fixed
        Assigned toNone psmith
        Open/ClosedOpen Closed
        Fixed ReleaseNone 4.4
        Triage StatusNone Medium Effort
    2022-10-23 dgoncharov Attached File- Added sv63260.fix, #53896

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code