bugmake - Bugs: bug #57014, make-4.2.91 segfaults under...

 
 

bug #57014: make-4.2.91 segfaults under Solaris 10 when many files are involved

Submitter:  None
Submitted:  Mon 07 Oct 2019 01:01:57 PM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Duplicate Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  4.3 Operating System:  POSIX-Based
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 09 Oct 2019 06:30:29 AM UTC, comment #5: 

Thank you. Indeed it is solved in 4.2.92.

Anonymous
Tue 08 Oct 2019 12:06:59 PM UTC, comment #4: 

Thanks for the investigation.  I suppose you are not subscribed to the bug-make mailing list and without an email address here we couldn't make contact directly.

There was some discussion on bug-make as to whether this was a duplicate of a known issue; your comment below confirms that it is.  This problem has already been fixed in the Git source repo and will be available in the next release/release candidate.

Thanks for reporting and debugging!

Paul D. Smith <psmith>
Group administrator
Tue 08 Oct 2019 11:21:36 AM UTC, comment #3: 

Please have a look into src/hash.c, in sum_up_to_nul(). The memcpy() (line 416) segfaults because the bytes after \0 are not readable, in the case where the filename (or whatever is hashed here) ends immediately (or almost immediately) before the boundary.

I replaced 'memcpy(&val, (p), 4);' with

val = 0;
if (p[0] == 0) {
  memcpy(&val, (p), 1);
} else if (p[1] == 0) {
  memcpy(&val, (p), 2);
} else if (p[2] == 0) {
  memcpy(&val, (p), 3);
} else {
  memcpy(&val, (p), 4);
};

with success.

Another solution is to always manage 3 bytes after \0 for the hashed strings.

I suppose this sheds some (more) light on the subject.

Anonymous
Mon 07 Oct 2019 02:20:26 PM UTC, comment #2: 

Inserting many fprintf() incantations into the source code shows that
glob (name, GLOB_ALTDIRFUNC, NULL, &gl)
(line 3391 of src/read.c)
seems the responsible.



Anonymous
Mon 07 Oct 2019 01:10:11 PM UTC, comment #1: 

Thanks for reporting.

That seems bad, but unfortunately there's nothing I can do with this report as-is.  It doesn't fail on any system I have access to, so the only way it will be addressed, other than by accident, is if someone can provide details of the segmentation fault.

If someone can use a debugger to obtain a stacktrace where the segmentation fault occurs that would be a great first step.

Paul D. Smith <psmith>
Group administrator
Mon 07 Oct 2019 01:01:57 PM UTC, original submission:  

Hello,

With the following Makefile, make-4.2.91 segfaults on my Solaris 10:

% cat Makefile
include /dev/null
dummy: subdir/*.c
include /dev/null
%

This needs some preparation: many files in subdir, including at least one subfolder:

% mkdir -p subdir/subsubdir
% touch `seq -f subdir/%5.0f 11001 12000` # seq does not exist on my solaris, yet you understand the idea
% make -d
GNU Make 4.2.91
Built for sparc-sun-solaris2.10
Copyright (C) 1988-2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Reading makefile 'Makefile'...
Reading makefile '/dev/null' (search path) (no ~ expansion)...
Segmentation fault
%

Of course the two include's are not necessary, but are useful to pinpoint the bug.
This 'make' was built with '--disable-posix-spawn'.

I insist that when there is no subfolder in subdir, no segfault shows up.

I was unable to reproduce on linux and/or cygwin. I have no access on Solaris 11.

Regards,

Denis Excoffier.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

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)
  •  

    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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-10-08 psmith StatusNone Duplicate
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code