serenity icon indicating copy to clipboard operation
serenity copied to clipboard

Kernel+DynamicLoader: Allow syscalls from dynamic loader more often

Open DanShaders opened this issue 9 months ago • 3 comments

Previously, if DynamicLoader were invoked directly, it wasn't able to perform syscalls after the point just before the call to the main executable entry. This made dlopen to crash if it were called from within an executable that was itself executed using /usr/lib/Loader.so <executable>.

DanShaders avatar May 02 '24 03:05 DanShaders

Commit message nitpicks: if DynamicLoader were invoked directly => if DynamicLoader was invoked directly it wasn't able to perform syscalls => it wouldn't be able to perform syscalls to crash if it were called from => to crash if it was called from

Can we split the kernel change and userspace change as well into 2 separate commits?

Also, do you have an example of such program being run with /usr/lib/Loader.so?

supercomputer7 avatar May 03 '24 06:05 supercomputer7

Seems like was/were after "if" somehow depends on the factuality of the clause (https://ell.stackexchange.com/a/127747), though I cannot decide whether "if DynamicLoader were invoked directly" is a fact or an imaginary statement in this context.

DanShaders avatar May 03 '24 10:05 DanShaders

Also, do you have an example of such program being run with /usr/lib/Loader.so?

Yes! cd /usr/Tests/LibELF; /usr/lib/Loader.so /usr/Tests/LibELF/TestDlOpen crashes on master and works with this PR.

DanShaders avatar May 03 '24 10:05 DanShaders

Seems like was/were after "if" somehow depends on the factuality of the clause (https://ell.stackexchange.com/a/127747), though I cannot decide whether "if DynamicLoader were invoked directly" is a fact or an imaginary statement in this context.

I don't know, to me it sounds incorrect to use were here, but again, it's more a nitpick than an actual problem. I see that you changed it anyway, so it looks good to me :)

supercomputer7 avatar May 03 '24 13:05 supercomputer7

Also, do you have an example of such program being run with /usr/lib/Loader.so?

Yes! cd /usr/Tests/LibELF; /usr/lib/Loader.so /usr/Tests/LibELF/TestDlOpen crashes on master and works with this PR.

Nice! Can you include this in the commit message? I was not aware that we have such test unit, and surely by looking into the commit message one could tell how to test this easily :)

supercomputer7 avatar May 03 '24 14:05 supercomputer7