diff options
author | Lauri Aarnio <Lauri.Aarnio@iki.fi> | 2008-12-08 16:58:31 +0200 |
---|---|---|
committer | Lauri Leukkunen <lle@rahina.org> | 2008-12-11 23:47:00 +0200 |
commit | 576ed39bde4ec3034e22aa08b61e7084a87553a5 (patch) | |
tree | ff86f2d15fe5bbedbf20f83cee442f48d77fb700 /include | |
parent | 52f61f715c3f53e0eb52e13400c1b979b8f26ab4 (diff) |
Fixed /proc/self/exe (and /proc/<MY_PID>/exe)
- Implemented a special mapping function for /proc, to be
able to map the symlink at /proc/self/exe.
- This can be described as a countermeasure to side-effects of
mapping exec parameters: /proc/self/exe (as well as
/proc/<MY_PID>/exe, which is the same thing) need special care
if the binary was started by anything else than direct exec.
Examples:
a) if CPU transparency is used, the real /proc/self/exe points
to e.g. Qemu. Now SB2 can make it look like the link points
to the binary which is running under qemu.
b) if "ld.so-start" was used, the real /proc/self/exe points to
ld.so and not to the binary itself. Again, SB2 maps that
to a symlink which points to the correct binary.
Other related things:
- all mapping modes use this feature now
- Lua <=> C interface version had to be incremented
- Lua mapping code <=> mapping rules version had to be incremented
Diffstat (limited to 'include')
-rw-r--r-- | include/sb2.h | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/include/sb2.h b/include/sb2.h index 32ad22f..955d624 100644 --- a/include/sb2.h +++ b/include/sb2.h @@ -39,24 +39,30 @@ struct lua_instance { * - added new functions sb.get_forced_mapmode() and sb.get_session_perm() * * Differences between "59,lta-2008-12-04" and "53,lta-2008-11-10" * - part of rule selection logic is now implemented in C. + * * Differences between "60,2008-12-07" and "59,lta-2008-12-04" + * - Added special handler for /proc => sb.procfs_mapping_request() was + * added to luaif.c (and mapping.lua needs it) + * - sbox_get_mapping_requirements() now returns four values * * NOTE: the corresponding identifier for Lua is in lua_scripts/main.lua */ -#define SB2_LUA_C_INTERFACE_VERSION "59,lta-2008-12-04" +#define SB2_LUA_C_INTERFACE_VERSION "60,2008-12-07" -struct lua_instance *get_lua(void); +extern struct lua_instance *get_lua(void); #if 0 -char *sb_decolonize_path(const char *path); +extern char *sb_decolonize_path(const char *path); #endif -int sb_next_execve(const char *filename, char *const argv [], +extern int sb_next_execve(const char *filename, char *const argv [], char *const envp[]); -int do_exec(const char *exec_fn_name, const char *file, +extern int do_exec(const char *exec_fn_name, const char *file, char *const *argv, char *const *envp); -time_t get_sb2_timestamp(void); +extern time_t get_sb2_timestamp(void); + +extern char *procfs_mapping_request(char *path); /* ------ debug/trace logging system for sb2: */ #define SB_LOGLEVEL_uninitialized (-1) @@ -100,6 +106,7 @@ extern char *sbox_orig_ld_preload; extern char *sbox_orig_ld_library_path; extern char *sbox_binary_name; extern char *sbox_real_binary_name; +extern char *sbox_orig_binary_name; extern int pthread_library_is_available; /* flag */ extern pthread_t (*pthread_self_fnptr)(void); |