aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/tools
Commit message (Collapse)AuthorAge
* Add a test for sandboxing when nobody's UID is differentGravatar Brian Silverman2016-08-18
| | | | | | | | | | | | | | | | Please don't merge before I8b8c3596fd2a4c125071406eefd407ca402099dd. The test will fail then. I've seen two issues with this functionality breaking: #481 and #1637. Seems like it's time to add a test which catches the issue on the Debian/Ubuntu machines people commonly test on. The test fails on my Debian system before I8b8c3596fd2a4c125071406eefd407ca402099dd, and passes with that change applied. -- Change-Id: Ib785c874cdb9192920f9935b696bfd6c9c0e5f4f Reviewed-on: https://bazel-review.git.corp.google.com/#/c/5451/ MOS_MIGRATED_REVID=130635565
* call SetupDirectories after uids are mapped in the user namespaceGravatar Jason Lunz2016-08-18
| | | | | | | | | fixes #1637 (https://github.com/bazelbuild/bazel/issues/1637) -- Change-Id: I8b8c3596fd2a4c125071406eefd407ca402099dd Reviewed-on: https://bazel-review.git.corp.google.com/#/c/5410/2 MOS_MIGRATED_REVID=130633667
* Short-circuit runfiles tree creation if runfiles are disabled (for example, ↵Gravatar Lukacs Berki2016-08-04
| | | | | | | on Windows by default) -- MOS_MIGRATED_REVID=129319018
* Rename namespace-sandbox/-runner to linux-sandbox.Gravatar Philipp Wollermann2016-07-18
| | | | | -- MOS_MIGRATED_REVID=127538990
* Rollback of commit 1e37a5375f918376c132fa537e25695f673f41b8.Gravatar Dmitry Lomov2016-07-07
| | | | | | | | | | | | | *** Reason for rollback *** Apparently we now try to open output files for the process twice: once when we are constructing the output streams, and the second time when we tell the process to redirect its outputs. This causes the outputs to be empty on Windows *** Original change description *** Do redirection of stdout / stderr in Java instead of reimplementing it in every process wrapper again. -- MOS_MIGRATED_REVID=126801016
* Do redirection of stdout / stderr in Java instead of reimplementing it in ↵Gravatar Philipp Wollermann2016-06-30
| | | | | | | every process wrapper again. -- MOS_MIGRATED_REVID=126279021
* Rollback of commit 2ee0377d835af26a6488ad7b80291953860c4dce.Gravatar Philipp Wollermann2016-06-21
| | | | | | | | | | | | | | | | *** Reason for rollback *** Breaks Bazel build on Ubuntu 15.10. Manually tested that rolling this back fixes the build. *** Original change description *** sandbox: Mount input files and directories actually read-only. Fixes #1364. RELNOTES[INC]: Bazel's sandbox mounts input files read-only in this release. If your build suddenly fails due to tools not being able to write to files, then this is probably working as intended (you should never modify input files in your build), but please feel free to provide feedback. -- MOS_MIGRATED_REVID=125439581
* Disable runfiles on Windows.Gravatar Dmitry Lomov2016-06-21
| | | | | | | | | | | | This adds a new configuration option that allows disabling the creation of symlink forest for runfiles. On Windows, symlink forest is disabled by default; only the runfiles manifest is created. For shell tests, a function 'rlocation' is provided that converts from runfiles location to a real location. Work towards #1212. -- MOS_MIGRATED_REVID=125439553
* sandbox: Mount input files and directories actually read-only.Gravatar Philipp Wollermann2016-06-21
| | | | | | | | | Fixes #1364. RELNOTES[INC]: Bazel's sandbox mounts input files read-only in this release. If your build suddenly fails due to tools not being able to write to files, then this is probably working as intended (you should never modify input files in your build), but please feel free to provide feedback. -- MOS_MIGRATED_REVID=125324318
* sandbox: So refactoring, much no-op change, wow.Gravatar Philipp Wollermann2016-06-21
| | | | | | | (But this will make it easier to try out the overlayfs-based sandbox later.) -- MOS_MIGRATED_REVID=125320914
* Do not try to install a default handler for SIGSTOP and SIGKILL.Gravatar Philipp Wollermann2016-06-13
| | | | | | | Fixes #1330. -- MOS_MIGRATED_REVID=124705354
* Move xcode-locator into src/tools packages, defining it as a target under ↵Gravatar Chris Parsons2016-05-30
| | | | | | | @bazel_tools. Currently the tool still remains in embedded_binaries, but we will migrate away from that: Eventually it can simply live just under @bazel_tools. -- MOS_MIGRATED_REVID=123436822
* Make deleting runfiles tree on Windows "best effort".Gravatar Dmitry Lomov2016-05-10
| | | | | | | | | | | | | | On Windows, we use hard links in runfiles tree, and we need to delete and recreate all of them on every runfiles tree update (otherwise the links might still point to outdated files). Occasionally the hard link cannot be unlinked (due to permissions or file being busy). This CL just ignores the error (and hopes for the best). This will allow us to make progress on Windows. Work towards #1212. -- MOS_MIGRATED_REVID=121949474
* Print out the error from getpwuid instead of segfaultingGravatar Brian Silverman2016-04-26
| | | | | | | | | | | | | | In a mailing list discussion [1], somebody reported namespace-sandbox segfaulting, which was traced down to something with getpwuid. This debugging would be a lot easier if bazel printed out the error instead of segfaulting. [1] https://groups.google.com/d/topic/bazel-discuss/FR949mCW9cA/discussion -- Change-Id: I96320287b1886347343c1a50d660c097534d91d2 Reviewed-on: https://bazel-review.googlesource.com/#/c/3400 MOS_MIGRATED_REVID=120803905
* Fix sandbox when nobody's uid != 65534Gravatar Brian Silverman2016-04-18
| | | | | | | | | | | | It looks like the fix for #481 wasn't quite complete. Somebody on the mailing list reported namespace-sandbox failing due to this [1]. [1] https://groups.google.com/d/topic/bazel-discuss/FR949mCW9cA/discussion -- Change-Id: I52dbe4c9639c9df282a035d9acc9b8bff0c5004b Reviewed-on: https://bazel-review.googlesource.com/#/c/3401 MOS_MIGRATED_REVID=120102039
* Fixes bugs so that we can build bazel with bazel twice without cleaning up ↵Gravatar Yun Peng2016-04-14
| | | | | | | | | on Windows -- Change-Id: I0048202b431ca05b88f67153389ca40c1542b1d5 Reviewed-on: https://bazel-review.googlesource.com/#/c/3371 MOS_MIGRATED_REVID=119861292
* Automated [] rollback of commit 525fa71b0d6f096e9bfb180f688a4418c4974eb4.Gravatar Yue Gan2016-04-14
| | | | | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Contributor finds some bugs and after fixing some bugs there are more bugs to fix now. *** Original change description *** Mount whole directories into the sandbox when possible This halves the overhead with sandboxing enabled vs disabled for a test that basically only mounts a bunch of files out of a directory, and slows that same test with a single extra file added to the directory (but not mounted) by only ~4%. The test is <https://gist.github.com/bsilver8192/10527a862ce16bb7f79a> with 30000 inputs moved to a subdirectory and on... *** ROLLBACK_OF=119138157 -- MOS_MIGRATED_REVID=119828267
* Fixes bugs so that we can build bazel with bazel on WindowsGravatar Yun Peng2016-04-14
| | | | | | | | | | | | | | | | | | | src/main/java/com/google/devtools/build/lib/exec/SymlinkTreeHelper.java: enable --windows_compatible flag on Windows to make build-runfiles.exe work. scritps/bootstrap/compile.sh: --windows_compatible will also be passed to a dummy build-runfiles.exe defined in complie.sh. Which is actully a batch script, modify it to make it work. ----- With the changes above, we are able to build bazel with bazel. But when you try to run ./compile.sh compile /path/to/bazel again without clean up tmp directory, it will fail with a permission deny error. The reason seems to be that you can't use build-runfile.exe to build the same hard link twice, still trying to solve that. -- Change-Id: I93340b1ba9fa415f6db963b106e264799e33ede3 Reviewed-on: https://bazel-review.googlesource.com/#/c/3334 MOS_MIGRATED_REVID=119751076
* Mount whole directories into the sandbox when possibleGravatar Brian Silverman2016-04-07
| | | | | | | | | | | | | | | | | | | | This halves the overhead with sandboxing enabled vs disabled for a test that basically only mounts a bunch of files out of a directory, and slows that same test with a single extra file added to the directory (but not mounted) by only ~4%. The test is <https://gist.github.com/bsilver8192/10527a862ce16bb7f79a> with 30000 inputs moved to a subdirectory and only 10 genrules. This change means symlinks will be mounted directly as their target rather than as a symlink, but this solves some weird behavior with multi-level symlinks and will only break things which don't declare all of their dependencies. -- Change-Id: I1aa39dccb2e5fca2893bdab9065ee043d34019b2 Reviewed-on: https://bazel-review.googlesource.com/#/c/3220/ MOS_MIGRATED_REVID=119138157
* Add a bazel-srcs target to the top-level package containing all Bazel sourcesGravatar Damien Martin-Guillerez2016-02-29
| | | | | | | | This target include all non tests targets of Bazel to do integration tests of bootstrapping. -- MOS_MIGRATED_REVID=115830741
* Exclude weirdly-named files from the JDK.Gravatar Lukacs Berki2016-02-24
| | | | | | | This remotes one stumbling block from bootstrapping on Windows. -- MOS_MIGRATED_REVID=115447112
* Workaround gcc bug.Gravatar Dmitry Lomov2016-02-22
| | | | | | | | | Struct initialization for nested struct broken since 4.9.0. (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59832) Fixes #947. -- MOS_MIGRATED_REVID=115224533
* sandbox: Easier debugging of sandbox failures, when using both ↵Gravatar Yue Gan2016-02-19
| | | | | | | | | | | --verbose_failures and --sandbox_debug. RELNOTES: - When using both --verbose_failures and --sandbox_debug, Bazel prints instructions how to spawn a debugging shell inside the sandbox. - When namespace-sandbox is run with the -D (debug) flag and inside a terminal, it spawns a shell inside the sandbox to aid in debugging when the sandboxed command fails. -- MOS_MIGRATED_REVID=114953983
* xcode_locator outputs developer directories instead of xcode pathsGravatar Chris Parsons2016-02-18
| | | | | -- MOS_MIGRATED_REVID=114910110
* Always create /tmp directory in the sandbox (fixes #913).Gravatar Philipp Wollermann2016-02-16
| | | | | | | | | Fix one memory leak reported in #878. Fix possible heap corruption in create_dirs handling. Don't fail if "dev" and "proc" already exist in the sandbox directory. -- MOS_MIGRATED_REVID=114753381
* Use hard links to create empty files.Gravatar Brian Silverman2016-02-16
| | | | | | | | | | | | | | | | This speeds up my test of running a bunch of genrules with 3000 inputs by 2x on XFS. It might speed up ext4 a bit, but it definitely doesn't make it slower. XFS and ext4 are about the same speed with this. Test at <https://gist.github.com/bsilver8192/10527a862ce16bb7f79a>. Refs #852 RELNOTES: Improved sandbox performance on XFS filesystems. -- Change-Id: Ifabc0442f9f919d50cb5fe80a6445890c6d7f03e Reviewed-on: https://bazel-review.googlesource.com/#/c/2890/1 MOS_MIGRATED_REVID=114693725
* Fix JDK tools extensions for Windows.Gravatar Dmitry Lomov2016-02-12
| | | | | | | Needed for #276. -- MOS_MIGRATED_REVID=114527619
* Introduce a special CPU for Windows and add msys compiler toolchain.Gravatar Dmitry Lomov2016-02-03
| | | | | | | | We might revisit what the default toolchain for Windows should be, but this CL uses msys to simplify bootstrapping. -- MOS_MIGRATED_REVID=113665255
* Add a (working) windows compatibility mode that makes Bazel create hardlinks ↵Gravatar Lukacs Berki2016-01-26
| | | | | | | | | | | for links to writable files. Curiously enough, the native Unix JNI wrapper already had a function for link(), but it wasn't on the Java interface. build-runfiles is also updated accordingly. -- MOS_MIGRATED_REVID=113029168
* Query for user nobody and exit sandbox if unable to find.Gravatar Pedro Kiefer2016-01-08
| | | | | | | | | | | Only create homedir if different from "/". Fixes issue #481. -- Change-Id: I240ea02974dfaafa07d1c9772baf372d5ea7755b Reviewed-on: https://bazel-review.googlesource.com/#/c/2650/ MOS_MIGRATED_REVID=111686914
* Add xcode_locator to bazel's embedded binaries.Gravatar Chris Parsons2016-01-08
| | | | | | | For bazel on non-darwin architectures, this will simply be a stub, and should never be invoked. On darwin arcitectures, the tool will map xcode version to xcode path on the host system. -- MOS_MIGRATED_REVID=111651147
* Upstream some basic changes from dslomov windows branch.Gravatar Dmitry Lomov2015-12-07
| | | | | | | | | The code changes are mostly due to dslomov, not me, although I refactored the Jvm class a bit based on his changes. I set dslomov as the author. -- Reviewed-on: https://github.com/bazelbuild/bazel/pull/688 MOS_MIGRATED_REVID=109536553
* Export xjc and wsimport tools from JDKGravatar Alpha Lam2015-12-02
| | | | | | | | | | | This change exports //tools/jdk:xjc and //tools/jdk:wsimport as external tools. This will allow build rules to generate JAXB and JAX-WS artifacts. -- Change-Id: I6e2cf5a155be5070c346421302ad96b3e1c2188c Reviewed-on: https://bazel-review.googlesource.com/#/c/2420 MOS_MIGRATED_REVID=109172989
* Fix build on FreeBSD.Gravatar Googler2015-11-17
| | | | | -- MOS_MIGRATED_REVID=108029812
* handle darwin_x86_64 target cpuGravatar Chris Parsons2015-10-30
| | | | | -- MOS_MIGRATED_REVID=106605250
* Print the name of the execvp'd file for easier debugging in case the call fails.Gravatar Philipp Wollermann2015-10-23
| | | | | -- MOS_MIGRATED_REVID=106083151
* Fix for SIOCGIFINDEX undefined on Mac ↵Gravatar Dave MacLachlan2015-10-19
| | | | | | | | | | | | (https://github.com/bazelbuild/bazel/issues/510) This compiles with the assumption that all we were using SIOCGIFINDEX for was to verify that the name was valid. I think the code as written before was actually wrong as the index value, and the flags value for a ifreq structure actually shared memory, so we were potentially setting flags that we didn't want to set based on the actual index returned. -- MOS_MIGRATED_REVID=105619856
* Make the sandbox handle an arbitrary number of argumentsGravatar Brian Silverman2015-10-13
| | | | | | | | | | I was hitting argument length restrictions when trying to run rules which take 2 GCC installs and a Clang install as inputs. -- Change-Id: Iee27bb6fb50fe94bff4b2500bbcfa9381b05d63d Reviewed-on: https://bazel-review.googlesource.com/#/c/2090 MOS_MIGRATED_REVID=105300670
* Introduce two new options to Linux sandbox wrapper:Gravatar Ming Zhao2015-10-08
| | | | | | | | | | | * -n: Create a new network namespace with only loopback interface. * -r: set the uid/gid inside the sandbox to be root (instead of nobody) so that setuid programs like ping can still run when needed. -- Change-Id: I8ab434e47e0f6933ee9de02e135c8daec39fe73f Reviewed-on: https://bazel-review.googlesource.com/#/c/2101/ MOS_MIGRATED_REVID=104858163
* sandbox: Push creation of needed empty directories (like /tmp, TEST_TMPDIR) ↵Gravatar Philipp Wollermann2015-10-08
| | | | | | | into the namespace-sandbox, instead of doing it in Java. This fixes an issue where the namespace-sandbox would check-fail on an mkdir() of a directory that was already created in the LinuxSandboxedStrategy. -- MOS_MIGRATED_REVID=104851563
* Rationalize copyright headersGravatar Damien Martin-Guillerez2015-09-25
| | | | | | | | | | | The headers were modified with `find . -type f -exec 'sed' '-Ei' 's|Copyright 201([45]) Google|Copyright 201\1 The Bazel Authors|' '{}' ';'` And manual edit for not Google owned copyright. Because of the nature of ijar, I did not modified the header of file owned by Alan Donovan. The list of authors were extracted from the git log. It is missing older Google contributors that can be added on-demand. -- MOS_MIGRATED_REVID=103938715
* sandbox: Show user-friendly mount paths in the namespace-sandbox debug log.Gravatar Philipp Wollermann2015-09-08
| | | | | | | Improvement for #424. -- MOS_MIGRATED_REVID=102566748
* sandbox: When spawn.getInputs() contains a directory, recurse into it and ↵Gravatar Philipp Wollermann2015-09-02
| | | | | | | mount the individual files. -- MOS_MIGRATED_REVID=102142064
* Fix up documentation that was backwards for KillEverything.Gravatar Dave MacLachlan2015-09-02
| | | | | -- MOS_MIGRATED_REVID=102050490
* Make writes thread-safe during local tests by opening files with O_APPEND.Gravatar Eric Fellheimer2015-08-27
| | | | | -- MOS_MIGRATED_REVID=101572272
* Port to FreeBSD.Gravatar Doug Rabson2015-08-26
| | | | | | | -- Change-Id: I4e65cc583e758d2f7e45209ffcb37f6a871e2ed7 Reviewed-on: https://bazel-review.git.corp.google.com/#/c/1840 MOS_MIGRATED_REVID=101462155
* Instead of assuming that sandboxing will generally work on everything that ↵Gravatar Philipp Wollermann2015-08-26
| | | | | | | | | is Linux, do real auto-detection whether it is supported on the host or not and enable / disable it based on the result. The warning that is printed when the Linux kernel is too old to support sandboxing can be disabled via a flag. -- MOS_MIGRATED_REVID=101461120
* namespace-sandbox: Actually do exponential backoff on a failed unshare() ↵Gravatar Philipp Wollermann2015-08-26
| | | | | | | syscall. -- MOS_MIGRATED_REVID=101458944
* Execute spawns inside sandboxes to improve hermeticity (spawns can no longer ↵Gravatar Philipp Wollermann2015-08-26
| | | | | | | | | | | | use non-declared inputs) and safety (spawns can no longer affect the host system, e.g. accidentally wipe your home directory). This implementation works on Linux only and uses Linux containers ("namespaces"). The strategy works with all actions that Bazel supports (C++ / Java compilation, genrules, test execution, Skylark-based rules, ...) and in tests, Bazel could successfully bootstrap itself and pass the whole test suite using sandboxed execution. This is not the default behavior yet, but can be activated explicitly by using: bazel build --genrule_strategy=sandboxed --spawn_strategy=sandboxed //my:stuff -- MOS_MIGRATED_REVID=101457297
* Improve the JDK and JRE filegroups to include all the necessary parts. Then ↵Gravatar Philipp Wollermann2015-08-24
| | | | | | | fix the Skylark rules and tests that so far failed to declare dependencies on the JVM. -- MOS_MIGRATED_REVID=101215495