summaryrefslogtreecommitdiff
path: root/preload/sb_exec.c
AgeCommit message (Collapse)AuthorFilesLines
2008-01-31Logging enhancements: show changes made to argv+envpLauri Aarnio1-0/+54
- level "debug": shows if argv and/or envp has been changed - level "noise": as above + logs all components of modified string vectors. - added SB_LOG_IS_ACTIVE(level) macro for testing if logging has been enabled
2008-01-31Introduced R/O mapping mode.Lauri Aarnio1-2/+4
It is now possible to add "readonly = true" to any mapping rule, and the generated interface will then return an error code for any function which is trying to modify the filesystem: The interface functions do not call the real functions at all in this case, instead they will return an error code (typically -1 for system calls, NULL for fopen() etc). Also, errno will been set to appropriate value, typically to EROFS. Other modifications: - Added wrappers for fhchmod() [all platforms], and chflags(), getattrlist(), and setattrlist [Mac OS X - untested!] - Modified many of the wrapper specifications in interface.master (hopefully found all functions that may modify the filesystem :-) - Added new logging level "NOTICE", used for logging interface-generated "read only errors" - sb2-show now displays if the target has been marked "readonly" by the rules - sb2-logz knows about "notice" messages - added two new modifiers to gen-interface.pl (without these this R/O-thing would not be possible at all) - some minor code cleanups
2008-01-18Introduce SB1 bug emulation modeLauri Aarnio1-9/+40
- new option "-Q BUGLIST" to sb2 (ex. sb2 -Q x) - currently this can emulate: x: scratchbox1 didn't check X-permission of files correctly,
2008-01-11replace iswhitespace() with standard isspace()Lauri Leukkunen1-14/+5
stop the madness! Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2008-01-11Implement arguments for CPUTRANSPARENCY_METHODLauri Leukkunen1-12/+100
Simply edit your target.config: export SBOX_CPUTRANSPARENCY_METHOD="/home/lleukkun/scratchbox2/bin/qemu-arm -s 512" Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2008-01-11Introduce sb2-show, cleanup some warningsLauri Leukkunen1-32/+91
sb2-show allows you to inspect how path/argv/envp mangling would be done for a given binary. Patch by lauri.t.aarnio@nokia.com, somewhat cleaned up by lle@rahina.org. Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2008-01-03Added log post-processing tool and improved logging messages.Lauri Aarnio1-3/+7
- added sb2logz, which extracts information from logs and produces summaries - general: log format changed (each line now contains log level, too) - *.c: log messages which are needed by sb2logz are now at INFO level - interface.master & libsb2.c: Added gates to _exit() and _Exit(), so that exit status can be logged - sb_exec.c: bugfix: sb_execve_mod() returns nonzero if error, not zero - sb2: location of log files changed: logs now go to ~/sb2_logs/, and initial environment is printed to the log file
2007-12-19Add IA64 and powerpc host supportRiku Voipio1-3/+10
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2007-12-14Try to get ld_so_run_app() workingLauri Leukkunen1-4/+4
Still bombs out randomly for no apparent reason. Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-12-14Code cleanupLauri Leukkunen1-5/+5
Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-12-14Endianness check code updateLauri Leukkunen1-50/+81
* Adds endian string suffix checking (sh4eb now ok). * Adds code to check endian in the elf header. * Makes sure host binary really is a host binary - prevents executing sh4eb as host on sh4 target. Patch by Magnus Damm <magnus.damm@gmail.com> Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-12-13Re-introduce tool distro supportLauri Leukkunen1-11/+134
This allows controlling build environment independently of the host. Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-12-11Restore run_cputransparency() execution detailsLauri Leukkunen1-6/+4
The unmapped file needs to be given at least to qemu to ensure correct behaviour. Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-12-11Do path mapping for the file to be exec'edLauri Leukkunen1-10/+23
run_hashbang() calls do_exec() again to handle the interpreter execution. Seems to work after superficial testing. Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-12-11Improve exec*() handlingLauri Leukkunen1-117/+122
Cleans the sequence by pushing hashbang detection further down the pipeline, improves code structure and hopefully fixes some breakage. Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-12-10Generic execve() manglingLauri Leukkunen1-46/+40
sb_gcc_wrapper functionality is now implemented directly in libsb2.so as a lua script directly managing the execve(file, argv, envp) call. Same functionality can be used to do other things as well, see for the dpkg-architecture example in lua_scripts/argvenvp.lua Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-12-07SH4 is little endianLauri Leukkunen1-1/+1
by Magnus Damm <magnus.damm@gmail.com> Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-12-02Flesh out the argv/envp processingLauri Leukkunen1-17/+22
For now this is just a pass-through, doesn't do anything, but from here it's just a matter of building up the lua scripts. Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-11-20Fix compilation on linuxLauri Leukkunen1-2/+0
Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-11-19Incomplete OS X supportLauri Leukkunen1-1/+2
Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-11-19Restructure lua infraLauri Leukkunen1-1/+0
Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-10-30Handle cross-endianess check in a more sensible wayLauri Leukkunen1-40/+29
Patch from Magnus Damm <magnus.damm@gmail.com> Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-10-30Fixed permission checking in exec* (and refactored "lower layers" of exec*)Lauri Aarnio1-3/+6
libsb2.c: - Fixed a permission checking bug: It used to require that a file can opened (has R permission). On the other hand, it didn't check at all that the file had execution permission set. The result was that scripts could be executed even when x-bit was not set, and nothing could be executed without having r-bit set. This was fixed by first calling access() before doing anything else with the executable, and also allowing files with permissions like --x--x--x to be executed (but those must be executed on the host, as binary type can not be checked without opening the file). - all logging calls in exec functions now print the correct name of the original interface function - removed three clones that collected argv[] for varargs-based exec variants; replaced those with a subroutine interface.master: - added a modifier to access(), so that we'll get a "_nomap_nolog" version, too sb_exec.c: - includes libsb2.h and generated .h file - inspect_binary now uses open_nomap_nolog() to open the file instead of open() (the path has already been mapped there) - added a parameter to do_exec() (name of the calling function, since there are six different variants of exec)
2007-10-30Warning message typo fixTimo Savola1-1/+1
2007-10-30Strip libsb2 from LD_PRELOAD when using sbrshTimo Savola1-0/+22
2007-10-30Do not warn about running sbrsh within home directoryTimo Savola1-3/+16
2007-10-30Do not touch LD_PRELOAD when running sbrshTimo Savola1-10/+0
2007-10-30Some sbrsh supportTimo Savola1-9/+63
Fakeroot and LD_PRELOAD in general not handled properly. No configuration helpers yet.
2007-10-18Add support for sh target architectureLauri Leukkunen1-0/+8
Based on patch by Magnus Damm <magnus.damm@gmail.com> Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-10-01Rename couple of logging functions, coding style, cleanupsLauri Leukkunen1-2/+2
sb_log_init_logging is now sblog_init sb_call_open_without_logging is now sb_open_nolog Removes DBGOUT() macro, the new SB_LOG(level, msg...) should be used instead. Small coding style issues, mainly with if() -> if () and while() -> while (). Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-10-01Replaced logging system.Lauri Aarnio1-0/+14
2007-09-26Fixed minor bugs in the preload library, improved debug messages in main.luaLauri Aarnio1-2/+2
2007-09-06Code formatting cleanupsLauri Leukkunen1-9/+19
Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-09-05Mixed host/target endianess supportLauri Leukkunen1-0/+48
Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-09-05Remove all direct syscall() usageLauri Leukkunen1-2/+1
This should ease porting to non-linux hosts quite a bit. Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-09-04Fix completely broken string handling in inspect_binary()Lauri Leukkunen1-2/+0
Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-08-28Try to do the right thing for ppc and mipsLauri Leukkunen1-0/+8
Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-08-21Fix hashbang support in execve() and do_exec()Lauri Leukkunen1-29/+3
Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-08-20Fix busybox-like symlink and argv[0] usage with qemuLauri Leukkunen1-9/+17
This change passes the unmapped executable to qemu and relies on qemu open()ing it, correct mapping will take place at that time instead of the normal execve(). Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-08-19Multilib supportLauri Leukkunen1-61/+15
Enables use of 32bit binaries on a 64bit host. Works just fine the other way around as well. Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-07-25Remove unused env manipulation functionsLauri Leukkunen1-2/+0
Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-07-25Cruft removal and clean up some warningsLauri Leukkunen1-294/+8
Removes obsolete/unused sb1 leftovers from sb_exec.c Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-07-24Do not link to the host libraries.Felipe Contreras1-6/+0
2007-07-23Improve LD_PRELOAD passing to childrenLauri Leukkunen1-22/+29
Now it's passed even if the new process env pointer doesn't have it, but only if it's set for ourselves. This makes target processes starting new target processes work. Which is good. Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-07-02Run qemu so that we do all path mappings, qemu'sLauri Leukkunen1-1/+1
path mangling is simply not going to do the right thing. Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-05-22Add support for qemu's -drop-ld-preloadLauri Leukkunen1-1/+2
This feature is not in qemu's CVS yet, patches are available from http://freedesktop.org/Software/sbox2 Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-04-22Report cpu-transp name instead of binary nameLauri Leukkunen1-2/+8
This helps to implement proper mappings for the target binaries. Signed-off-by: Lauri Leukkunen <lle@rahina.org>
2007-01-30fix x86_64 supportLauri Leukkunen1-1/+1
2007-01-14* update copyrights and add license informationLauri Leukkunen1-0/+6
2007-01-10* remove argv[] mapping hack remainsLauri Leukkunen1-8/+1