Project

General

Profile

Bug #7214

make buffer under-read while parsing conditional variables

Added by Andrew Stormont almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2016-07-23
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:

Description

This was discovered after building a 64-bit version of make. The 32-bit version also suffers from the same problem, but for some reason it doesn't cause it to core dump. Here's the dump from the 64-bit version:

root@omnios:/root/illumos-gate# pstack usr/src/lib/libsocket/amd64/core
core 'usr/src/lib/libsocket/amd64/core' of 15744:       /root/illumos-gate/usr/src/tools/make/bin/make install
 fffffd7fff240bb8 wcscmp (fffffd83ffdfa580, fffffd7fffdf955c) + 18
 0000000000410111 _ZL24add_pattern_conditionalsP5_Name () + 100
 000000000041254f _Z6donameP5_Name7BooleanS1_S1_ () + 329
 00000000004187b2 _ZL12make_targetsiPPc7Boolean () + 34
 000000000041b58c main () + 2666
 000000000040d3fc _start () + 6c

Edit: To clarify, the issue is in the add_pattern_conditionals function in usr/src/cmd/make/bin/doname.cc which does some arithmetic when matching patterns with targets. For some targets it ends up passing a negative value to get_string() which returns an invalid address. When this address is passed to wcscmp (behind the IS_WEQUAL macro) make dumps.

History

#2

Updated by Andrew Stormont almost 4 years ago

  • Description updated (diff)
#3

Updated by Andrew Stormont almost 4 years ago

I have verified (by looking at logs) that the make behaviour has not changed. Conditional variables are still passed to targets like they should be.

#4

Updated by Electric Monk almost 4 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit 67c3092ccd4e8c261df7eded9df072ff9c4e330b

commit  67c3092ccd4e8c261df7eded9df072ff9c4e330b
Author: Andrew Stormont <astormont@racktopsystems.com>
Date:   2016-07-26T17:24:12.000Z

    7214 make buffer under-read while parsing conditional variables
    Reviewed by: Richard Lowe <richlowe@richlowe.net>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Approved by: Dan McDonald <danmcd@omniti.com>

Also available in: Atom PDF