1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-24 05:23:45 +02:00
llvm-mirror/lib/Support/Unix
Oleg Ranevskyy 2d3f6608fd [Clang/Support/Windows/Unix] Command lines created by clang may exceed the command length limit set by the OS
Summary:
Hi Rafael,

Would you be able to review this patch, please?

(Clang part of the patch is D15832).

When clang runs an external tool, e.g. a linker, it may create a command line that exceeds the length limit.

Clang uses the llvm::sys::argumentsFitWithinSystemLimits function to check if command line length fits the OS 

limitation. There are two problems in this function that may cause exceeding of the limit:

1. It ignores the length of the program path in its calculations. On the other hand, clang adds the program 

path to the command line when it runs the program.

2. It assumes no space character is inserted after the last argument, which is not true for Windows. The flattenArgs function adds the trailing space for *each* argument. The result of this is that the terminating NULL character is not counted and may be placed beyond the length limit if the command line is exactly 32768 characters long. The WinAPI's CreateProcess does not find the NULL character and fails.

Reviewers: rafael, ygao, probinson

Subscribers: asl, llvm-commits

Differential Revision: http://reviews.llvm.org/D15831

llvm-svn: 256866
2016-01-05 19:56:12 +00:00
..
COM.inc Fix build broken by incorrect class name. 2015-04-27 17:22:30 +00:00
Host.inc Triple: refactor redundant code. 2015-02-12 15:12:13 +00:00
Memory.inc [SectionMemoryManager] Make better use of virtual memory 2015-12-16 11:13:23 +00:00
Mutex.inc
Path.inc Use static instead of anonymous namespace for helper functions. NFC. 2015-11-02 14:57:24 +00:00
Process.inc Avoid buffered reads of /dev/urandom 2015-12-11 22:52:32 +00:00
Program.inc [Clang/Support/Windows/Unix] Command lines created by clang may exceed the command length limit set by the OS 2016-01-05 19:56:12 +00:00
README.txt
RWMutex.inc
Signals.inc Use array_lengthof instead of manually calculating it. NFC 2015-12-01 06:12:59 +00:00
ThreadLocal.inc Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
TimeValue.inc Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
Unix.h Remove the configure and cmake checks for sys/wait.h 2015-08-04 06:29:58 +00:00
Watchdog.inc Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00

llvm/lib/Support/Unix README
===========================

This directory provides implementations of the lib/System classes that
are common to two or more variants of UNIX. For example, the directory
structure underneath this directory could look like this:

Unix           - only code that is truly generic to all UNIX platforms
  Posix        - code that is specific to Posix variants of UNIX
  SUS          - code that is specific to the Single Unix Specification
  SysV         - code that is specific to System V variants of UNIX

As a rule, only those directories actually needing to be created should be
created. Also, further subdirectories could be created to reflect versions of
the various standards. For example, under SUS there could be v1, v2, and v3
subdirectories to reflect the three major versions of SUS.