Add uselib syscall
PATCH 1/1 Add uselib syscall
Signed-off-by Riku Voipio <[email protected]>
--- linux-user/syscall.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)
linux-user/syscall.c +10 -1
@@ -282,6 +282,7 @@ extern int flock(int, int);extern int setfsuid (int );extern int setfsgid (int );extern int setgroups (int ,gid_t *); +extern int uselib (const char *);#define ERRNO_TABLE_SIZE 1200
@@ -4313,7 +4314,15 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,#endif #ifdef TARGET_NR_uselibcase TARGET_NR_uselib: - goto unimplemented; + { +if (!(p =lock_user_string (arg1))) { + ret = -TARGET_EFAULT ; + goto efault; + } + ret =get_errno (uselib (path (p))); +unlock_user (p, arg1,0 ); + } +break ;#endif #ifdef TARGET_NR_swaponcase TARGET_NR_swapon:
Signature · 5 lines
1.5.6.5 -- "rm -rf" only sounds scary if you don't have backups
Quoted 25 lines · Riku Voipio
Signed-off-by Riku Voipio <[email protected]>--- linux-user/syscall.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)linux-user/syscall.c +3
-1@@ -282,6 +282,7 @@ extern int flock(int, int);extern int setfsuid (int );extern int setfsgid (int );extern int setgroups (int ,gid_t *); +extern int uselib (const char *);#define ERRNO_TABLE_SIZE 1200@@ -4313,7 +4314,15 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,#endif #ifdef TARGET_NR_uselibcase TARGET_NR_uselib: - goto unimplemented; + { +if (!(p =lock_user_string (arg1))) {
linux-user/syscall.c abi_long do_syscall(void *cpu_env, int num, abi_long arg1, · line 4328
Quoted 10 lines
linux-user/syscall.c +7
-0+ ret = -TARGET_EFAULT ; + goto efault; + } + ret =get_errno (uselib (path (p))); +unlock_user (p, arg1,0 ); + } +break ;#endif #ifdef TARGET_NR_swaponcase TARGET_NR_swapon:
Looks good for me. Added to my patchset.
Quoted 8 lines
Signature · 5 lines
1.5.6.5 -- "rm -rf" only sounds scary if you don't have backups
Signature · 3 lines
Regards, Kirill A. Shutemov + Belarus, Minsk + ALT Linux Team, http://www.altlinux.com/
linux-user/syscall.c abi_long do_syscall(void *cpu_env, int num, abi_long arg1, · line 4325
Quoted 11 lines
case
TARGET_NR_uselib:linux-user/syscall.c +9
-1- goto unimplemented; + { +if (!(p =lock_user_string (arg1))) { + ret = -TARGET_EFAULT ; + goto efault; + } + ret =get_errno (uselib (path (p))); +unlock_user (p, arg1,0 ); + } +break ;
I'm pretty sure this is wrong. The last thing we want to be doing is loading a host library.
Paul