|
|
Subscribe / Log in / New account

Remote execution in the GNOME tracker

Remote execution in the GNOME tracker

Posted Oct 12, 2023 9:44 UTC (Thu) by SLi (subscriber, #53131)
Parent article: Remote execution in the GNOME tracker

I'd think harder guarantees could, in theory, be provided for C.

Actually, how hard would it be to make integrating C and C-on-WebAssembly smoother?

Imagine you could just write code that looks something like this:

struct output {
    int something;
    bool ok;
};

// WASM_OUT: wasm may write here
// WASM_STRZ: input for WebAssembly, size determined by strlen()

[[webassembly]] int sensitive_computation([[wasm_out]] struct output *out, const char *str, struct something smth) {
    ...
}

void foo(int x, const char *str, struct something smth) {
    struct output out;
    int x = sensitive_computation(WASM_OUT(out), WASM_STRZ(str), smth);
    ...
}

The call would spawn a WebAssembly environment, copy str's bytes to its memory address, and after the execution has finished would copy the contents of out to foo's struct out and return the value returned by the function. I'd expect to be use completely normal C in sensitive_computation, apart from of course anything that requires system calls or memory management. We might perhaps add another function type, [[webassembly_internal]], which is a function that can be called from WebAssembly code without restrictions (i.e. it's not limited to the in/out thing, it is linked into the same WebAssembly binary and operates in the same sandbox).

But I must say I do not quite know how much scaffolding and setup WebAssembly requires.


to post comments

Remote execution in the GNOME tracker

Posted Oct 12, 2023 13:55 UTC (Thu) by josh (subscriber, #17465) [Link]

If all you need is computation and an input and output pipe, that's quite easy with wasmtime.

If you need to expose a variety of API functions to the WebAssembly layer, that's straightforward as well, but a little more challenging, though it's about to get a lot easier with the new component model that just got standardized.

Remote execution in the GNOME tracker

Posted Oct 12, 2023 18:19 UTC (Thu) by samlh (subscriber, #56788) [Link]


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds