[Bug 225946] /usr/bin/make

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Feb 16 07:27:14 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225946

            Bug ID: 225946
           Summary: /usr/bin/make
           Product: Base System
           Version: CURRENT
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: itsdavidmarx at gmail.com

/usr/bin/make core dumps with this Makefile for an archive.
Actually the goal is to have the Makefile work without the
foo.o: foo.c entry, as it does with gmake, but for some reason
I think /usr/bin/make realizes it needs to make lib.a(foo.o) 
but doesn't make it.
For:
% uname -a
FreeBSD metro-6.us.oracle.com 12.0-CURRENT FreeBSD 12.0-CURRENT #10
d26791952(trueos-stable-17.12): Sat Dec  9 18:10:09 UTC 2017    
root at chimera:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64
% cat foo.c
void
foo (
  void)
{
        }
% cat Makefile
all: lib.a

lib.a: lib.a(foo.o)
        ranlib lib.a

.c.a:
        cc -c foo.c
        ar rv lib.a foo.o
        rm -f foo.o

foo.o: foo.c
        cc -c foo.c

clobber: clean
        rm lib.a

clean:
        rm -f foo.o
% /usr/bin/make
Segmentation fault
% gdb /usr/bin/make
run
% gdb /usr/bin/make
GNU gdb (GDB) 8.0.1 [GDB v8.0.1 for FreeBSD]
Copyright (C) 2017 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.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd12.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/make...Reading symbols from
/usr/lib/debug//usr/bin/make.debug...done.
done.
(gdb) run
Starting program: /usr/bin/make

Program received signal SIGSEGV, Segmentation fault.
strlen (str=0x0) at /usr/src/lib/libc/string/strlen.c:102
102     /usr/src/lib/libc/string/strlen.c: No such file or directory.
(gdb) where
#0  strlen (str=0x0) at /usr/src/lib/libc/string/strlen.c:102
#1  0x000000000041aba2 in Var_Set (name=<optimized out>, val=<optimized out>,
    ctxt=0x800cf6ac0, flags=0) at /usr/src/contrib/bmake/var.c:973
#2  0x0000000000402090 in Compat_Make (gnp=0x800cf6b80, pgnp=0x800cf6ac0)
    at /usr/src/contrib/bmake/compat.c:657
#3  0x000000000041faf6 in Lst_ForEachFrom (l=0x800d700a0, ln=0x800d3e1c0,
    proc=0x401fd0 <Compat_Make>, d=0x800cf6ac0)
    at /usr/src/contrib/bmake/lst.lib/lstForEachFrom.c:104
#4  0x0000000000402041 in Compat_Make (gnp=0x800cf6ac0, pgnp=0x800cf6940)
    at /usr/src/contrib/bmake/compat.c:544
#5  0x000000000041faf6 in Lst_ForEachFrom (l=0x800d6fdd0, ln=0x800d3e160,
    proc=0x401fd0 <Compat_Make>, d=0x800cf6940)
    at /usr/src/contrib/bmake/lst.lib/lstForEachFrom.c:104
#6  0x0000000000402041 in Compat_Make (gnp=0x800cf6940, pgnp=0x800cf6880)
    at /usr/src/contrib/bmake/compat.c:544
#7  0x000000000041faf6 in Lst_ForEachFrom (l=0x800d6fc20, ln=0x800d71900,
    proc=0x401fd0 <Compat_Make>, d=0x800cf6880)
    at /usr/src/contrib/bmake/lst.lib/lstForEachFrom.c:104
#8  0x0000000000402041 in Compat_Make (gnp=0x800cf6880, pgnp=0x800cf67c0)
    at /usr/src/contrib/bmake/compat.c:544
#9  0x000000000041faf6 in Lst_ForEachFrom (l=0x800d6fb00, ln=0x800d718a0,
    proc=0x401fd0 <Compat_Make>, d=0x800cf67c0)
    at /usr/src/contrib/bmake/lst.lib/lstForEachFrom.c:104
---Type <return> to continue, or q <return> to quit---
#10 0x0000000000402041 in Compat_Make (gnp=0x800cf67c0, pgnp=0x800cf67c0)
    at /usr/src/contrib/bmake/compat.c:544
#11 0x00000000004024e6 in Compat_Run (targs=0x800cfa3a0)
    at /usr/src/contrib/bmake/compat.c:761
#12 0x000000000040cce7 in runTargets () at /usr/src/contrib/bmake/main.c:960
#13 main (argc=1, argv=<optimized out>) at /usr/src/contrib/bmake/main.c:1498
(gdb) x/i $rip
=> 0x460b7f <strlen+31>:        mov    (%rcx),%rax
(gdb) x/x $rcx
0x0:    Cannot access memory at address 0x0
(gdb)
Appears to be strlen of a null pointer.
Whatever garbage I give make, it should not core dump.
And this does work with gmake.

Thanks.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list