Re: Embedded ARM GNU 8.2.1 Archive Fail on Lib Target

Steven Watanabe via Boost-build <[email protected]> Tue, 12 Feb 2019 18:12:09 -0700
Newsgroups gmane.comp.lib.boost.build
Organization Providere Consulting, Inc.
Message-ID <[email protected]>
AMDG

On 2/12/19 3:47 PM, codex653 via Boost-build wrote:
> <snip>
> gcc.archive
> ..\..\..\Thor\lib\stm32hal_f7\bin\gcc-8.2.1\debug\ThorMCU-STM32F767\link-static\libHAL_DRIVER.a
> Executing using a command file and the shell:
> ..\..\..\Thor\lib\stm32hal_f7\bin\gcc-8.2.1\debug\ThorMCU-STM32F767\link-static\libHAL_DRIVER.a

Okay.  I think I've identified the problem.
It appears to be a use-after-free error in
the engine.  The bug appears when all of the following are true:
- SHELL is % (meaning to execute directly, without
  going through cmd.exe)
- The command cannot be executed directly (In this case
  because it requires two separate subprocesses, ar and ranlib),
  which results in falling back to the cmd.exe.
- The action is declared as piecemeal, and
- The action needs to be split into multiple commands to
  avoid overflowing the command line.

The shell is replaced and the original freed at
execnt.c:283 but then make1.c:1196 attempts to
reuse the dead shell using a different pointer.

The optimization was introduced in
d1748e252e4b16d0f90a062d288395aee22634e4 (19 Jun 2012)

The refactoring that caused the bug was:
d23202eeff93d4d9d82102ac1cd8623a847631d6 (25 Jun 2012)

In Christ,
Steven Watanabe
_______________________________________________
Unsubscribe & other changes: https://lists.boost.org/mailman/listinfo.cgi/boost-build