qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/2] Linux user for 6.0 patches
@ 2021-03-28 16:06 Laurent Vivier
  2021-03-28 16:06 ` [PULL 1/2] linux-user/s390x: Use the guest pointer for the sigreturn stub Laurent Vivier
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Laurent Vivier @ 2021-03-28 16:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: Laurent Vivier

The following changes since commit 9e2e9fe3df9f539f8b6941ceb96d25355fdae47e:

  Update version for v6.0.0-rc0 release (2021-03-24 19:50:49 +0000)

are available in the Git repository at:

  git://github.com/vivier/qemu.git tags/linux-user-for-6.0-pull-request

for you to fetch changes up to 4a1e6bce2308b720d79d5ea0a3d24501c89bd80c:

  linux-user: allow NULL msg in recvfrom (2021-03-27 16:48:45 +0100)

----------------------------------------------------------------
linux-user pull request 20210328

- Fix recvfrom with NULL msg
- Fix sigreturn address on s390x

----------------------------------------------------------------

Andreas Krebbel (1):
  linux-user/s390x: Use the guest pointer for the sigreturn stub

Zach Reizner (1):
  linux-user: allow NULL msg in recvfrom

 linux-user/s390x/signal.c |  5 +++--
 linux-user/syscall.c      | 11 ++++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)

-- 
2.30.2



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

* [PULL 1/2] linux-user/s390x: Use the guest pointer for the sigreturn stub
  2021-03-28 16:06 [PULL 0/2] Linux user for 6.0 patches Laurent Vivier
@ 2021-03-28 16:06 ` Laurent Vivier
  2021-03-28 16:06 ` [PULL 2/2] linux-user: allow NULL msg in recvfrom Laurent Vivier
  2021-03-29 11:19 ` [PULL 0/2] Linux user for 6.0 patches Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Laurent Vivier @ 2021-03-28 16:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, Laurent Vivier, Andreas Krebbel

From: Andreas Krebbel <krebbel@linux.ibm.com>

When setting up the pointer for the sigreturn stub in the return
address register (r14) we currently use the host frame address instead
of the guest frame address.

Note: This only caused problems if Qemu has been built with
--disable-pie (as it is in distros nowadays). Otherwise guest_base
defaults to 0 hiding the actual problem.

Signed-off-by: Andreas Krebbel <krebbel@linux.ibm.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210324185128.63971-1-krebbel@linux.ibm.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/s390x/signal.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c
index ecfa2a14a982..7107c5fb5335 100644
--- a/linux-user/s390x/signal.c
+++ b/linux-user/s390x/signal.c
@@ -211,9 +211,10 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
     /* Set up to return from userspace.  If provided, use a stub
        already in userspace.  */
     if (ka->sa_flags & TARGET_SA_RESTORER) {
-        env->regs[14] = (unsigned long) ka->sa_restorer | PSW_ADDR_AMODE;
+        env->regs[14] = ka->sa_restorer | PSW_ADDR_AMODE;
     } else {
-        env->regs[14] = (unsigned long) frame->retcode | PSW_ADDR_AMODE;
+        env->regs[14] = (frame_addr + offsetof(typeof(*frame), retcode))
+                        | PSW_ADDR_AMODE;
         __put_user(S390_SYSCALL_OPCODE | TARGET_NR_rt_sigreturn,
                    (uint16_t *)(frame->retcode));
     }
-- 
2.30.2



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

* [PULL 2/2] linux-user: allow NULL msg in recvfrom
  2021-03-28 16:06 [PULL 0/2] Linux user for 6.0 patches Laurent Vivier
  2021-03-28 16:06 ` [PULL 1/2] linux-user/s390x: Use the guest pointer for the sigreturn stub Laurent Vivier
@ 2021-03-28 16:06 ` Laurent Vivier
  2021-03-29 11:19 ` [PULL 0/2] Linux user for 6.0 patches Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Laurent Vivier @ 2021-03-28 16:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: Zach Reizner, Laurent Vivier

From: Zach Reizner <zachr@google.com>

The kernel allows a NULL msg in recvfrom so that he size of the next
message may be queried before allocating a correctly sized buffer. This
change allows the syscall translator to pass along the NULL msg pointer
instead of returning early with EFAULT.

Signed-off-by: Zach Reizner <zachr@google.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <CAFNex=DvFCq=AQf+=19fTfw-T8eZZT=3NnFFm2JMFvVr5QgQyA@mail.gmail.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/syscall.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 1e508576c73e..294779c86f4d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3679,9 +3679,14 @@ static abi_long do_recvfrom(int fd, abi_ulong msg, size_t len, int flags,
     void *host_msg;
     abi_long ret;
 
-    host_msg = lock_user(VERIFY_WRITE, msg, len, 0);
-    if (!host_msg)
-        return -TARGET_EFAULT;
+    if (!msg) {
+        host_msg = NULL;
+    } else {
+        host_msg = lock_user(VERIFY_WRITE, msg, len, 0);
+        if (!host_msg) {
+            return -TARGET_EFAULT;
+        }
+    }
     if (target_addr) {
         if (get_user_u32(addrlen, target_addrlen)) {
             ret = -TARGET_EFAULT;
-- 
2.30.2



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

* Re: [PULL 0/2] Linux user for 6.0 patches
  2021-03-28 16:06 [PULL 0/2] Linux user for 6.0 patches Laurent Vivier
  2021-03-28 16:06 ` [PULL 1/2] linux-user/s390x: Use the guest pointer for the sigreturn stub Laurent Vivier
  2021-03-28 16:06 ` [PULL 2/2] linux-user: allow NULL msg in recvfrom Laurent Vivier
@ 2021-03-29 11:19 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2021-03-29 11:19 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: QEMU Developers

On Sun, 28 Mar 2021 at 17:09, Laurent Vivier <laurent@vivier.eu> wrote:
>
> The following changes since commit 9e2e9fe3df9f539f8b6941ceb96d25355fdae47e:
>
>   Update version for v6.0.0-rc0 release (2021-03-24 19:50:49 +0000)
>
> are available in the Git repository at:
>
>   git://github.com/vivier/qemu.git tags/linux-user-for-6.0-pull-request
>
> for you to fetch changes up to 4a1e6bce2308b720d79d5ea0a3d24501c89bd80c:
>
>   linux-user: allow NULL msg in recvfrom (2021-03-27 16:48:45 +0100)
>
> ----------------------------------------------------------------
> linux-user pull request 20210328
>
> - Fix recvfrom with NULL msg
> - Fix sigreturn address on s390x
>
> ----------------------------------------------------------------


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/6.0
for any user-visible changes.

-- PMM


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

end of thread, other threads:[~2021-03-29 11:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-28 16:06 [PULL 0/2] Linux user for 6.0 patches Laurent Vivier
2021-03-28 16:06 ` [PULL 1/2] linux-user/s390x: Use the guest pointer for the sigreturn stub Laurent Vivier
2021-03-28 16:06 ` [PULL 2/2] linux-user: allow NULL msg in recvfrom Laurent Vivier
2021-03-29 11:19 ` [PULL 0/2] Linux user for 6.0 patches Peter Maydell

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