native_client/src/native_client.git
47 min agoRevert r13667: "Re-enable use of Goma on Windows, except when using the PNaCl toolchain" master
mseaborn@chromium.org [Fri, 29 Aug 2014 00:23:26 +0000 (00:23 +0000)]
Revert r13667: "Re-enable use of Goma on Windows, except when using the PNaCl toolchain"

This change failed when rolled into Chromium.  It started producing
the following Python traceback:

Traceback (most recent call last):
  File "../native_client/build/build_nexe.py", line 1118, in <module>
    sys.exit(Main(sys.argv))
  File "../native_client/build/build_nexe.py", line 1061, in CompileThread
    output_queue.put(build.Compile(filename))
  File "../native_client/build/build_nexe.py", line 639, in Compile
    self.CleanOutput(outd)
  File "../native_client/build/build_nexe.py", line 458, in CleanOutput
    RemoveFile(out)
  File "../native_client/build/build_nexe.py", line 63, in RemoveFile
    os.remove(FixPath(path))
WindowsError

Note that the CompileThread() code path is conditional on
"build.gomacc".  Presumably this is trying to remove a file that is
currently open, which usually fails on Windows.

> Re-enable use of Goma on Windows, except when using the PNaCl toolchain
>
> Goma does not work fully for PNaCl on Windows.
>
> Since Goma expects Cygwin-like path is used on Windows,
> it will generate wrong debug information if it is not true.
> To avoid to use wrong debug information, let me disable Goma
> on such a case.
>
> BUG=390764
>
> Review URL: https://codereview.chromium.org/495733003

BUG=https://code.google.com/p/chromium/issues/detail?id=390764
TEST=none
TBR=yyanagisawa@chromium.org

Review URL: https://codereview.chromium.org/523473002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13675 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

82 min agoUse uint32_t for untrusted pointer args: sysconf() and other syscalls
mseaborn@chromium.org [Thu, 28 Aug 2014 23:48:37 +0000 (23:48 +0000)]
Use uint32_t for untrusted pointer args: sysconf() and other syscalls

Use uint32_t instead of a pointer type for syscall argument types.  This
reduces the amount of type casting.  This is cleaner because these
arguments are not valid trusted pointers, so using a pointer type is
misleading.

This converts:
 * imc_makeboundsock()
 * imc_sendmsg()
 * imc_recvmsg()
 * thread_create()
 * cond_timed_wait_abs()
 * sysconf()

Also remove a declaration for NaClSysCondTimedWaitRel(), which is not
defined anywhere.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3917
TEST= build

Review URL: https://codereview.chromium.org/517463002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13674 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

110 min agoPNaCl: Update libc++ revision in pnacl/COMPONENT_REVISIONS
dschuff@chromium.org [Thu, 28 Aug 2014 23:20:43 +0000 (23:20 +0000)]
PNaCl: Update libc++ revision in pnacl/COMPONENT_REVISIONS

This pulls in the following libc++ change:

67bc7e5: (dschuff@chromium.org) Include libcxxabi in build for Darwin

and the following binutils change:
9650253: (dschuff@chromium.org) Add $ORIGIN/../lib to RPATH for gold

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3930
TEST= PNaCl toolchain trybots
R=jfb@chromium.org

Review URL: https://codereview.chromium.org/522443002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13673 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 hours agoExpose LLC's -force-align-stack flag to pnacl-translate
dschuff@chromium.org [Thu, 28 Aug 2014 22:30:41 +0000 (22:30 +0000)]
Expose LLC's -force-align-stack flag to pnacl-translate

x86-32 glibc's ld.so is built to maintain 4-byte stack alignment,
instead of 16 bytes that we use everywhere else. This means the IRT
must be built to tolerate 4-byte alignment when it is called. To build
the IRT with pnacl-clang, we can use LLC's -force-align-stack flag which
causes the stack to be realigned on function entry (it has always
maintained 16 byte stack alignment calling out, but has assumed
that the stack was aligned on entry).

R=mseaborn@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3910

Review URL: https://codereview.chromium.org/508823007

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13672 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

7 hours agoAdd comment about updating the trybot list in the Commit Queue's code
mseaborn@chromium.org [Thu, 28 Aug 2014 17:21:53 +0000 (17:21 +0000)]
Add comment about updating the trybot list in the Commit Queue's code

This is a follow-up to the CQ change that I committed recently:

   Fix NaCl CQ: Change trybot list to match the list in native_client/PRESUBMIT.py
   ...
   This removes the logic that scraped the trybot list from the JSON API,
   which hasn't been working very well.  It would get out of sync with the
   canonical list in PRESUBMIT.py.  The "validator_opt" bot is very slow
   and was never intended to be run by default.

BUG= https://code.google.com/p/chromium/issues/detail?id=399059
TEST= none
R=bradnelson@google.com

Review URL: https://codereview.chromium.org/515253002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13671 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

7 hours agoFix munmap() with length > 0xffff0000 to behave consistently on 32/64-bit
mseaborn@chromium.org [Thu, 28 Aug 2014 17:19:49 +0000 (17:19 +0000)]
Fix munmap() with length > 0xffff0000 to behave consistently on 32/64-bit

Before this change, munmap() with such a length would return EINVAL on
x86-32 (as if length == 0) but EFAULT on x86-64 (as if length ==
0x100000000).

This was because the length gets rounded up to a multiple of 64k.  The
code was using size_t, so whether this wrapped around to 0 depended on
the size of size_t.

Fix this by using uint32_t for the length, since uint32_t's size
doesn't vary.

Adds tests for two cases:
 * munmap() with length == 0
 * munmap() with length == 0xffffffff

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3917
TEST= run_mmap_test

Review URL: https://codereview.chromium.org/499963002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13670 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

19 hours agoPNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
dbrazdil@google.com [Thu, 28 Aug 2014 05:20:50 +0000 (05:20 +0000)]
PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS

This pulls in the following LLVM change:

a667d44: (dbrazdil@chromium.org) Add StripTls MinSFI LLVM pass

BUG= https://code.google.com/p/chromium/issues/detail?id=397177
TEST= PNaCl toolchain trybots

Review URL: https://codereview.chromium.org/510943004

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13669 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

29 hours agoForce rebuild on cmd change.
noelallen@google.com [Wed, 27 Aug 2014 19:26:03 +0000 (19:26 +0000)]
Force rebuild on cmd change.

Adds an option '--force-rebuild' which will automatically get set if
the command-line options to build_nexe.py, have changed between this
and the previous invocation.  The previous invocation is stored at the
output name + '.cmd'.

R=bradnelson@google.com, mcgrathr@chromium.org
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3927

Review URL: https://codereview.chromium.org/507123002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13668 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

46 hours agoRe-enable use of Goma on Windows, except when using the PNaCl toolchain
yyanagisawa@chromium.org [Wed, 27 Aug 2014 02:40:32 +0000 (02:40 +0000)]
Re-enable use of Goma on Windows, except when using the PNaCl toolchain

Goma does not work fully for PNaCl on Windows.

Since Goma expects Cygwin-like path is used on Windows,
it will generate wrong debug information if it is not true.
To avoid to use wrong debug information, let me disable Goma
on such a case.

BUG=390764

Review URL: https://codereview.chromium.org/495733003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13667 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 days agoAdded initial implementation of the IRT extension interface.
dyen@chromium.org [Tue, 26 Aug 2014 21:57:21 +0000 (21:57 +0000)]
Added initial implementation of the IRT extension interface.

The IRT extension interface is meant to be a standard interface for
standard libraries. This CL implements the API to supply an interface
as well as hooking into the NaCl newlib implementation's file system
calls.

A new set of unit tests have also been added under the name "irt_ext".
The intention is to have a minimal implementation of the various
extension interfaces to be sure the interfaces are called correctly
inside of the standard library. In the initial CL I have added stub
functions for all the file system calls and implemented a minimal
version of all the directory functions. There are unit tests which test
these directory functions which should work under newlib.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3918
TESTS= trybots, scons test "run_irt_ext_libc_test_irt" under newlib

Review URL: https://codereview.chromium.org/486363002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13666 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 days agoUpdate revision for PNaCl r13647->r13658
kschimpf@google.com [Tue, 26 Aug 2014 20:32:03 +0000 (20:32 +0000)]
Update revision for PNaCl r13647->r13658

Pull the following PNaCl changes into NaCl:
  r13652: (kschimpf@google.com) PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
    | 04beda3: (dbrazdil@chromium.org) Added MinSFI RenameEntryPoint LLVM pass
    | 2da8241: (kschimpf@google.com) Speed up flattening global variable initializers in PNaCl.
  r13653: (mcgrathr@chromium.org) toolchain_build: Update binutils revision
  r13658: (jvoung@chromium.org) Avoid up/downloading scratch copy of pnaclmm.bc from generating libpnaclmm.a.

BUG= none
BUG= https://code.google.com/p/chromium/issues/detail?id=397177
R= jvoung@chromium.org, kschimpf@google.com, dyen@chromium.org, mcgrathr@chromium.org
TEST=git try
NOTRY=true
(Please LGTM this change and tick the "commit" box)

Review URL: https://codereview.chromium.org/511513003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13661 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

3 days agoPNaCl dynamic loader: Fix a corner case with mapping the BSS
mseaborn@chromium.org [Mon, 25 Aug 2014 23:23:30 +0000 (23:23 +0000)]
PNaCl dynamic loader: Fix a corner case with mapping the BSS

Fix a corner case in which the BSS goes beyond the extent of the file.
Before this fix, the memset() call for zeroing the BSS would crash.

Currently this corner case only occurs with PSOs that contain no
functions.  Otherwise, PNaCl's linker (Gold) places the code segment
after the data segments, with padding upto a 64k page size inbetween.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3873
TEST="data_only_pso_largebss" case in run_pnacl_dynamic_loading_test
R=mcgrathr@chromium.org

Review URL: https://codereview.chromium.org/498893002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13660 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

3 days agoUse uint32_t for untrusted pointer args: read() and write() syscalls
mseaborn@chromium.org [Mon, 25 Aug 2014 22:14:56 +0000 (22:14 +0000)]
Use uint32_t for untrusted pointer args: read() and write() syscalls

Use uint32_t instead of a pointer type for syscall argument types.  This
reduces the amount of type casting.  This is cleaner because these
arguments are not valid trusted pointers, so using a pointer type is
misleading.

Also use uint32_t for the untrusted-size_t syscall args.  This allows
us to remove the casting on the NaClVmIoWillStart()/NaClVmIoHasEnded()
calls without getting a truncation compiler warning on 64-bit Windows.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3917
TEST= build
R=ncbray@chromium.org

Review URL: https://codereview.chromium.org/487063003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13659 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

3 days agoAvoid up/downloading scratch copy of pnaclmm.bc from generating libpnaclmm.a.
jvoung@chromium.org [Mon, 25 Aug 2014 21:04:38 +0000 (21:04 +0000)]
Avoid up/downloading scratch copy of pnaclmm.bc from generating libpnaclmm.a.

Noticed the extra file under lib/ and lib-bc-*/

BUG=none
NOTRY=true
(toolchain build w/ explicit tries)

Review URL: https://codereview.chromium.org/499603002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13658 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

3 days agoDisable two glibc tests: tst-truncate and tst-truncate64
sbc@chromium.org [Mon, 25 Aug 2014 12:17:10 +0000 (12:17 +0000)]
Disable two glibc tests: tst-truncate and tst-truncate64

This fixes the glibc toolchain bots.

This change was intented to be part of r13638.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3583
R=bradnelson@google.com

Review URL: https://codereview.chromium.org/489353002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13657 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

5 days agoFix regression in loading of mmap()'able nexes on Windows
mseaborn@chromium.org [Sat, 23 Aug 2014 23:55:09 +0000 (23:55 +0000)]
Fix regression in loading of mmap()'able nexes on Windows

r13580 caused a regression in loading an initial nexe on Windows, for
the case where the nexe descriptor is marked as loadable via mmap()
(with validation caching, etc.).

The problem is that NaClElfFileMapSegment() rounds the segment size up
to a multiple of 64k.  For some nexes, this means its Map() call tries
to map beyond the file's extent, which fails on Windows (but not Unix).
r13580 made this failure into a fatal error, whereas previously
NaClElfFileMapSegment() would fall back to non-mmap-based loading.

This failure occurred for nexes where:
 1) the code segment appears at the end of the file;
 2) the code segment isn't HLT-padded to a 64k-multiple size.

This includes QuickOffice's nexes.  Older versions of the PNaCl
toolchain (using the Gold linker) produce nexes with this layout.

I'm fixing this by restoring NaClHostDescMap()'s error-handling
behaviour from before r13580 (which that change removed), but only for
trusted mappings.  For untrusted memory mappings, we'll still handle
sandbox mmap holes robustly by aborting.

Restoring the old behaviour this way is intended to be a low-risk fix
that can be backported to branches.

In later changes, we should change NaClElfFileMapSegment() so that it
doesn't map beyond a file's extent.

I tested this manually with QuickOffice's point_x86_32.nexe.  With
"safe_for_mmap = 1" set in elf_util.c, sel_ldr prints the following,
indicating that the fallback works:

[...] MapViewOfFileEx failed at 0x039c0000, got 0x00000000, err 5
[...] NaClElfFileMapSegment: Could not make scratch mapping, falling back to reading
PpapiPluginStart: PPAPI hooks not found

I've also added a unit test for Map().  This refactors the test code to
split out MakeTempFileNaClDesc() for code reuse.

BUG=https://code.google.com/p/chromium/issues/detail?id=406632
TEST=run_service_runtime_tests + manual test of nexe load
R=ncbray@chromium.org

Review URL: https://codereview.chromium.org/464393004

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13655 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

5 days agoRevert r13646: "Re-enable use of goma on Windows."
mseaborn@chromium.org [Sat, 23 Aug 2014 23:27:26 +0000 (23:27 +0000)]
Revert r13646: "Re-enable use of goma on Windows."

The last update of nacl_revision in Chromium got reverted (by
https://codereview.chromium.org/491053007/) due to a compile error on
Windows, which I suspect was due to a Goma-related problem.

> Re-enable use of goma on Windows.
>
> BUG=390764
> TEST=NaCl trybots + Chromium's Windows trybot
>
> Review URL: https://codereview.chromium.org/491213002

R=ncbray@chromium.org

Review URL: https://codereview.chromium.org/504653002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13654 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

6 days agotoolchain_build: Update binutils revision
mcgrathr@chromium.org [Fri, 22 Aug 2014 22:26:02 +0000 (22:26 +0000)]
toolchain_build: Update binutils revision

This brings in various upstream fixes, including this necessary one:

b08b9f0 Fix PR ld/17277: bogus dynamic relocs and TEXTREL for ARM PC-relative relocs

BUG= none
TEST= toolchain trybots
R=dyen@chromium.org

Review URL: https://codereview.chromium.org/498863002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13653 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

6 days agoPNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
kschimpf@google.com [Fri, 22 Aug 2014 20:07:05 +0000 (20:07 +0000)]
PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS

This pulls in the following LLVM changes:

04beda3: (dbrazdil@chromium.org) Added MinSFI RenameEntryPoint LLVM pass
2da8241: (kschimpf@google.com) Speed up flattening global variable initializers in PNaCl.

BUG= https://code.google.com/p/chromium/issues/detail?id=397177
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3908
TEST= PNaCl toolchain trybots
R=jvoung@chromium.org

Review URL: https://codereview.chromium.org/501543002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13652 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

6 days agoReduce bot cycle time: Don't run the "noragel" Gyp build
mseaborn@chromium.org [Fri, 22 Aug 2014 19:06:56 +0000 (19:06 +0000)]
Reduce bot cycle time: Don't run the "noragel" Gyp build

This removes the build step that builds the codebase with Gyp using the
old (non-Ragel-based) x86 validators.

The original purpose of this step was to keep the old validators working
in case we want to switch back to using them, but this is no longer an
option we need to keep open.

We're currently keeping the old validators around for testing against,
but that doesn't require the Gyp build.

This should reduce trybot times by about:
 * 1.5 minutes on nacl-precise32_newlib_opt
 * 2.25 minutes on nacl-precise32_newlib_dbg
 * 5.5 minutes on nacl-win64_newlib_opt
 * 7 minutes on nacl-win64_newlib_dbg

BUG=none
TEST=trybots

Review URL: https://codereview.chromium.org/476243005

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13651 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

6 days agoPre-Submit script no longer depends on cwd being in NaCl root.
dyen@chromium.org [Fri, 22 Aug 2014 16:41:26 +0000 (16:41 +0000)]
Pre-Submit script no longer depends on cwd being in NaCl root.

Running "git try" from directories other than the root directory would
cause incorrect behavior with the try jobs. This turned out to be
because PRESUBMIT.py was relying on the user to run try jobs from the
root NaCl directory. The other issue was the presubmit steps are run
from a series of evals from depot_tools, this made it so we could not
simply use "os.path.dirname(__file__)". For that reason, we need to
walk up the directory and look for the PRESUBMIT.py file manually.

R=bradnelson@google.com

Review URL: https://codereview.chromium.org/250353004

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13650 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

6 days agoUpdate revision for PNaCl r13625->r13647
jvoung@chromium.org [Fri, 22 Aug 2014 06:02:46 +0000 (06:02 +0000)]
Update revision for PNaCl r13625->r13647

Pull the following PNaCl changes into NaCl:
  r13632: (dschuff@chromium.org) toolchain_build: Create 'work' package type and use it for target library compiler.
  r13640: (jvoung@google.com) PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
    | 19e1edc: (kschimpf@google.com) Fix minor nits from CL https://codereview.chromium.org/477743002.
    | e0a108e: (kschimpf@google.com) Remove support for global forward references from PNaCl bitcode reader.
    | 2cc8439: (dbrazdil@chromium.org) Add support for MinSFI address subspaces smaller than 32 bits.
    | ef6f4af: (dbrazdil@chromium.org) Add SandboxIndirectCalls MinSFI LLVM pass
  r13642: (dschuff@chromium.org) Build PNaCl target libraries on mac and run SCons tests on the toolchain bot
  r13643: (petarj@mips.com) [MIPS] Change output-format to elf32-tradlittlemips-nacl
  r13644: (petarj@mips.com) PNaCl: Update binutils revision in pnacl/COMPONENT_REVISIONS
    | ee0b801: (petarj@mips.com) [MIPS] Add Target_mips_nacl
  r13647: (jvoung@chromium.org) PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
    | 564d2e7: (dbrazdil@chromium.org) Clean up MinSFI
    | 36ee6b6: (dbrazdil@chromium.org) Whitelist BitCasts in MinSFI's SandboxMemoryAccesses pass
    | 7a24013: (dbrazdil@chromium.org) Fixed an integer overflow in MinSFI's utility function
    | e66462b: (wichard@vitalitystudios.com) PNaCl: Handle switch-ing on i1's in -nacl-promote-i1-ops.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3908
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3623
BUG= https://code.google.com/p/chromium/issues/detail?id=397177
BUG= <none>
BUG= none
R= kschimpf@google.com, jvoung@chromium.org, petarj@mips.com, dschuff@chromium.org, jvoung@google.com, dbrazdil@google.com, dyen@chromium.org
TEST=git try
NOTRY=true
(Please LGTM this change and tick the "commit" box)

Review URL: https://codereview.chromium.org/500433002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13649 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

6 days agoSupport Android x86 platform
zhenyu.liang@intel.com [Fri, 22 Aug 2014 06:02:40 +0000 (06:02 +0000)]
Support Android x86 platform

Both scons and gyp build are enabled. For gyp, host binaries should be compiled with NACL_ANDROID=0 and align with host arch.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3907
TEST= ./scons --mode=opt-linux android=1
TEST= GYP_DEFINES="OS=android target_arch=ia32" native_client/build/gyp_nacl && make
TEST= hello_world_newlib_x32.nexe under adb shell

Review URL: https://codereview.chromium.org/428463003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13648 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

7 days agoPNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
jvoung@chromium.org [Fri, 22 Aug 2014 00:47:26 +0000 (00:47 +0000)]
PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS

This pulls in the following LLVM changes:

564d2e7: (dbrazdil@chromium.org) Clean up MinSFI
36ee6b6: (dbrazdil@chromium.org) Whitelist BitCasts in MinSFI's SandboxMemoryAccesses pass
7a24013: (dbrazdil@chromium.org) Fixed an integer overflow in MinSFI's utility function
e66462b: (wichard@vitalitystudios.com) PNaCl: Handle switch-ing on i1's in -nacl-promote-i1-ops.

BUG= https://code.google.com/p/chromium/issues/detail?id=397177
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3924
TEST= PNaCl toolchain trybots
R=dbrazdil@google.com

Review URL: https://codereview.chromium.org/472403004

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13647 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

7 days agoRe-enable use of goma on Windows.
yyanagisawa@chromium.org [Thu, 21 Aug 2014 21:56:49 +0000 (21:56 +0000)]
Re-enable use of goma on Windows.

BUG=390764
TEST=NaCl trybots + Chromium's Windows trybot

Review URL: https://codereview.chromium.org/491213002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13646 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

7 days agoUse uint32_t for untrusted pointer args: gettimeofday() syscall
mseaborn@chromium.org [Thu, 21 Aug 2014 20:24:46 +0000 (20:24 +0000)]
Use uint32_t for untrusted pointer args: gettimeofday() syscall

Use uint32_t instead of a pointer type for syscall argument types.  This
reduces the amount of type casting.  This is cleaner because these
arguments are not valid trusted pointers, so using a pointer type is
misleading.

Also clean up to remove the unused "tz" argument from the syscall.  I've
cleaned up the untrusted side (syscall_bindings_trampoline.h) as well,
for consistency.

The "(void) (TZ)" part is needed to silence ARM NaCl GCC's warning about
the tz variable being unused.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3917
TEST=build
R=bradnelson@google.com

Review URL: https://codereview.chromium.org/492273002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13645 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

7 days agoPNaCl: Update binutils revision in pnacl/COMPONENT_REVISIONS
petarj@mips.com [Thu, 21 Aug 2014 20:23:30 +0000 (20:23 +0000)]
PNaCl: Update binutils revision in pnacl/COMPONENT_REVISIONS

This pulls in the following binutils change:

ee0b801: (petarj@mips.com) [MIPS] Add Target_mips_nacl

NOTRY=true
However, I have run a try job manually, and it passed fine, but a few
bots are flaky, so this is a workaround for it.

BUG=none
TEST= PNaCl toolchain trybots
TBR=dschuff@chromium.org

Review URL: https://codereview.chromium.org/492113002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13644 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

7 days ago[MIPS] Change output-format to elf32-tradlittlemips-nacl
petarj@mips.com [Thu, 21 Aug 2014 20:23:18 +0000 (20:23 +0000)]
[MIPS] Change output-format to elf32-tradlittlemips-nacl

Change output-format for gold to elf32-tradlittlemips-nacl to match
recent changes/patches in nacl-binutils.

NOTRY=true
However, I have run a try job manually, and it passed fine, but a few
bots are flaky, so this is a workaround for it.

TEST= ./scons platform=mips32 smoke_tests

Review URL: https://codereview.chromium.org/496623002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13643 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

7 days agoBuild PNaCl target libraries on mac and run SCons tests on the toolchain bot
dschuff@chromium.org [Thu, 21 Aug 2014 06:19:26 +0000 (06:19 +0000)]
Build PNaCl target libraries on mac and run SCons tests on the toolchain bot

We need to prevent the target libraries from being uploaded, else they
would race with those built by linux64, which is the canonical build. So
treat them as 'work' type targets in the build system, which causes them
not to be memoized.

R=jvoung@chromium.org

Review URL: https://codereview.chromium.org/494523002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13642 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

7 days agoUse uint32_t for untrusted pointer args: fstat() and some other syscalls
mseaborn@chromium.org [Thu, 21 Aug 2014 05:18:14 +0000 (05:18 +0000)]
Use uint32_t for untrusted pointer args: fstat() and some other syscalls

Use uint32_t instead of a pointer type for syscall argument types.  This
reduces the amount of type casting.  This is cleaner because these
arguments are not valid trusted pointers, so using a pointer type is
misleading.

Note that the untrusted types are still documented via
syscall_bindings_trampoline.h.

Remove some extraneous logging in thread_exit().

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3917
TEST=build
R=bradnelson@google.com

Review URL: https://codereview.chromium.org/479883002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13641 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

8 days agoPNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
jvoung@google.com [Wed, 20 Aug 2014 20:45:59 +0000 (20:45 +0000)]
PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS

This pulls in the following LLVM changes:

19e1edc: (kschimpf@google.com) Fix minor nits from CL https://codereview.chromium.org/477743002.
e0a108e: (kschimpf@google.com) Remove support for global forward references from PNaCl bitcode reader.
2cc8439: (dbrazdil@chromium.org) Add support for MinSFI address subspaces smaller than 32 bits.
ef6f4af: (dbrazdil@chromium.org) Add SandboxIndirectCalls MinSFI LLVM pass

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3908
BUG= https://code.google.com/p/chromium/issues/detail?id=397177
TEST= PNaCl toolchain trybots
R=dbrazdil@google.com, kschimpf@google.com

Review URL: https://codereview.chromium.org/492833002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13640 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

8 days agoPNaCl dynamic loading: Add ELF dynamic loader
mseaborn@chromium.org [Wed, 20 Aug 2014 18:03:07 +0000 (18:03 +0000)]
PNaCl dynamic loading: Add ELF dynamic loader

Add an ELF dynamic loader for PNaCl that knows how to load a DSO
produced from a PSO by pnacl-translate and can return the address of the
PSO's __pnacl_pso_root variables.

Add tests to cover:
 * Basic usage: a PSO that provides some functions and requires some
   relocations to be applied.
 * Two corner cases: PSOs that happen to contain no code or require no
   relocations.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3873
TEST=run_pnacl_dynamic_loading_test on PNaCl toolchain trybots
R=dschuff@chromium.org, mcgrathr@chromium.org

Review URL: https://codereview.chromium.org/341253003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13639 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

8 days agoUpdate glibc revision in tools/REVISIONS (9b15f6a->150657d)
sbc@chromium.org [Wed, 20 Aug 2014 17:52:27 +0000 (17:52 +0000)]
Update glibc revision in tools/REVISIONS (9b15f6a->150657d)

This brings in:
150657d  Add truncate.c to list of nacl files overrides.

This change also disables tst-truncate and tst-truncate64
which were previously auto-disabled since they included
a linker warning but now fail because they test both
truncate (which works) and ftruncate (which doesn't).

ftruncate fails with 'Function not implemented' but doesn't
trigger the linker warning.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3583
TEST= toolchain trybots
NOTRY=true

Review URL: https://codereview.chromium.org/470193003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13638 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

8 days agoDon't use ARM sysroot in gyp builds.
sbc@chromium.org [Wed, 20 Aug 2014 13:32:13 +0000 (13:32 +0000)]
Don't use ARM sysroot in gyp builds.

This fixes the NaCl SDK build on Ubuntu/Trusty.

This change was aleady made to the scons build here:
https://codereview.chromium.org/427953002

R=mseaborn@chromium.org

Review URL: https://codereview.chromium.org/486303002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13637 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

9 days agoUpdate .DEPS.git
chrome-admin@google.com [Tue, 19 Aug 2014 23:41:45 +0000 (23:41 +0000)]
Update .DEPS.git

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13636 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

9 days agoReturn exit status from NaClChromeMainStart().
teravest@chromium.org [Tue, 19 Aug 2014 20:25:33 +0000 (20:25 +0000)]
Return exit status from NaClChromeMainStart().

This adds a variant of NaClChromeMainStartApp that returns the exit status.
This allows embedders to get this information without having to get it from
SRPC.

I had to change the method name since function overloading isn't supported in
C, and I can't modify this and Chromium in the same change.

BUG=chromium:397161
R=mseaborn@chromium.org

Review URL: https://codereview.chromium.org/418133004

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13635 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

9 days agoClean up printing and env handling in sel_main.
ncbray@chromium.org [Tue, 19 Aug 2014 20:17:57 +0000 (20:17 +0000)]
Clean up printing and env handling in sel_main.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3889
R=sehr@chromium.org

Review URL: https://codereview.chromium.org/485893005

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13634 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

9 days agoRollback mistakenly commited changes
khim@google.com [Tue, 19 Aug 2014 18:03:22 +0000 (18:03 +0000)]
Rollback mistakenly commited changes

This rolls back revisions 13630 and 13631.

TBR=mseaborn@chromium.org

Review URL: https://codereview.chromium.org/489593002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13633 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

10 days agotoolchain_build: Create 'work' package type and use it for target library compiler.
dschuff@chromium.org [Tue, 19 Aug 2014 00:00:41 +0000 (00:00 +0000)]
toolchain_build: Create 'work' package type and use it for target library compiler.

Create a new package type, called 'work', intended for non-memoized build
artifacts. Like a source package, it is not memoized and so will always run.
Unlike a source package, it will run even when the --sync flag is not used.

Use this mechanism to make the host toolchain to build target libraries with;
this replaces the earlier method of making a copy of the driver scripts and
using the driver config file to point to the LLVM and binutils output directly.
This simplifies the current build rules, and in a future CL will be used to
1) Easily allow the target libraries to be built on mac (currently the rpaths
   are not set up correctly for the gold plugin), and
2) Add the host libc++ to this target without modifying LLVM's rpath or using
   LD_LIBRARY_PATH

R=jvoung@chromium.org, dyen@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3623

Review URL: https://codereview.chromium.org/485823003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13632 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

10 days agoMinor fix for x86 instruction definition.
khim@google.com [Mon, 18 Aug 2014 13:02:44 +0000 (13:02 +0000)]
Minor fix for x86 instruction definition.

Does not not affect the list of instructions allowed by validator, just
fixes minor mistake in the definition.

R=halyavin@google.com

Review URL: https://codereview.chromium.org/481873003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13631 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

10 days agoMinor gen_dfa.py refactoring
khim@google.com [Mon, 18 Aug 2014 12:37:10 +0000 (12:37 +0000)]
Minor gen_dfa.py refactoring

Make SplitVYZ bitness-agnostic.  It does not affect code but
makes gen_dfa more reusable as module.

R=halyavin@google.com

Review URL: https://codereview.chromium.org/480933002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13630 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

10 days agoUnsandboxed IRT: Implement symlink() and readlink()
mseaborn@chromium.org [Mon, 18 Aug 2014 06:22:00 +0000 (06:22 +0000)]
Unsandboxed IRT: Implement symlink() and readlink()

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3699
TEST=run_syscall_test_irt nonsfi_nacl=1
R=hidehiko@chromium.org

Review URL: https://codereview.chromium.org/316073002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13629 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

13 days agoStart to clean up the NaCl's startup state machine.
ncbray@chromium.org [Fri, 15 Aug 2014 22:50:32 +0000 (22:50 +0000)]
Start to clean up the NaCl's startup state machine.

The startup state machine is a little messy because responding to asynchonous
commands requires error conditions be remembered and reported later. This CL if
a first step in trying to formalize the startup state machine.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3889
R=sehr@chromium.org

Review URL: https://codereview.chromium.org/372323002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13628 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

13 days agoGN: Fix warnings for Chrome
noelallen@google.com [Fri, 15 Aug 2014 17:15:52 +0000 (17:15 +0000)]
GN: Fix warnings for Chrome

GN on Chrome has different warnings that are breaking the build when
applied to untrusted native client code.

BUG=https://code.google.com/p/chromium/issues/detail?id=403826i
R=bradnelson@google.com, mcgrathr@chromium.org, bradnelson@chromium.org

Review URL: https://codereview.chromium.org/474633004

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13627 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

13 days agoUpdate revision for PNaCl r13616->r13625
dschuff@chromium.org [Fri, 15 Aug 2014 16:23:59 +0000 (16:23 +0000)]
Update revision for PNaCl r13616->r13625

Pull the following PNaCl changes into NaCl:
  r13624: (dschuff@chromium.org) PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
    | 650319f: (kschimpf@google.com) Speed up construction of global initialzers in the PNaCl bitcode reader.
  r13625: (jvoung@google.com) PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
    | 57bc4ad: (dbrazdil@chromium.org) Convert MinSFI's SandboxMemoryAccesses to a ModulePass
    | 3b76c3f: (dbrazdil@chromium.org) Add AllocateDataSegment MinSFI LLVM pass
    | f638416: (dbrazdil@chromium.org) Add ExpandAllocas MinSFI LLVM pass
    | ade86a4: (dbrazdil@chromium.org) Fix an issue which allowed memory access outside a MinSFI sandbox.
    | c709074: (jvoung@chromium.org) Re-order the PNaClABISimplifyPreOpt pass injection to be before opts.
    | a9f45cb: (wichard@vitalitystudios.com) PNaCl: Initialize our passes in bugpoint.
    | 8145912: (wichard@vitalitystudios.com) PNaCl: Zero extend or truncate alloca array sizes to i32.
    | 2c34f87: (dbrazdil@chromium.org) PNaCl: Add missing dependency and inits to bugpoint
    | af3a4f1: (kschimpf@google.com) Simplify handling of forward (global) references in global initializers.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3908
BUG= https://code.google.com/p/chromium/issues/detail?id=397177
R=jvoung@chromium.org, dschuff@chromium.org, jvoung@google.com, kschimpf@google.com
TEST=git try
NOTRY=true
(Please LGTM this change and tick the "commit" box)

Review URL: https://codereview.chromium.org/474263002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13626 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

13 days agoPNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
jvoung@google.com [Fri, 15 Aug 2014 03:04:51 +0000 (03:04 +0000)]
PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS

This pulls in the following LLVM changes:

57bc4ad: (dbrazdil@chromium.org) Convert MinSFI's SandboxMemoryAccesses to a ModulePass
3b76c3f: (dbrazdil@chromium.org) Add AllocateDataSegment MinSFI LLVM pass
f638416: (dbrazdil@chromium.org) Add ExpandAllocas MinSFI LLVM pass
ade86a4: (dbrazdil@chromium.org) Fix an issue which allowed memory access outside a MinSFI sandbox.
c709074: (jvoung@chromium.org) Re-order the PNaClABISimplifyPreOpt pass injection to be before opts.
a9f45cb: (wichard@vitalitystudios.com) PNaCl: Initialize our passes in bugpoint.
8145912: (wichard@vitalitystudios.com) PNaCl: Zero extend or truncate alloca array sizes to i32.
2c34f87: (dbrazdil@chromium.org) PNaCl: Add missing dependency and inits to bugpoint
af3a4f1: (kschimpf@google.com) Simplify handling of forward (global) references in global initializers.

BUG= https://code.google.com/p/chromium/issues/detail?id=397177
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3408
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3908
TEST= PNaCl toolchain trybots

TBR=kschimpf,dschuff
NOTRY=true

Review URL: https://codereview.chromium.org/473103002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13625 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoPNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
dschuff@chromium.org [Fri, 15 Aug 2014 00:23:50 +0000 (00:23 +0000)]
PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS

This pulls in the following LLVM change:

650319f: (kschimpf@google.com) Speed up construction of global initialzers in the PNaCl bitcode reader.

TBR=kschimpf@google.com,jvoung@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3908
TEST= PNaCl toolchain trybots

Review URL: https://codereview.chromium.org/472043003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13624 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoRevert r13622, r13615 and r13614 (changes to the untrusted Gyp build)
mseaborn@chromium.org [Thu, 14 Aug 2014 23:36:55 +0000 (23:36 +0000)]
Revert r13622, r13615 and r13614 (changes to the untrusted Gyp build)

This reverts:

r13614 (bradnelson): "Vary build settings on fastbuild + configuration + buildtype."
r13615 (bradnelson): "Only pass -O2 as a link option for pnacl test pexes."
r13622 (dschuff): "Build PNaCl debug/fastbuild IRT with O2 instead of O0"

r13614 broke the Chromium build, causing the IRT link to fail with
errors including the following:

../../out/Release/gen/tc_irt/lib64/libgles2_implementation_nacl.a(gles2_implementation_dc9b550c.o):
error: undefined reference to 'gfx::RectBase<gfx::Rect, gfx::Point, gfx::Size,
gfx::Insets, gfx::Vector2d, int>::x() const'
../../out/Release/gen/tc_irt/lib64/libgles2_implementation_nacl.a(gles2_implementation_dc9b550c.o):
error: undefined reference to 'gfx::RectBase<gfx::Rect, gfx::Point, gfx::Size,
gfx::Insets, gfx::Vector2d, int>::y() const'

r13622 was an attempted fix which apparently fixed the x86-64 IRT build
(using the PNaCl toolchain), but the error persisted with the x86-32 IRT
build (using the NaCl GCC toolchain).

This appears to be a C++ template instantiation problem.

BUG=https://code.google.com/p/chromium/issues/detail?id=388035
TEST=trybots
R=dschuff@chromium.org

Review URL: https://codereview.chromium.org/471023004

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13623 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoBuild PNaCl debug/fastbuild IRT with O2 instead of O0
dschuff@chromium.org [Thu, 14 Aug 2014 21:31:32 +0000 (21:31 +0000)]
Build PNaCl debug/fastbuild IRT with O2 instead of O0

Using O0 is causing a build failure that may be a problem with the
toolchain or the user code; in either case, work around it for now by
going back to O2 for PNaCl builds.

R=bradnelson@google.com
BUG= https://code.google.com/p/chromium/issues/detail?id=388035

Review URL: https://codereview.chromium.org/475893002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13622 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoDisable the imc_makeboundsock() syscall by default
mseaborn@chromium.org [Thu, 14 Aug 2014 20:22:18 +0000 (20:22 +0000)]
Disable the imc_makeboundsock() syscall by default

Like imc_socketpair(), this syscall is not used by the IRT in Chromium,
so we can disable it by default to reduce attack surface.

Since it's still used by some tests, I'm not removing the syscall
implementation yet.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3864
TEST=NaCl trybots + Chromium trybots
R=bradnelson@google.com

Review URL: https://codereview.chromium.org/476483002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13621 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoUpdate revision for PNaCl r13609->r13616
dschuff@chromium.org [Thu, 14 Aug 2014 20:17:51 +0000 (20:17 +0000)]
Update revision for PNaCl r13609->r13616

Pull the following PNaCl changes into NaCl:
  r13616: (dschuff@chromium.org) Build sandboxed translator with libcxx

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3623
R= jvoung@chromium.org, dschuff@chromium.org
TEST=git try
NOTRY=true
(Please LGTM this change and tick the "commit" box)

Review URL: https://codereview.chromium.org/469353003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13620 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoCleanup: Remove Python bindings for NaClDescs and IMC
mseaborn@chromium.org [Thu, 14 Aug 2014 17:58:58 +0000 (17:58 +0000)]
Cleanup: Remove Python bindings for NaClDescs and IMC

These used to be used for testing, but the test that used them was
removed a while ago.

These bindings could still be useful in future for embedders of NaCl,
but the usefulness would be limited because the system Python often
isn't compiled for the same architecture as NaCl/sel_ldr.

Also, IMC and SRPC are deprecated.  We could remove the IMC operations
from the Python bindings and leave the rest, but it's simpler to remove
the Python bindings entirely.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3864
TEST=trybots
R=bradnelson@google.com

Review URL: https://codereview.chromium.org/474673002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13619 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoDisable the imc_socketpair() syscall by default
mseaborn@chromium.org [Thu, 14 Aug 2014 17:18:14 +0000 (17:18 +0000)]
Disable the imc_socketpair() syscall by default

This syscall is not used by the IRT in Chromium, so we can disable it by
default to reduce attack surface.

Since it's still used by some tests, I'm not removing the syscall
implementation yet.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3864
TEST=NaCl trybots + Chromium trybots
R=bradnelson@google.com

Review URL: https://codereview.chromium.org/471733002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13618 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoNon-SFI Mode: Fix linux_termios size.
hidehiko@chromium.org [Thu, 14 Aug 2014 05:51:39 +0000 (05:51 +0000)]
Non-SFI Mode: Fix linux_termios size.

In linux, the number of flags bits in linux_termios is uint32_t.
Also, the size of cc is 19.
Now, the linux_termios is too small, so that the caller stack was broken.

TEST=./scons run_syscall_test bitcode=1 nonsfi_nacl=1
TEST=./scons run_syscall_test bitcode=1 nonsfi_nacl=1 platform=arm
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3851
R=mseaborn@chromium.org

Review URL: https://codereview.chromium.org/455813002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13617 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoBuild sandboxed translator with libcxx
dschuff@chromium.org [Wed, 13 Aug 2014 23:09:02 +0000 (23:09 +0000)]
Build sandboxed translator with libcxx

This is possible now that we have binutils 2.24

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3623
R=jvoung@chromium.org

Review URL: https://codereview.chromium.org/426363002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13616 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoOnly pass -O2 as a link option for pnacl test pexes.
bradnelson@google.com [Wed, 13 Aug 2014 23:06:21 +0000 (23:06 +0000)]
Only pass -O2 as a link option for pnacl test pexes.

GCC ignores -O0 / -O2 on the link line, dropping it.
Activating -O2 for the link line for pnacl test pexes only.

BUG=https://code.google.com/p/chromium/issues/detail?id=388035
TEST=None
R=dschuff@chromium.org

Review URL: https://codereview.chromium.org/466313006

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13615 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoVary build settings on fastbuild + configuration + buildtype.
bradnelson@google.com [Wed, 13 Aug 2014 22:09:35 +0000 (22:09 +0000)]
Vary build settings on fastbuild + configuration + buildtype.

Official builds will continue to have -g + -O2 / -O0 for Release/Debug.

Otherwise, disabled all optimization + debug info for fastbuild!=0.

Otherwise, decide (-g -O0) vs -O2 based on Debug/Release.

Speedup for release + fastbuild=1:
nacl_irt_core: ~8 sec to ~5 sec
all nacl toolchain built stuff: ~15 sec to ~8 sec
overall nacl (including toolchain extract): ~26 sec to ~22 sec
chrome irt: ~133 sec to ~87 sec

BUG=https://code.google.com/p/chromium/issues/detail?id=388035
TEST=None
R=jam@chromium.org, noelallen@chromium.org, binji@chromium.org, dschuff@chromium.org

Review URL: https://codereview.chromium.org/463373004

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13614 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoUpdate revision for PNaCl r13557->r13609
dschuff@chromium.org [Wed, 13 Aug 2014 20:36:08 +0000 (20:36 +0000)]
Update revision for PNaCl r13557->r13609

Pull the following PNaCl changes into NaCl:
  r13564: (dschuff@chromium.org) Update PNaCl binutils COMPONENT_REVISIONS to bring in merge to 2.24
  r13568: (mseaborn@chromium.org) Tweak copyright notices to pass presubmit checks: remaining files
  r13569: (dschuff@chromium.org) Build subzero with LLVM autoconf build.
  r13574: (jvoung@google.com) PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
    | 35cd201: (kschimpf@google.com) Refactor code so that intrinsics checks can be used by pnacl-bcdis.
    | 0d6a73a: (jfb@chromium.org) Improve atomic tests
    | 00612e1: (kschimpf@google.com) Fix pnacl-bcdis abbreviation records.
    | b8b07da: (jfb@chromium.org) PNaCl atomics: clean up some of the code
    | 007f1fd: (dbrazdil@google.com) Add SandboxMemoryAccesses MinSFI LLVM pass
    | 650319f: (kschimpf@google.com) Speed up construction of global initialzers in the PNaCl bitcode reader.
  r13595: (mseaborn@chromium.org) PNaCl driver scripts: Remove references to pnacl/build.sh in comments
  r13600: (mseaborn@chromium.org) PNaCl: Fix SJLJ EH redirector functions to not get "nounwind" attributes
  r13602: (dschuff@chromium.org) PNaCl driver: Add libgcc to mixed native/bitcode links
  r13606: (dschuff@chromium.org) PNaCl: Update libc++ revision in pnacl/COMPONENT_REVISIONS
  r13608: (jvoung@google.com) PNaCl: Update Subzero revision in pnacl/COMPONENT_REVISIONS
  r13609: (dschuff@chromium.org) Roll LLVM COMPONENT_REVISIONS back to 007f1fd0

BUG= none
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3719
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3894
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3614
BUG= <none>
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3408
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3910
R= kschimpf@google.com, jfb@chromium.org, jvoung@chromium.org, stichnot@chromium.org, dschuff@chromium.org, jvoung@google.com, mseaborn@chromium.org, dbrazdil@google.com
TEST=git try
NOTRY=true
(Please LGTM this change and tick the "commit" box)

Review URL: https://codereview.chromium.org/474443002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13613 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoDisable the imc_mem_obj_create() syscall by default
mseaborn@chromium.org [Wed, 13 Aug 2014 15:55:01 +0000 (15:55 +0000)]
Disable the imc_mem_obj_create() syscall by default

This syscall has not been used by the IRT in Chromium for a while.  In
Chromium, shared memory segments are created by the renderer and passed
to NaCl untrusted code via IPC, so untrusted code doesn't need to be
able to create them directly.

Disabling this syscall will reduce attack surface.  The syscall provides
a way to allocate >4GB memory, so it's good to disable it.  In
particular, it can probably be used to trigger out-of-memory conditions,
though there are probably other ways for web apps to do this in
Chromium.

I'm not removing the syscall yet because it's still used by some tests.
It's currently the easiest way to test mmap() on shared memory segments,
which has a different implementation from mmap() on files
(nacl_desc_imc_shm.c vs. nacl_desc_io.c).

This changes selection.scons to disable a test of imc_mem_obj_create()
from running inside Chromium.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3864
TEST=NaCl trybots + Chromium trybots
R=bradnelson@google.com

Review URL: https://codereview.chromium.org/453603002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13612 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoMake some of the "get" pthread function prototypes take const params.
jvoung@google.com [Wed, 13 Aug 2014 14:53:13 +0000 (14:53 +0000)]
Make some of the "get" pthread function prototypes take const params.

Also, fix the PNaCl prep_nacl_sdk header copying for gyp and GN,
so that it actually overrides the pthread.h file that is now shipping w/
the toolchain tarball (and may be stale, w.r.t., changes like this).

BUG= https://code.google.com/p/chromium/issues/detail?id=397845
R=bradnelson@google.com, mcgrathr@chromium.org

Review URL: https://codereview.chromium.org/428023003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13611 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoBreak up arch dependencies
noelallen@google.com [Tue, 12 Aug 2014 23:52:02 +0000 (23:52 +0000)]
Break up arch dependencies

Currently we build from all architectures, however to support Chrome we
need to only build the target architecture otherwise every toolchain would
need to be available.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3825
R=bradnelson@google.com, bradnelson@chromium.org

Review URL: https://codereview.chromium.org/464083002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13610 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoRoll LLVM COMPONENT_REVISIONS back to 007f1fd0
dschuff@chromium.org [Tue, 12 Aug 2014 22:07:15 +0000 (22:07 +0000)]
Roll LLVM COMPONENT_REVISIONS back to 007f1fd0

This rolls the following revision out of the toolchain build:
650319f: Speed up construction of global initialzers in the PNaCl bitcode reader.

It's causing issues with spec GCC. A fix is due soon but in the
meantime we want to roll other changes into NaCl.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3908
R=kschimpf@google.com
TBR=kschimpf@google.com
TEST=local

Review URL: https://codereview.chromium.org/463273002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13609 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoPNaCl: Update Subzero revision in pnacl/COMPONENT_REVISIONS
jvoung@google.com [Tue, 12 Aug 2014 21:09:40 +0000 (21:09 +0000)]
PNaCl: Update Subzero revision in pnacl/COMPONENT_REVISIONS

This pulls in the following Subzero changes:

5acafbc: (stichnot@chromium.org) Subzero: Fix a signed/unsigned warning reported on the Mac.
e377767: (wala@chromium.org) Subzero: Fix some issues related to legalization and undef handling.
7da431b: (stichnot@chromium.org) Subzero: Fix and clean up some cross tests.
206833c: (stichnot@chromium.org) Subzero: A few fixes toward running larger programs.
afeaee4: (wala@chromium.org) Subzero: Use scalar arithmetic when no vector instruction exists.
51e8cfb: (wala@chromium.org) Subzero: Make InstX8632Cbwdq a UnaryOp.
989a703: (stichnot@chromium.org) Subzero: Add the "llvm2ice -ffunction-sections" argument.
1bd2fce: (wala@chromium.org) Subzero: Add a random number generator.
89cbfb0: (wala@chromium.org) Subzero: Fix a debugging string in the test_icmp crosstest.
8835b89: (wala@chromium.org) Subzero: address mode opt: Transform *(reg+const) into [reg+const].
105b704: (wala@chromium.org) Subzero: Align the stack at the point of function calls.

BUG= https://codereview.chromium.org/296053008/
TEST= PNaCl toolchain trybots
R=wala@chromium.org

Review URL: https://codereview.chromium.org/469433002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13608 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoAdd Subzero to the pnacl/deps_update script and have binutils check 2.24.
jvoung@google.com [Tue, 12 Aug 2014 18:35:28 +0000 (18:35 +0000)]
Add Subzero to the pnacl/deps_update script and have binutils check 2.24.

We're on the 2.24 branch of binutils instead of 2.23 now.

Example CL for subzero update:
https://codereview.chromium.org/469433002/

Also, do some build.sh cleanup.

BUG=none
R=dschuff@chromium.org

Review URL: https://codereview.chromium.org/460373003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13607 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoPNaCl: Update libc++ revision in pnacl/COMPONENT_REVISIONS
dschuff@chromium.org [Tue, 12 Aug 2014 16:29:48 +0000 (16:29 +0000)]
PNaCl: Update libc++ revision in pnacl/COMPONENT_REVISIONS

This pulls in the following libc++ change:

518a2ff: (dschuff@chromium.org) Merge remote-tracking branch 'origin/upstream/master'

This brings in a merge to upstream tip of tree.
In particular it brings in r208942 which is needed for the
offsetof macro to work with clang after r207606, which
changed cstddef (see comments on those revisions).

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3623
TEST= PNaCl toolchain trybots
R=jfb@chromium.org

Review URL: https://codereview.chromium.org/460873002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13606 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoConfigure GDB with --enable-tui
mcgrathr@chromium.org [Tue, 12 Aug 2014 15:45:34 +0000 (15:45 +0000)]
Configure GDB with --enable-tui

The --enable-tui configure switch will make the GDB build insist on
finding a compatible curses library, rather than silently configuring
out the --tui functionality if one is not found.  This should ensure
that bots break quickly if the required dependencies go missing again.

No curses library is available on Windows yet, so we don't use
--enable-tui there.

BUG= https://code.google.com/p/chromium/issues/detail?id=391170
TEST= toolchain trybots
R=bradnelson@google.com, dyen@chromium.org, bradnelson@chromium.org

Review URL: https://codereview.chromium.org/451143002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13605 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoRevert "Re-enable use of goma on Windows."
dschuff@chromium.org [Mon, 11 Aug 2014 22:39:54 +0000 (22:39 +0000)]
Revert "Re-enable use of goma on Windows."

This reverts r13601.

When rolled into Chrome, goma is failing to work.
See e.g. http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel/builds/5537
and http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_x64_rel/builds/5555

R=jabdelmalek@google.com, jam@chromium.org
BUG=390764

Review URL: https://codereview.chromium.org/463663003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13604 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agobuild_nexe.py: support compiling generated code in GYP.
ncbray@chromium.org [Mon, 11 Aug 2014 21:48:40 +0000 (21:48 +0000)]
build_nexe.py: support compiling generated code in GYP.

A respin of  https://codereview.chromium.org/443513002/ with "make" support.

BUG=https://code.google.com/p/chromium/issues/detail?id=401761
R=bradnelson@google.com

Review URL: https://codereview.chromium.org/450393003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13603 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoPNaCl driver: Add libgcc to mixed native/bitcode links
dschuff@chromium.org [Mon, 11 Aug 2014 21:46:51 +0000 (21:46 +0000)]
PNaCl driver: Add libgcc to mixed native/bitcode links

When building with pre-translated object files, calls can be generated
to libgcc/compiler-rt functions, but libgcc was not included on the
bitcode link line, causing undefined references to the libgcc functions.
Include libgcc on the bitcode link line to satisfy these references when
using native objects.

R=mseaborn@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3910

Review URL: https://codereview.chromium.org/454593002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13602 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoRe-enable use of goma on Windows.
yyanagisawa@chromium.org [Mon, 11 Aug 2014 20:31:39 +0000 (20:31 +0000)]
Re-enable use of goma on Windows.

We provided workaround for Windows in goma client.  Let me make
build_nexe.py use goma again.

Minor fix:
- fixed pylint error: 'err' variable does not exist.

BUG=390764
NOTRY=true

Review URL: https://codereview.chromium.org/447093003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13601 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoPNaCl: Fix SJLJ EH redirector functions to not get "nounwind" attributes
mseaborn@chromium.org [Sat, 9 Aug 2014 23:52:53 +0000 (23:52 +0000)]
PNaCl: Fix SJLJ EH redirector functions to not get "nounwind" attributes

When this file is compiled as C, by default Clang adds the
"nounwind" attribute to functions (unless compiling with
"-fexceptions").

If these functions were to be optimised via LTO (which doesn't currently
happen), this attribute would break C++ exception handling.  Invokes of
__cxa_call_unexpected() could get converted to calls, which would
prevent __cxa_call_unexpected() from being able to re-raise exceptions.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3408
TEST=none except PNaCl toolchain trybots
R=dschuff@chromium.org

Review URL: https://codereview.chromium.org/449963004

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13600 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoUpdate .DEPS.git
chrome-admin@google.com [Sat, 9 Aug 2014 03:46:17 +0000 (03:46 +0000)]
Update .DEPS.git

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13599 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

2 weeks agoFix Linux trybots: Remove android_tools from DEPS because syncing it fails
mseaborn@chromium.org [Sat, 9 Aug 2014 03:45:44 +0000 (03:45 +0000)]
Fix Linux trybots: Remove android_tools from DEPS because syncing it fails

This Git repo is apparently ~2GB.  The Linux Precise trybots are
currently failing to fetch it quickly enough to prevent Buildbot from
aborting the "update" step for taking too long without output.  These
trybots were reimaged on 1st August and so have been trying to do a
checkout from scratch.  The slowness might be a network connectivity
problem or a problem with the Git server.

The slowness to fetch android_tools isn't obvious from the "update"
step's logs because of a buffering problem with "gclient sync".  gclient
only displays partial output from a previous step, which is fetching
Breakpad from SVN.  This makes it look like fetching Breakpad is at
fault when it's not.

buildtools is fetched from the same Git server, but it's tiny in
comparison.

Note that this change doesn't work on the trybots without committing,
because the trybots still do a "gclient sync" at HEAD before applying
the patch.

This reverts r13182.

We can undo this revert when the Git repo is working properly again.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3032
BUG=https://code.google.com/p/chromium/issues/detail?id=401589
TEST=somewhat on trybots
R=vadimsh@chromium.org

Review URL: https://codereview.chromium.org/451243002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13598 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

3 weeks agoReverting: r13596
bradnelson@google.com [Fri, 8 Aug 2014 00:14:23 +0000 (00:14 +0000)]
Reverting: r13596

>  build_nexe.py: support compiling generated code in GYP.
>
>  BUG=https://code.google.com/p/chromium/issues/detail?id=401761
>  R=bradnelson@chromium.org, bradnelson@google.com

>  Review URL: https://codereview.chromium.org/443513002

TBR=ncbray@chromium.org

Review URL: https://codereview.chromium.org/455603002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13597 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

3 weeks agobuild_nexe.py: support compiling generated code in GYP.
ncbray@chromium.org [Thu, 7 Aug 2014 22:57:41 +0000 (22:57 +0000)]
build_nexe.py: support compiling generated code in GYP.

BUG=https://code.google.com/p/chromium/issues/detail?id=401761
R=bradnelson@chromium.org, bradnelson@google.com

Review URL: https://codereview.chromium.org/443513002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13596 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

3 weeks agoPNaCl driver scripts: Remove references to pnacl/build.sh in comments
mseaborn@chromium.org [Thu, 7 Aug 2014 21:50:45 +0000 (21:50 +0000)]
PNaCl driver scripts: Remove references to pnacl/build.sh in comments

The comments are obsolete because we're no longer using "build.sh
driver", and it should be removed soon.

I'm not replacing the comments because docs about how to build the
toolchain shouldn't be copy+pasted across many files.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3719
TEST=none
R=dschuff@chromium.org

Review URL: https://codereview.chromium.org/447413002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13595 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

3 weeks agoRevert "Update revision for PNaCl r13557->r13574"
dschuff@chromium.org [Thu, 7 Aug 2014 18:00:26 +0000 (18:00 +0000)]
Revert "Update revision for PNaCl r13557->r13574"

This reverts r13593.
Translation of spec gcc on all architectures seems to cause the translator to loop inifinitely or some other pathological behavior that burns the CPU. I haven't investigated yet (other than reproducing it locally), but I suspect it's
related to LLVM rev 650319f.

(see e.g. http://build.chromium.org/p/client.nacl/builders/lucid_64-newlib-x86_64-pnacl-spec/builds/5297)
TBR=mseaborn@chromium.org,kschimpf@google.com
BUG=None

Review URL: https://codereview.chromium.org/454443002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13594 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

3 weeks agoUpdate revision for PNaCl r13557->r13574
dschuff@chromium.org [Thu, 7 Aug 2014 16:57:42 +0000 (16:57 +0000)]
Update revision for PNaCl r13557->r13574

Pull the following PNaCl changes into NaCl:
  r13564: (dschuff@chromium.org) Update PNaCl binutils COMPONENT_REVISIONS to bring in merge to 2.24
  r13568: (mseaborn@chromium.org) Tweak copyright notices to pass presubmit checks: remaining files
  r13569: (dschuff@chromium.org) Build subzero with LLVM autoconf build.
  r13574: (jvoung@google.com) PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
    | 35cd201: (kschimpf@google.com) Refactor code so that intrinsics checks can be used by pnacl-bcdis.
    | 0d6a73a: (jfb@chromium.org) Improve atomic tests
    | 00612e1: (kschimpf@google.com) Fix pnacl-bcdis abbreviation records.
    | b8b07da: (jfb@chromium.org) PNaCl atomics: clean up some of the code
    | 007f1fd: (dbrazdil@google.com) Add SandboxMemoryAccesses MinSFI LLVM pass
    | 650319f: (kschimpf@google.com) Speed up construction of global initialzers in the PNaCl bitcode reader.

BUG= none
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3614
BUG= <none>
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3894
R=dbrazdil@google.com, mseaborn@chromium.org, dschuff@chromium.org, jfb@chromium.org, jvoung@chromium.org, jvoung@google.com, kschimpf@google.com, stichnot@chromium.org
TEST=git try
NOTRY=true
(Please LGTM this change and tick the "commit" box)

Review URL: https://codereview.chromium.org/437423002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13593 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

3 weeks agoAdd PROJECT field to codereview.settings for nacl
sheyang@chromium.org [Thu, 7 Aug 2014 14:21:33 +0000 (14:21 +0000)]
Add PROJECT field to codereview.settings for nacl

BUG=

NOTRY=true

Review URL: https://codereview.chromium.org/450523002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13592 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

3 weeks agoUpdate .DEPS.git
chrome-admin@google.com [Wed, 6 Aug 2014 23:09:41 +0000 (23:09 +0000)]
Update .DEPS.git

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13591 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

3 weeks agoUpdate .DEPS.git
chrome-admin@google.com [Wed, 6 Aug 2014 23:08:44 +0000 (23:08 +0000)]
Update .DEPS.git

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13590 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

3 weeks agoNaCl has it's own copy of the build files, including several GNI files which use...
noelallen@google.com [Wed, 6 Aug 2014 21:40:17 +0000 (21:40 +0000)]
NaCl has it's own copy of the build files, including several GNI files which use "declare_args" to provide build options.

When chrome build tree attempts to use objects defined in the NaCl tree, we can get duplicate definition issues.

Splitting out the pieces needed by both NaCl and Chrome GN files allows us to reuse those pieces without accidentally including more of the build files than needed.

R=bradnelson@google.com
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3825

Review URL: https://codereview.chromium.org/440213002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13589 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

3 weeks agoUpdate x86-64 linux prep script for Trusty
dschuff@chromium.org [Wed, 6 Aug 2014 18:17:34 +0000 (18:17 +0000)]
Update x86-64 linux prep script for Trusty

This script hasn't been useful in years, but it should be now.

BUG=None
R=sbc@chromium.org

Review URL: https://codereview.chromium.org/443733002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13586 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

3 weeks agoFix for ARM cross build with clang.
sbc@chromium.org [Wed, 6 Aug 2014 08:39:28 +0000 (08:39 +0000)]
Fix for ARM cross build with clang.

This fixes an error building nacl_bootstrap_raw:
 /usr/bin/ld.bfd: unrecognised emulation mode: armelf_linux_eabi

With the clang build we don't set CXX so 'compiler' was
defaulting to 'g++' which doesn't support armelf_linux_eabi.

BUG= https://code.google.com/p/chromium/issues/detail?id=395832
R=mseaborn@chromium.org

Review URL: https://codereview.chromium.org/428753002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13584 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

3 weeks agoAdd toolchain_build/git_cache to list of SVN ignores
dschuff@chromium.org [Tue, 5 Aug 2014 22:05:01 +0000 (22:05 +0000)]
Add toolchain_build/git_cache to list of SVN ignores

This will keep the bots from having to redownload everyting on each run.
R=dyen@chromium.org

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13583 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

3 weeks agoRemove unneeded items from list of trusty cross toolchain packages.
dschuff@chromium.org [Tue, 5 Aug 2014 17:52:48 +0000 (17:52 +0000)]
Remove unneeded items from list of trusty cross toolchain packages.

They are not necessary, and libmudflap fails to install on goobuntu Trusty.

R=sbc@chromium.org
BUG=ARM support on Trusty

Review URL: https://codereview.chromium.org/445453007

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13582 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

3 weeks agoFurther deduplicate and simplify PNaCl SCons testing
dschuff@chromium.org [Mon, 4 Aug 2014 21:17:16 +0000 (21:17 +0000)]
Further deduplicate and simplify PNaCl SCons testing

Remove more duplication between buildbot_pnacl.py and buildbot_pnacl.sh:
1) Make the x86-64 toolchain bot use buildbot_pnacl.py to run SCons tests.
2) Update the non-SFI tests in buildbot_pnacl.py to reflect the current state
on ARM and x86 and update the ARM QEMU trybot to use buildbot_pnacl.py
to run SCons tests. Note that the nacl-arm_opt_panda trybot and the buildbot
(which both use hardware) are not affected by this change.
Only the nacl-precise_64-newlib-arm_qemu-pnacl trybot is affected.

A future CL will move the scons testing logic for the ARM hardware bots, and
then we can remove all the nonsfi stuff from buildbot_pnacl.sh.

R=mseaborn@chromium.org, hidehiko@chromium.org, jvoung@chromium.org
BUG= http://code.google.com/p/chromium/issues/detail?id=358465

Review URL: https://codereview.chromium.org/426763002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13581 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

3 weeks agoWindows: Make MapViewOfFileEx() failure fatal to reduce risk of mmap hole
mseaborn@chromium.org [Sat, 2 Aug 2014 00:08:31 +0000 (00:08 +0000)]
Windows: Make MapViewOfFileEx() failure fatal to reduce risk of mmap hole

If MapViewOfFileEx() were to fail and if the mmap() syscall were to
return to untrusted code, this could leave behind a hole in the sandbox
address space, which would be unsafe.  To reduce this risk, make this
failure fatal, and don't try to recover.

This makes nacl_host_desc.c match similar code in
src/shared/imc/win/nacl_shm.cc.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3586
TEST=none
R=bradnelson@google.com

Review URL: https://codereview.chromium.org/440483003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13580 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

3 weeks agoEnable building with platform=arm on Ubuntu/Trusty.
sbc@chromium.org [Fri, 1 Aug 2014 17:16:58 +0000 (17:16 +0000)]
Enable building with platform=arm on Ubuntu/Trusty.

Turns out the ARM sysroot is almost completely not needed
anymore, even on Precise.  Indeed removing the use of the
sysroot fixes the Trusty build.  There is some caveat that
the -rpath-link option is still needed on Precise to avoid
linker warnings.

R=mseaborn@chromium.org

Review URL: https://codereview.chromium.org/427953002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13579 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

3 weeks agoUpdate nacl enum comment to point to correct histograms.xml file.
asvitkine@chromium.org [Fri, 1 Aug 2014 15:07:09 +0000 (15:07 +0000)]
Update nacl enum comment to point to correct histograms.xml file.

BUG=none
NOTRY=true

Review URL: https://codereview.chromium.org/433973002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13578 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

4 weeks agoAdd missing check to nacl_bootstrap_munge_phdr.py.
sbc@chromium.org [Thu, 31 Jul 2014 21:55:54 +0000 (21:55 +0000)]
Add missing check to nacl_bootstrap_munge_phdr.py.

When it was ported from the C code the check for p_filesz
was lost. This check was actually firing for me when I
built with clang so it was actually useful.

Also, remove use of builtin python ValueError.  Use custom
exception type and catch it in main() so as not to show
backtraces under normal operation. Backtraces should only
be shown when there is bug in the program, not on bad
user input.

R=bradnelson@chromium.org, bradnelson@google.com, ncbray@chromium.org

Review URL: https://codereview.chromium.org/414123004

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13577 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

4 weeks agoInterlocked allocations between mmap and code_data_allocation.
dyen@chromium.org [Thu, 31 Jul 2014 20:41:39 +0000 (20:41 +0000)]
Interlocked allocations between mmap and code_data_allocation.

Values returned by mmap() called with PROT_EXEC and
nacl_irt_code_data_allocate() must not overlap. All code allocations
are now reserved through nacl_irt_code_data_allocate() first before
being passed to mmap.

R=mcgrathr@chromium.org, mseaborn@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3879
TEST= trybots

Review URL: https://codereview.chromium.org/420283005

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13576 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

4 weeks agoDisable exceptions on Windows in all builds
hans@chromium.org [Thu, 31 Jul 2014 20:38:28 +0000 (20:38 +0000)]
Disable exceptions on Windows in all builds

Chromium previously had exceptions enabled in shared_library Win builds
for legacy reasons. That seems to have been copy-pasted into NaCL's
build/common.gypi.

Chromium disabled exceptions for all Windows builds in r285676; this does
the same for NaCL.

BUG=82385
NOTRY=true

Review URL: https://codereview.chromium.org/418383005

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13575 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

4 weeks agoPNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
jvoung@google.com [Thu, 31 Jul 2014 18:43:09 +0000 (18:43 +0000)]
PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS

This pulls in the following LLVM changes:

35cd201: (kschimpf@google.com) Refactor code so that intrinsics checks can be used by pnacl-bcdis.
0d6a73a: (jfb@chromium.org) Improve atomic tests
00612e1: (kschimpf@google.com) Fix pnacl-bcdis abbreviation records.
b8b07da: (jfb@chromium.org) PNaCl atomics: clean up some of the code
007f1fd: (dbrazdil@google.com) Add SandboxMemoryAccesses MinSFI LLVM pass
650319f: (kschimpf@google.com) Speed up construction of global initialzers in the PNaCl bitcode reader.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3894
BUG= https://code.google.com/p/chromium/issues/detail?id=397177
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3908
TEST= PNaCl toolchain trybots
R=dbrazdil@google.com, jfb@chromium.org, kschimpf@google.com

Review URL: https://codereview.chromium.org/430273002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13574 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

4 weeks agoNon-SFI Mode: Centralise test whitelists; move to Scons
mseaborn@chromium.org [Thu, 31 Jul 2014 17:59:37 +0000 (17:59 +0000)]
Non-SFI Mode: Centralise test whitelists; move to Scons

Simplify the whitelists of tests to run under Non-SFI Mode by moving
them to Scons.  Add "nonsfi_tests{,_irt}" test suites.

This allows us to remove the duplication between buildbot_pnacl.{sh,py},
and the internal duplication within those files between lists of
IRT-based and non-IRT-based tests.

Make some changes to allow tests to be run consistently as both
IRT-based and non-IRT-based tests:

 * Add a getpid() syscall wrapper.
 * Fix clock_getres() when it's given a NULL pointer.

Disable signal test under QEMU via nacl.scons rather than via having a
difference between buildbot_pnacl.{sh,py}.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3851
TEST=nonsfi_tests{,_irt} + trybots
R=dschuff@chromium.org, hidehiko@chromium.org

Review URL: https://codereview.chromium.org/424763007

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13573 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

4 weeks agoClean up machine/_types.h: Remove NACL_PRI*NACL_OFF{,64} macros
mseaborn@chromium.org [Thu, 31 Jul 2014 17:37:13 +0000 (17:37 +0000)]
Clean up machine/_types.h: Remove NACL_PRI*NACL_OFF{,64} macros

The NACL_PRI* macros are not standard, so we don't want to expose them
when this header is copied into the newlib toolchains.

As replacements:
 * Use ASSERT_EQ where appropriate in tests.
 * Remove logging that isn't very useful.
 * Logging can be useful for syscall args and in error paths, so I've
   converted these cases to use PRI*64.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3909
TEST=build
R=ncbray@chromium.org

Review URL: https://codereview.chromium.org/429013005

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13572 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

4 weeks agoFixed an issue where directory renames were not reliable on windows.
dyen@chromium.org [Thu, 31 Jul 2014 16:23:21 +0000 (16:23 +0000)]
Fixed an issue where directory renames were not reliable on windows.

In the definition for "Retry" under pynacl.file_tools, it says:
"Windows seems to be prone to having commands that delete files or
directories fail." This was happening occasionally for Windows
machines. Add Retry to all the os.renames to avoid this problem.

R=bradnelson@google.com, jvoung@chromium.org
TEST= trybots

Review URL: https://codereview.chromium.org/428293003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13571 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

4 weeks agoNon-SFI Mode: Add sigaction and signal
hamaji@chromium.org [Thu, 31 Jul 2014 16:21:17 +0000 (16:21 +0000)]
Non-SFI Mode: Add sigaction and signal

We expose only signal and define sigaction as linux_sigaction.
Linux-NaCl ABI conversion for sigaction is cumbersome (current
PNaCl newlib does not support sa_sigaction for example) and we
will not need to call sigaction from Chrome tree as we provide
NaCl exception IRT. libevent does have sigaction call but we
can let it use signal instead of sigaction by modifying
config.h.

We do not run signal_test on ARM because the user mode qemu
crashes when you pass oldact to sigaction.

TEST=./scons run_sigaction_test run_signal_test \
     bitcode=1 nonsfi_nacl=1
TEST=./scons run_sigaction_test \
     bitcode=1 nonsfi_nacl=1 platform=arm
     # signal_test also passes if you use a real ARM device.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3851
R=mseaborn@chromium.org

Review URL: https://codereview.chromium.org/356393002

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13570 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

4 weeks agoBuild subzero with LLVM autoconf build.
dschuff@chromium.org [Thu, 31 Jul 2014 15:23:17 +0000 (15:23 +0000)]
Build subzero with LLVM autoconf build.

This adds the subzero repo to toolchain_build along with a
source rule to sync it. It updates LLVM revision to
get the Makefile changes which cause it to build.

No tests running yet, but llvm2ice is built with the rest of the LLVM tools.

R=jvoung@chromium.org,stichnot@chromium.org
NOTRY=true

Review URL: https://codereview.chromium.org/296053008

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13569 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

4 weeks agoTweak copyright notices to pass presubmit checks: remaining files
mseaborn@chromium.org [Wed, 30 Jul 2014 23:36:54 +0000 (23:36 +0000)]
Tweak copyright notices to pass presubmit checks: remaining files

These presubmit failures are an annoyance and get in the way of
contributors using the Commit Queue.

BUG=none
TEST="git cl presubmit"
R=jvoung@chromium.org

Review URL: https://codereview.chromium.org/428693003

git-svn-id: svn://svn.chromium.org/native_client/trunk/src/native_client@13568 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2