Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(545)

Issue 7276050: Change startup ABI for untrusted code to be C-compatible (Closed)

Created:
9 years, 5 months ago by Roland McGrath
Modified:
9 years, 5 months ago
CC:
native-client-reviews_googlegroups.com
Visibility:
Public.

Description

Change startup ABI for untrusted code to be C-compatible This changes the trusted runtime to start up untrusted code with an ABI that is compatible with the normal C ABI for the machine. Rather than having a special machine-dependent ABI for the entry point, the entry point is now expected to be a normal C function of one argument. That argument is a pointer onto the stack, where lies the information previously passed there, but now in a uniform machine-independent format. This entails some changes in the trusted code to do the appropriate machine-dependent setup of the stack and registers. In the untrusted runtime libraries, it removes a great deal of assembly code now that the entry point function _start can be written entirely in C. Since it's pure C, the whole startup path is much more PNaCl-friendly. This makes it possible to clean up the IRT startup a bit more too, since it's easy to just use its own variant of that simple C function. Before this can land, it will require corresponding changes to the startup code in glibc and its dynamic linker, which will be reviewed separately. There will need to be a multi-stage deployment in which the toolchains get updated and then this change lands with a toolchain DEPS update included in the same commit. Note that this makes all old nexe binaries no longer work (if they need their arguments, environment, or auxv, which is used to work with the IRT). This is a hard break and we don't intend to provide any compatibility for old nexes or old IRT images. Any application rebuilt with the new toolchains (newlib or glibc, native or pnacl) should work without source changes. BUG=http://code.google.com/p/nativeclient/issues/detail?id=1131 TEST=pending R=bsy@google.com,sehr@google.com Committed: http://src.chromium.org/viewvc/native_client?view=rev&revision=5900

Patch Set 1 #

Total comments: 1

Patch Set 2 : avoid pnacl driver change (crt1.bc back to crt1.o); adjust expected errors in startup_message test #

Patch Set 3 : rebased #

Patch Set 4 : rebased, includes toolchain DEPS roll #

Patch Set 5 : add a few casts to suppress warnings #

Patch Set 6 : multilib vs -B hack #

Patch Set 7 : one more missing cast; rebased; new DEPS #

Patch Set 8 : disable bogus stack_frame.cc test for now #

Unified diffs Side-by-side diffs Delta from patch set Stats (+362 lines, -723 lines) Patch
M DEPS View 1 2 3 4 5 6 1 chunk +2 lines, -2 lines 0 comments Download
M SConstruct View 1 2 3 4 5 6 1 chunk +5 lines, -1 line 0 comments Download
M site_scons/site_tools/naclsdk.py View 1 2 3 1 chunk +5 lines, -5 lines 0 comments Download
M src/trusted/service_runtime/arch/arm/nacl_switch_to_app_arm.c View 2 chunks +19 lines, -35 lines 0 comments Download
M src/trusted/service_runtime/arch/x86_64/nacl_switch_64.S View 2 chunks +37 lines, -14 lines 0 comments Download
M src/trusted/service_runtime/nacl_config.h View 3 chunks +6 lines, -0 lines 0 comments Download
M src/trusted/service_runtime/sel_ldr_standard.c View 1 2 3 4 5 6 5 chunks +36 lines, -20 lines 0 comments Download
D src/untrusted/irt/elf_restart_arm.S View 1 chunk +0 lines, -29 lines 0 comments Download
D src/untrusted/irt/elf_restart_x86_32.S View 1 chunk +0 lines, -23 lines 0 comments Download
D src/untrusted/irt/elf_restart_x86_64.S View 1 chunk +0 lines, -21 lines 0 comments Download
M src/untrusted/irt/irt_entry.c View 1 chunk +58 lines, -24 lines 0 comments Download
M src/untrusted/irt/nacl.scons View 2 chunks +2 lines, -10 lines 0 comments Download
M src/untrusted/nacl/nacl.scons View 2 chunks +2 lines, -1 line 0 comments Download
M src/untrusted/nacl/nacl_irt.h View 2 chunks +2 lines, -1 line 0 comments Download
M src/untrusted/nacl/nacl_irt.c View 2 chunks +2 lines, -19 lines 0 comments Download
A src/untrusted/nacl/nacl_startup.h View 1 chunk +86 lines, -0 lines 0 comments Download
M src/untrusted/nacl/pthread_initialize_minimal.c View 1 chunk +0 lines, -8 lines 0 comments Download
A src/untrusted/nacl/start.c View 1 chunk +55 lines, -0 lines 0 comments Download
A src/untrusted/stubs/crt1.x View 1 chunk +13 lines, -0 lines 0 comments Download
D src/untrusted/stubs/crt1_arm.S View 1 chunk +0 lines, -74 lines 0 comments Download
D src/untrusted/stubs/crt1_x86.S View 1 chunk +0 lines, -225 lines 0 comments Download
D src/untrusted/stubs/crt1_x86_32.S View 1 chunk +0 lines, -92 lines 0 comments Download
D src/untrusted/stubs/crt1_x86_64.S View 1 chunk +0 lines, -84 lines 0 comments Download
M src/untrusted/stubs/nacl.scons View 1 2 3 4 5 2 chunks +21 lines, -26 lines 0 comments Download
M tests/startup_message/test_startup.py View 1 1 chunk +8 lines, -8 lines 0 comments Download
M tests/toolchain/nacl.scons View 1 2 3 4 5 6 7 1 chunk +3 lines, -1 line 0 comments Download

Messages

Total messages: 4 (0 generated)
Roland McGrath
I am still debugging some of the associated glibc changes, and there is at least ...
9 years, 5 months ago (2011-06-28 22:20:49 UTC) #1
sehr (please use chromium)
On 2011/06/28 22:20:49, Roland McGrath wrote: > I am still debugging some of the associated ...
9 years, 5 months ago (2011-06-29 17:34:35 UTC) #2
bsy
lgtm for tcb code. http://codereview.chromium.org/7276050/diff/1/src/trusted/service_runtime/sel_ldr_standard.c File src/trusted/service_runtime/sel_ldr_standard.c (right): http://codereview.chromium.org/7276050/diff/1/src/trusted/service_runtime/sel_ldr_standard.c#newcode836 src/trusted/service_runtime/sel_ldr_standard.c:836: if (NACL_STACK_PAD_BELOW_ALIGN != 0) { ...
9 years, 5 months ago (2011-06-29 18:23:07 UTC) #3
Roland McGrath
9 years, 5 months ago (2011-06-29 19:54:02 UTC) #4
On 2011/06/29 18:23:07, bsy wrote:
> lgtm for tcb code.
> 
>
http://codereview.chromium.org/7276050/diff/1/src/trusted/service_runtime/sel...
> File src/trusted/service_runtime/sel_ldr_standard.c (right):
> 
>
http://codereview.chromium.org/7276050/diff/1/src/trusted/service_runtime/sel...
> src/trusted/service_runtime/sel_ldr_standard.c:836: if
> (NACL_STACK_PAD_BELOW_ALIGN != 0) {
> if NACL_STACK_PAD_BELOW_ALIGN is zero, i bet the compilers are smart enough --
> with memset an intrinsic -- that the if is actually not needed.  dead code
> elimination of the constant boolean expression vs DCE of subtraction by zero
and
> memset of zero length....  i think it's slightly more readable to not have the
> if, but your choice.

That was my preference too, but I thought others might find it overly magical to
assume the harmlessness of the zero case.
Changed.


Thanks,
Roland

Powered by Google App Engine
This is Rietveld 408576698