qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] linux-user: Support prctl PR_GET/SET_NAME
@ 2012-02-03 13:53 Peter Maydell
  2012-02-03 13:53 ` [Qemu-devel] [PATCH 1/2] linux-user/syscall.c: Fix indentation in prctl handling Peter Maydell
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Peter Maydell @ 2012-02-03 13:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, patches

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(-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 1/2] linux-user/syscall.c: Fix indentation in prctl handling
  2012-02-03 13:53 [Qemu-devel] [PATCH 0/2] linux-user: Support prctl PR_GET/SET_NAME Peter Maydell
@ 2012-02-03 13:53 ` Peter Maydell
  2012-02-03 13:53 ` [Qemu-devel] [PATCH 2/2] linux-user: Add support for prctl PR_GET_NAME and PR_SET_NAME Peter Maydell
  2012-02-22 22:55 ` [Qemu-devel] [PATCH 0/2] linux-user: Support prctl PR_GET/SET_NAME Peter Maydell
  2 siblings, 0 replies; 8+ messages in thread
From: Peter Maydell @ 2012-02-03 13:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, patches

Clean up the odd indentation of this switch statement before
we double its size by adding new cases to it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/syscall.c |   29 +++++++++++++++--------------
 1 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 2bf9e7e..7851fb5 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -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_prctl
     case TARGET_NR_arch_prctl:
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 2/2] linux-user: Add support for prctl PR_GET_NAME and PR_SET_NAME
  2012-02-03 13:53 [Qemu-devel] [PATCH 0/2] linux-user: Support prctl PR_GET/SET_NAME Peter Maydell
  2012-02-03 13:53 ` [Qemu-devel] [PATCH 1/2] linux-user/syscall.c: Fix indentation in prctl handling Peter Maydell
@ 2012-02-03 13:53 ` Peter Maydell
  2012-02-22 22:55 ` [Qemu-devel] [PATCH 0/2] linux-user: Support prctl PR_GET/SET_NAME Peter Maydell
  2 siblings, 0 replies; 8+ messages in thread
From: Peter Maydell @ 2012-02-03 13:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, patches

Add 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.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/syscall.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 7851fb5..489a8c2 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -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));
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] linux-user: Support prctl PR_GET/SET_NAME
  2012-02-03 13:53 [Qemu-devel] [PATCH 0/2] linux-user: Support prctl PR_GET/SET_NAME Peter Maydell
  2012-02-03 13:53 ` [Qemu-devel] [PATCH 1/2] linux-user/syscall.c: Fix indentation in prctl handling Peter Maydell
  2012-02-03 13:53 ` [Qemu-devel] [PATCH 2/2] linux-user: Add support for prctl PR_GET_NAME and PR_SET_NAME Peter Maydell
@ 2012-02-22 22:55 ` Peter Maydell
  2012-03-02 21:18   ` Hector Oron
  2012-03-08 14:20   ` Peter Maydell
  2 siblings, 2 replies; 8+ messages in thread
From: Peter Maydell @ 2012-02-22 22:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, patches

Ping?

On 3 February 2012 13:53, Peter Maydell <peter.maydell@linaro.org> wrote:
> 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(-)
>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] linux-user: Support prctl PR_GET/SET_NAME
  2012-02-22 22:55 ` [Qemu-devel] [PATCH 0/2] linux-user: Support prctl PR_GET/SET_NAME Peter Maydell
@ 2012-03-02 21:18   ` Hector Oron
  2012-03-08 14:20   ` Peter Maydell
  1 sibling, 0 replies; 8+ messages in thread
From: Hector Oron @ 2012-03-02 21:18 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Riku Voipio, qemu-devel, patches

Hello,

2012/2/22 Peter Maydell <peter.maydell@linaro.org>:
> Ping?

In case it helps, I have successfully tested this patch running
adduser on Debian armhf target emulated via qemu-arm-static.

Tested-by: Hector Oron <zumbi@debian.org>

> On 3 February 2012 13:53, Peter Maydell <peter.maydell@linaro.org> wrote:
>> 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(-)
>>
>>
>



-- 
 Héctor Orón  -.. . -... .. .- -.   -.. . ...- . .-.. --- .--. . .-.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] linux-user: Support prctl PR_GET/SET_NAME
  2012-02-22 22:55 ` [Qemu-devel] [PATCH 0/2] linux-user: Support prctl PR_GET/SET_NAME Peter Maydell
  2012-03-02 21:18   ` Hector Oron
@ 2012-03-08 14:20   ` Peter Maydell
  2012-03-20 11:47     ` Peter Maydell
  1 sibling, 1 reply; 8+ messages in thread
From: Peter Maydell @ 2012-03-08 14:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, patches

Ping^2 ?

-- PMM

On 22 February 2012 22:55, Peter Maydell <peter.maydell@linaro.org> wrote:
> Ping?
>
> On 3 February 2012 13:53, Peter Maydell <peter.maydell@linaro.org> wrote:
>> 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(-)
>>
>>



-- 
12345678901234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6         7         8

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] linux-user: Support prctl PR_GET/SET_NAME
  2012-03-08 14:20   ` Peter Maydell
@ 2012-03-20 11:47     ` Peter Maydell
  2012-03-21 15:12       ` Riku Voipio
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Maydell @ 2012-03-20 11:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, patches

Ping^3 (past the six-week mark now...)

-- PMM

On 8 March 2012 14:20, Peter Maydell <peter.maydell@linaro.org> wrote:
> Ping^2 ?
>
> -- PMM
>
> On 22 February 2012 22:55, Peter Maydell <peter.maydell@linaro.org> wrote:
>> Ping?
>>
>> On 3 February 2012 13:53, Peter Maydell <peter.maydell@linaro.org> wrote:
>>> 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(-)
>>>
>>>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] linux-user: Support prctl PR_GET/SET_NAME
  2012-03-20 11:47     ` Peter Maydell
@ 2012-03-21 15:12       ` Riku Voipio
  0 siblings, 0 replies; 8+ messages in thread
From: Riku Voipio @ 2012-03-21 15:12 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel

Hi,

looks like I'll be busy for the rest of the of the month :/

Riku

On Tue, Mar 20, 2012 at 11:47:01AM +0000, Peter Maydell wrote:
> Ping^3 (past the six-week mark now...)
> 
> -- PMM
> 
> On 8 March 2012 14:20, Peter Maydell <peter.maydell@linaro.org> wrote:
> > Ping^2 ?
> >
> > -- PMM
> >
> > On 22 February 2012 22:55, Peter Maydell <peter.maydell@linaro.org> wrote:
> >> Ping?
> >>
> >> On 3 February 2012 13:53, Peter Maydell <peter.maydell@linaro.org> wrote:
> >>> 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(-)
> >>>
> >>>
> >

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-03-21 15:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-03 13:53 [Qemu-devel] [PATCH 0/2] linux-user: Support prctl PR_GET/SET_NAME Peter Maydell
2012-02-03 13:53 ` [Qemu-devel] [PATCH 1/2] linux-user/syscall.c: Fix indentation in prctl handling Peter Maydell
2012-02-03 13:53 ` [Qemu-devel] [PATCH 2/2] linux-user: Add support for prctl PR_GET_NAME and PR_SET_NAME Peter Maydell
2012-02-22 22:55 ` [Qemu-devel] [PATCH 0/2] linux-user: Support prctl PR_GET/SET_NAME Peter Maydell
2012-03-02 21:18   ` Hector Oron
2012-03-08 14:20   ` Peter Maydell
2012-03-20 11:47     ` Peter Maydell
2012-03-21 15:12       ` Riku Voipio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).