Skip to content

Commit

Permalink
renaming UID variable, using /
Browse files Browse the repository at this point in the history
  • Loading branch information
mikea committed Dec 21, 2016
1 parent fe67713 commit d6a3e55
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion infra/base-images/base-libfuzzer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Build configuration is performed through following environment variables:
| `$SANITIZER ("address")` | Specifies sanitizer configuration to use. `address` or `undefined`.
| `$SANITIZER_FLAGS` | Specify compiler sanitizer flags directly. Overrides `$SANITIZER`.
| `$COVERAGE_FLAGS` | Specify compiler flags to use for fuzzer feedback coverage.
| `$SWITCH_UID` | User id to use while building fuzzers.
| `$BUILD_UID` | User id to use while building fuzzers.

# Examples

Expand Down
10 changes: 5 additions & 5 deletions infra/base-images/base-libfuzzer/compile
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ echo "CXXFLAGS=$CXXFLAGS"
echo "---------------------------------------------------------------"

BUILD_CMD="bash -x $SRC/build.sh"
if [ -z "${SWITCH_UID+}" ]; then
adduser -u $SWITCH_UID --disabled-password --no-create-home --gecos '' ossfuzz
chown -R ossfuzz /src
chown ossfuzz /out
su -c "$BUILD_CMD" ossfuzz
if [ -z "${BUILD_UID+}" ]; then
adduser -u $BUILD_UID --disabled-password --no-create-home --gecos '' builder
chown -R builder $SRC
chown builder $OUT
su -c "$BUILD_CMD" builder
else
$BUILD_CMD
fi
2 changes: 1 addition & 1 deletion infra/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def build_fuzzers(build_args):

command = [
'docker', 'run', '--rm', '-i', '--cap-add', 'SYS_PTRACE',
'-e', 'SWITCH_UID=' + os.getuid(),
'-e', 'BUILD_UID=%d' % os.getuid(),
'-v', '%s:/out' % os.path.join(BUILD_DIR, 'out', args.project_name),
'-v', '%s:/work' % os.path.join(BUILD_DIR, 'work', args.project_name),
'-t', 'ossfuzz/' + args.project_name,
Expand Down
6 changes: 2 additions & 4 deletions infra/libfuzzer-pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,15 @@ def call(body) {
def dockerGit = dockerfileConfig["git"]
def dockerContextDir = dockerfileConfig["context"] ?: ""
def dockerTag = "ossfuzz/$projectName"
def dockerUid = $uid
def dockerRunOptions = "-e SWITCH_UID=$dockerUid --cap-add SYS_PTRACE"
def dockerRunOptions = "-e BUILD_UID=$uid --cap-add SYS_PTRACE"

def date = java.time.format.DateTimeFormatter.ofPattern("yyyyMMddHHmm")
.format(java.time.LocalDateTime.now())

node {
def workspace = pwd()
echo "using uid $dockerUid"

def srcmapFile = "$workspace/srcmap.json"

echo "Building $dockerTag: $project"

sh "docker run --rm $dockerRunOptions -v $workspace:/workspace ubuntu bash -c \"rm -rf /workspace/out\""
Expand Down

0 comments on commit d6a3e55

Please sign in to comment.