Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ ACCEPTABLE_ARGUMENTS = set([
# FEATURE_VERSION file. This is used for PNaCl ABI compatibility
# testing.
'toolchain_feature_version',
'sysroot',
])


Expand Down Expand Up @@ -495,6 +496,9 @@ if breakpad_tools_dir is not None:
pre_base_env['BREAKPAD_TOOLS_DIR'] = pre_base_env.Dir(
os.path.abspath(breakpad_tools_dir))

sysroot_flags = []
if ARGUMENTS.get('sysroot') is not None:
sysroot_flags.append('--sysroot=' + os.path.abspath(ARGUMENTS.get('sysroot')))

# CLANG
DeclareBit('clang', 'Use clang to build trusted code')
Expand Down Expand Up @@ -2480,24 +2484,21 @@ def SetUpLinuxEnvArm(env):
jail = env.GetToolchainDir(toolchain_name='arm_trusted')
if not platform.machine().startswith('arm'):
# Allow emulation on non-ARM hosts.
env.Replace(EMULATOR=jail + '/run_under_qemu_arm')
env.Replace(EMULATOR='qemu-armhf -L /usr/arm-linux-gnueabihf/ -cpu cortex-a9')
if env.Bit('built_elsewhere'):
def FakeInstall(dest, source, env):
print('Not installing', dest)
# Replace build commands with no-ops
env.Replace(CC='true', CXX='true', LD='true',
AR='true', RANLIB='true', INSTALL=FakeInstall)
else:
sysroot=os.path.join(
'${SOURCE_ROOT}/build/linux/debian_bullseye_arm-sysroot')
env.Prepend(CCFLAGS=['--sysroot='+sysroot],
env.Prepend(CCFLAGS=sysroot_flags,
ASFLAGS=[],
# The -rpath-link argument is needed on Ubuntu/Precise to
# avoid linker warnings about missing ld.linux.so.3.
# TODO(sbc): remove this once we stop supporting Precise
# as a build environment.
LINKFLAGS=['-fuse-ld=lld',
'--sysroot='+sysroot]
LINKFLAGS=['-fuse-ld=lld'] + sysroot_flags
)
# Note we let the compiler choose whether it's -marm or -mthumb by
# default. The hope is this will have the best chance of testing
Expand Down Expand Up @@ -2699,18 +2700,14 @@ def MakeGenericLinuxEnv(platform=None):
)

if linux_env.Bit('build_x86_32'):
sysroot=os.path.join(
'${SOURCE_ROOT}/build/linux/debian_bullseye_i386-sysroot')
linux_env.Prepend(
CCFLAGS = ['-m32', '--sysroot='+sysroot],
LINKFLAGS = ['-m32', '--sysroot='+sysroot],
CCFLAGS = ['-m32'] + sysroot_flags,
LINKFLAGS = ['-m32'] + sysroot_flags,
)
elif linux_env.Bit('build_x86_64'):
sysroot=os.path.join(
'${SOURCE_ROOT}/build/linux/debian_bullseye_amd64-sysroot')
linux_env.Prepend(
CCFLAGS = ['-m64'],#, '--sysroot='+sysroot],
LINKFLAGS = ['-m64']#, '--sysroot='+sysroot],
CCFLAGS = ['-m64'] + sysroot_flags,
LINKFLAGS = ['-m64'] + sysroot_flags,
)
elif linux_env.Bit('build_arm'):
SetUpLinuxEnvArm(linux_env)
Expand Down
5 changes: 2 additions & 3 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ def SetupEnvironment():
env.pnacl_base = os.path.join(env.toolchain_base, 'pnacl_newlib')

# QEMU
env.arm_root = os.path.join(env.toolchain_base, 'arm_trusted')
env.qemu_arm = os.path.join(env.arm_root, 'run_under_qemu_arm')
env.qemu_arm_args = ['qemu-armhf', '-L', '/usr/arm-linux-gnueabihf/']

env.mips32_root = os.path.join(env.toolchain_base, 'mips_trusted')
env.qemu_mips32 = os.path.join(env.mips32_root, 'run_under_qemu_mips32')
Expand Down Expand Up @@ -262,7 +261,7 @@ def RunSelLdr(args, quiet_args=[], collate=False, stdin_string=None):
bootstrap_loader_args = []
arch = pynacl.platform.GetArch3264()
if arch != pynacl.platform.ARCH3264_ARM and env.arch == 'arm':
prefix = [ env.qemu_arm, '-cpu', 'cortex-a9']
prefix = env.qemu_arm_args + ['-cpu', 'cortex-a9']
if env.trace:
prefix += ['-d', 'in_asm,op,exec,cpu']
args = ['-Q'] + args
Expand Down
2 changes: 1 addition & 1 deletion src/trusted/service_runtime/nacl_syscall_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ int32_t NaClSysTestInfoLeak(struct NaClAppThread *natp) {
* Put some interesting bits into the VFP registers.
*/

static const char manybytes[64] =
__attribute__((aligned(4))) static const char manybytes[64] =
"Sensitive information must not be leaked to untrusted code!!!!\n";

__asm__ volatile("vldm %0, {d0-d7}" :: "r" (manybytes) :
Expand Down
15 changes: 13 additions & 2 deletions tests/common/register_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,12 +400,23 @@ extern const uint8_t kX86FlagBits[5];
"push {r14}\n" \
/* Save r0-r12 and sp; adjust sp for the pushes above */ \
"add r14, sp, #0xc\n" \
"push {r10-r12, r14}\n" \
"push {r14}\n" \
"push {r12}\n" \
"push {r11}\n" \
"push {r10}\n" \
/* Push a dummy value for r9, which the tests need not compare */ \
"mov r10, #0\n" \
"push {r10}\n" \
/* Save the rest of struct NaClSignalContext */ \
"push {r0-r8}\n" \
"push {r8}\n" \
"push {r7}\n" \
"push {r6}\n" \
"push {r5}\n" \
"push {r4}\n" \
"push {r3}\n" \
"push {r2}\n" \
"push {r1}\n" \
"push {r0}\n" \
/* Now save a correct prog_ctr value */ \
"adr r0, " #def_func "\n" \
"str r0, [sp, #0x3c]\n" \
Expand Down
5 changes: 3 additions & 2 deletions tools/test_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,9 @@ def RunTestWithInputOutput(cmd, input_data, capture_stderr=True, timeout=None):
cpu_time_consumed = 0
else:
cpu_time_consumed = timer.ElapsedCpuTime(p)
stdout = stdout.decode('utf-8', 'backslashreplace')
stderr = stderr.decode('utf-8', 'backslashreplace')
if not isinstance(stdout, str):
stdout = stdout.decode('utf-8', 'backslashreplace')
stderr = stderr.decode('utf-8', 'backslashreplace')
return (cpu_time_consumed, retcode, failed, stdout, stderr)


Expand Down