linux-user: Support prctl PR_GET/SET_NAME
cover linux-user: Support prctl PR_GET/SET_NAME
These patches add support for the prctl options PR_GET_NAME and PR_SET_NAME. In particular, perl 5.14 will use PR_SET_NAME if you change the value of $0, which means that adduser will fail if run under qemu with a sufficiently modern perl.
Patch one is just indentation cleanup, the meat is patch 2.
The only other prctl options which take pointer arguments are all architecture specific, so there didn't seem much point in adding them (they all work like PR_GET_PDEATHSIG in that they pass an int* to be filled in); we'd have to actually emulate them if we cared about them.
Peter Maydell (2):
linux-user/syscall.c: Fix indentation in prctl handling
linux-user: Add support for prctl PR_GET_NAME and PR_SET_NAME
linux-user/syscall.c | 53 ++++++++++++++++++++++++++++++++++++------------- 1 files changed, 39 insertions(+), 14 deletions(-)
PATCH 1/2 linux-user/syscall.c: Fix indentation in prctl handling
Clean up the odd indentation of this switch statement before we double its size by adding new cases to it.
--- linux-user/syscall.c | 29 +++++++++++++++-------------- 1 files changed, 15 insertions(+), 14 deletions(-)
linux-user/syscall.c +15 -14
@@ -6842,21 +6842,22 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, goto unimplemented;#endif case TARGET_NR_prctl: -switch (arg1) - { -case PR_GET_PDEATHSIG : - { -int deathsig; - ret =get_errno (prctl (arg1, &deathsig, arg3, arg4, arg5)); -if (!is_error (ret) && arg2 - &&put_user_ual (deathsig, arg2)) - goto efault; - } -break ; -default : - ret =get_errno (prctl (arg1, arg2, arg3, arg4, arg5)); -break ; +switch (arg1) { +case PR_GET_PDEATHSIG : + { +int deathsig; + ret =get_errno (prctl (arg1, &deathsig, arg3, arg4, arg5)); +if (!is_error (ret) && arg2 + &&put_user_ual (deathsig, arg2)) { + goto efault; } +break ; + } +default : +/* Most prctl options have no pointer arguments */ + ret =get_errno (prctl (arg1, arg2, arg3, arg4, arg5)); +break ; + }break ;#ifdef TARGET_NR_arch_prctlcase TARGET_NR_arch_prctl:
Signature · 1 line
1.7.1
PATCH 2/2 linux-user: Add support for prctl PR_GET_NAME and PR_SET_NAME
In reply to Peter MaydellAdd support for the prctl options PR_GET_NAME and PR_SET_NAME, which take or return a name in a 16 byte buffer pointed to by arg2.
--- linux-user/syscall.c | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-)
linux-user/syscall.c +24 -0
@@ -6853,6 +6853,30 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, }break ; } +#ifdef PR_GET_NAME +case PR_GET_NAME : + { +void *name =lock_user (VERIFY_WRITE , arg2,16 ,1 ); +if (!name) { + goto efault; + } + ret =get_errno (prctl (arg1, (unsigned long )name, + arg3, arg4, arg5)); +unlock_user (name, arg2,16 ); +break ; + } +case PR_SET_NAME : + { +void *name =lock_user (VERIFY_READ , arg2,16 ,1 ); +if (!name) { + goto efault; + } + ret =get_errno (prctl (arg1, (unsigned long )name, + arg3, arg4, arg5)); +unlock_user (name, arg2,0 ); +break ; + } +#endif default :/* Most prctl options have no pointer arguments */ ret =get_errno (prctl (arg1, arg2, arg3, arg4, arg5));
Signature · 1 line
1.7.1
Ping?
Quoted 21 lines · Peter Maydell
These patches add support for the prctl options
PR_GET_NAMEandPR_SET_NAME. In particular, perl 5.14 will usePR_SET_NAMEif you change the value of $0, which means that adduser will fail if run under qemu with a sufficiently modern perl.Patch one is just indentation cleanup, the meat is patch 2.
The only other prctl options which take pointer arguments are all architecture specific, so there didn't seem much point in adding them (they all work like
PR_GET_PDEATHSIGin that they pass an int* to be filled in); we'd have to actually emulate them if we cared about them.Peter Maydell (2):
linux-user/syscall.c: Fix indentation in prctl handling
linux-user: Add support for prctlPR_GET_NAMEandPR_SET_NAMElinux-user/syscall.c | 53 ++++++++++++++++++++++++++++++++++++-------------
1 files changed, 39 insertions(+), 14 deletions(-)
Hector Oron
Tested-byHello,
2012/2/22 Peter Maydell <[email protected]>:
Quoted 1 line
Ping?
In case it helps, I have successfully tested this patch running adduser on Debian armhf target emulated via qemu-arm-static.
Quoted 23 lines · Peter Maydell
Quoted 21 lines
These patches add support for the prctl options
PR_GET_NAMEandPR_SET_NAME. In particular, perl 5.14 will usePR_SET_NAMEif you change the value of $0, which means that adduser will fail if run under qemu with a sufficiently modern perl.Patch one is just indentation cleanup, the meat is patch 2.
The only other prctl options which take pointer arguments are all architecture specific, so there didn't seem much point in adding them (they all work like
PR_GET_PDEATHSIGin that they pass an int* to be filled in); we'd have to actually emulate them if we cared about them.Peter Maydell (2):
linux-user/syscall.c: Fix indentation in prctl handling
linux-user: Add support for prctlPR_GET_NAMEandPR_SET_NAMElinux-user/syscall.c | 53 ++++++++++++++++++++++++++++++++++++-------------
1 files changed, 39 insertions(+), 14 deletions(-)
Signature · 1 line
Héctor Orón -.. . -... .. .- -. -.. . ...- . .-.. --- .--. . .-.
Ping^2 ?
-- PMM
Quoted 24 lines · Peter Maydell
Ping?
Quoted 21 lines · Peter Maydell
These patches add support for the prctl options
PR_GET_NAMEandPR_SET_NAME. In particular, perl 5.14 will usePR_SET_NAMEif you change the value of $0, which means that adduser will fail if run under qemu with a sufficiently modern perl.Patch one is just indentation cleanup, the meat is patch 2.
The only other prctl options which take pointer arguments are all architecture specific, so there didn't seem much point in adding them (they all work like
PR_GET_PDEATHSIGin that they pass an int* to be filled in); we'd have to actually emulate them if we cared about them.Peter Maydell (2):
linux-user/syscall.c: Fix indentation in prctl handling
linux-user: Add support for prctlPR_GET_NAMEandPR_SET_NAMElinux-user/syscall.c | 53 ++++++++++++++++++++++++++++++++++++-------------
1 files changed, 39 insertions(+), 14 deletions(-)
Signature · 2 lines
12345678901234567890123456789012345678901234567890123456789012345678901234567890 1 2 3 4 5 6 7 8
Ping^3 (past the six-week mark now...)
-- PMM
Quoted 30 lines · Peter Maydell
Ping^2 ?
-- PMM
Quoted 24 lines · Peter Maydell
Ping?
Quoted 21 lines · Peter Maydell
These patches add support for the prctl options
PR_GET_NAMEandPR_SET_NAME. In particular, perl 5.14 will usePR_SET_NAMEif you change the value of $0, which means that adduser will fail if run under qemu with a sufficiently modern perl.Patch one is just indentation cleanup, the meat is patch 2.
The only other prctl options which take pointer arguments are all architecture specific, so there didn't seem much point in adding them (they all work like
PR_GET_PDEATHSIGin that they pass an int* to be filled in); we'd have to actually emulate them if we cared about them.Peter Maydell (2):
linux-user/syscall.c: Fix indentation in prctl handling
linux-user: Add support for prctlPR_GET_NAMEandPR_SET_NAMElinux-user/syscall.c | 53 ++++++++++++++++++++++++++++++++++++-------------
1 files changed, 39 insertions(+), 14 deletions(-)
Hi,
looks like I'll be busy for the rest of the of the month :/
Riku
Quoted 35 lines · Peter Maydell
Ping^3 (past the six-week mark now...)
-- PMM
Quoted 30 lines · Peter Maydell
Ping^2 ?
-- PMM
Quoted 24 lines · Peter Maydell
Ping?
Quoted 21 lines · Peter Maydell
These patches add support for the prctl options
PR_GET_NAMEandPR_SET_NAME. In particular, perl 5.14 will usePR_SET_NAMEif you change the value of $0, which means that adduser will fail if run under qemu with a sufficiently modern perl.Patch one is just indentation cleanup, the meat is patch 2.
The only other prctl options which take pointer arguments are all architecture specific, so there didn't seem much point in adding them (they all work like
PR_GET_PDEATHSIGin that they pass an int* to be filled in); we'd have to actually emulate them if we cared about them.Peter Maydell (2):
linux-user/syscall.c: Fix indentation in prctl handling
linux-user: Add support for prctlPR_GET_NAMEandPR_SET_NAMElinux-user/syscall.c | 53 ++++++++++++++++++++++++++++++++++++-------------
1 files changed, 39 insertions(+), 14 deletions(-)