View Single Post
Posts: 163 | Thanked: 96 times | Joined on Feb 2010 @ Israel
#102
Excuse my ignorance, I havn't had a chance to setup a game with PreEnv yet, but from what I can understand, if you are only trying to remove the noexec on the MyDocs partition so that you can execute a binary, why wouldn't a python script like so work?
Code:
import sys
import os
import shutil
import stat

BIN_NAME = '/home/user/_preeenv_bin'

elf = sys.argv[1]
shutil.copy2(elf, BIN_NAME)
os.chmod(BIN_NAME, stat.S_IRUSR|stat.S_IWUSR|stat.S_IXUSR|stat.S_IRGRP|stat.S_IROTH)
os.environ['LD_PRELOAD']=os.environ['LD_PRELOAD'] + ' /home/user/libprepre.so.1'
os.execve(BIN_NAME, ['./'+elf], os.environ)
EDIT:
Well, I decided to bite the bullet and give it a try. I, obviously forgot to set the permissions properly, but except for that the only problem I seemed to see was that it was taking the service name from /proc/self/exe, and that should be easy to fix in PreEnv. (I tried fixing it with my own LD_PRELOAD but it was causing unrelated issues.)

Am I missing something?

(Save it as runme.py and then in a terminal use:
$ python runme.py brainchallange)

EDIT:
OK Got it working! I am running Brain Challenge from MyDocs without any remounting. There are still quite a few bugs to iron out (I still can't get the service name correct) but it seems to be possible to work.
I updated the script, I wont post the preloaded dll for now because I messed up there a bit but basically it just returns the proper string for any readlink on "/proc/*/exe". It's late here so I am going to sleep. If anyone else has a try, good luck!

Last edited by dbrodie; 2011-01-30 at 21:46.