This reminds me of a much older hack:
From: Roland McGrath
Subject: The syntactic power of Mocklisp with the type-safety of C!
Date: Tue, 25 Jun 1996 14:09:05 -0400
On lsd.gnu.ai.mit.edu, try running `/lib/ld-gnu.so.1 /usr/lib/libdl.so'. I whipped up a quick trivial parser for symbols, strings, integers, and lists, and just implemented the obvious functionality (see /src/libc/elf/eval.c).
delasyd 302 & /lib/ld-gnu.so.1 /usr/lib/libdl.so
(printf "I am %d in %d\n" (getuid) (getpid))
I am 5281 in 28127
(exit 42)
[Exit 42]
delasyd 303 ) /lib/ld-gnu.so.1 /usr/lib/libdl.so
(kill (getppid) 1)
Process shell hangup
Muwahahahah. It probably only works on the i386, but I am going to leave this in there so by next year most every Linux machine has an escape hatch when the compiler isn't there and the program you need is fucked.
I envision:
# /lib/ld-gnu.so.1 /usr/lib/libdl.so
(open "/dev/hda1" 2)
(write 2 "my fucking boot blocks" 37)
(sync)
(reboot 0)
Sadly it's been broken for years. It just segfaults when you try to execute it now, and no one's been motivated to fix it. And by no one I mean me, since probably only 3 people in the world ever even knew about it. Until just now.
From: Roland McGrath
Subject: The syntactic power of Mocklisp with the type-safety of C!
Date: Tue, 25 Jun 1996 14:09:05 -0400
On lsd.gnu.ai.mit.edu, try running `/lib/ld-gnu.so.1 /usr/lib/libdl.so'. I whipped up a quick trivial parser for symbols, strings, integers, and lists, and just implemented the obvious functionality (see /src/libc/elf/eval.c).
delasyd 302 & /lib/ld-gnu.so.1 /usr/lib/libdl.so
(printf "I am %d in %d\n" (getuid) (getpid))
I am 5281 in 28127
(exit 42)
[Exit 42]
delasyd 303 ) /lib/ld-gnu.so.1 /usr/lib/libdl.so
(kill (getppid) 1)
Process shell hangup
Muwahahahah. It probably only works on the i386, but I am going to leave this in there so by next year most every Linux machine has an escape hatch when the compiler isn't there and the program you need is fucked.
I envision:
# /lib/ld-gnu.so.1 /usr/lib/libdl.so
(open "/dev/hda1" 2)
(write 2 "my fucking boot blocks" 37)
(sync)
(reboot 0)
Sadly it's been broken for years. It just segfaults when you try to execute it now, and no one's been motivated to fix it. And by no one I mean me, since probably only 3 people in the world ever even knew about it. Until just now.
$ echo $SHELL
/bin/bash
$ source ctypes.sh
$ dlopen libc.so.6
$ dlcall $RTLD_DEFAULT puts "Hello, World"
Hello, World
/bin/bash
$ source ctypes.sh
$ dlopen libc.so.6
$ dlcall $RTLD_DEFAULT puts "Hello, World"
Hello, World
View 9 previous comments
Oh man, it's gone altogether now? Damn. I guess I'm not surprised though.
Drepper removed it, didn't he.Jul 28, 2015
Nope, +Siddhesh Poyarekar, in 2014. Uli just left it to rot gently.Jul 28, 2015
Good on Uli, but I can't find fault in removing it, no matter who did it. It just means I won't get drunk some night and decide to fix it. :-)Jul 28, 2015
We actually dropped the code a while ago because it hadn't worked in so long. I did care to keep it working, but on machines with modern calling conventions it just wasn't doable with the cheesy GCC builtins any more.Jul 28, 2015
I only cared about x86_64. :-)Jul 28, 2015
+Roland McGrath, yeah, I was assuming it was the ever-neglected __builtin_apply*() stuff that torpedoed it. Nobody pays attention to important builtins like that any more, they're too interested in things like threading that works and systems with >2GiB RAM and petty, insignificant stuff like that. :)
(I'm not sure I've ever seen any other use of __builtin_apply() actually. Mind you, I haven't looked.)Jul 29, 2015
Add a comment...