Bug 154562 - make(1): corrupted stack access when provided invalid identifiers
Summary: make(1): corrupted stack access when provided invalid identifiers
Status: Closed Overcome By Events
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 8.1-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-06 23:30 UTC by Enji Cooper
Modified: 2015-11-09 10:16 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Enji Cooper freebsd_committer freebsd_triage 2011-02-06 23:30:10 UTC
Looks like make is corrupting its stack based on the fact that this simple Makefile doesn't contain references to the text noted here:

Output on toaster.local:

> make -f Makefile
Unknown modifier '\'

Unknown modifier '\'

Unknown modifier '\'

"Makefile", line 4: warning:  is deprecated in favour of 
"Makefile", line 6: if-less endif
"Makefile", line 7: for-less endfor
"Makefile", line 8: for-less endfor
"Makefile", line 3: Unassociated shell command "echo {old}) && !defined(${new})"
"Makefile", line 4: warning:  is deprecated in favour of 
"Makefile", line 6: if-less endif
"Makefile", line 7: for-less endfor
"Makefile", line 8: for-less endfor
"Makefile", line 3: Unassociated shell command "echo {old}) && !defined(${new})"
"Makefile", line 4: warning:  is deprecated in favour of 
"Makefile", line 6: if-less endif
"Makefile", line 7: for-less endfor
"Makefile", line 8: for-less endfor
make: fatal errors encountered -- cannot continue

Output on bayonetta.local:

$ make -f ~/substitution-corruption.mk 
Unknown modifier '\'

Unknown modifier '\'

Unknown modifier '\'

echo ���������������������������������������������������������������������������������������������������������������������������&
 #65533;��������������������������������������������������������������������������������:.*
���������������������������������������������������������������������������������������������������������������������������&#6553
 3;��������������������������������������������������������������������������������:.*
echo ���������������������������������������������������������������������������������������������������������������������������&
 #65533;��������������������������������������������������������������������������������:.*
���������������������������������������������������������������������������������������������������������������������������&#6553
 3;��������������������������������������������������������������������������������:.*
echo ���������������������������������������������������������������������������������������������������������������������������&
 #65533;��������������������������������������������������������������������������������:.*
���������������������������������������������������������������������������������������������������������������������������&#6553
 3;��������������������������������������������������������������������������������:.*

How-To-Repeat: cat > substitution-corruption.mk <<EOF
all:
.for i in a/b/c a/b/c.d ./a/b/c/d.e
	echo ${i:S/^\.\//:S/\/\/_/g:S/\./__/g:S/-/____/g}
.endfor
EOF
make -f substitution-corruption.mk all
Comment 1 Enji Cooper freebsd_committer freebsd_triage 2011-02-06 23:33:53 UTC
    As a note, NetBSD's make does the right thing:

$ bmake -f ~/substitution-corruption.mk
bmake: Unknown modifier '\'
echo

bmake: Unknown modifier '\'
echo

bmake: Unknown modifier '\'
echo

Thanks!
-Garrett
Comment 2 Enji Cooper freebsd_committer freebsd_triage 2012-12-01 03:45:46 UTC
bmake doesn't suffer from this problem:

# bmake -f substitution-corruption.mk all
bmake: "/root/substitution-corruption.mk" line 3: Need an operator
bmake: "/root/substitution-corruption.mk" line 3: Need an operator
bmake: "/root/substitution-corruption.mk" line 3: Need an operator
bmake: Fatal errors encountered -- cannot continue
bmake: stopped in /root

Please close this PR once fmake is killed in base.
Thanks!
-Garrett
Comment 3 Enji Cooper freebsd_committer freebsd_triage 2015-11-09 10:16:42 UTC
Can't repro this with bmake. Closing.