News for hackers. Stuff that matters.
Re:Can I exec an new process without an executable file? (2015) by qguv on Thursday November 03, 2022 @06:32AM (#33449124)

    ; set the first syscall argument to 42
    push   0x2a
    pop    edi

    ; select syscall 60 (sys_exit)
    push   0x3c
    pop    eax

    ; sys_exit(42)
    syscall
Re:Can I exec an new process without an executable file? (2015) by enriquto on Thursday November 03, 2022 @06:37AM (#33449162)
LOL my asm is rusty, didn't even know about the syscall instruction (I'd have used int 0x80 here)
Re:Can I exec an new process without an executable file? (2015) by mFixman on Thursday November 03, 2022 @09:56AM (#33451027)
What's the point of `push`ing constants to the stack and `pop`ing them to registers instead of `mov`ing them directly?
Re:Can I exec an new process without an executable file? (2015) by saagarjha on Thursday November 03, 2022 @11:01AM (#33452065)
I think they encode smaller?
Re:Can I exec an new process without an executable file? (2015) by anshargal on Thursday November 03, 2022 @10:00AM (#33451098)
That's cool - I wonder why exit code is not set to 42 in practice? binary still returns 0, must be a bug somewhere.
Re:Can I exec an new process without an executable file? (2015) by saagarjha on Thursday November 03, 2022 @11:01AM (#33452060)
A successful run not exiting with EXIT_SUCCESS usually requires a good reason to justify it.