qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/2] Linux user for 4.2 patches
@ 2019-11-12 16:16 Laurent Vivier
  2019-11-12 16:16 ` [PULL 1/2] linux-user: fix missing break Laurent Vivier
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Laurent Vivier @ 2019-11-12 16:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, Laurent Vivier

The following changes since commit 2a7e7c3e103a5c29af7c583390c243d85a2527e8:

  Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-and-tcg-121119-1' into staging (2019-11-12 14:51:00 +0000)

are available in the Git repository at:

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

for you to fetch changes up to 0f1f2d4596aee037d3ccbcf10592466daa54107f:

  linux-user: remove host stime() syscall (2019-11-12 17:05:57 +0100)

----------------------------------------------------------------
Fix CID 1407221 and stime()

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

Laurent Vivier (2):
  linux-user: fix missing break
  linux-user: remove host stime() syscall

 linux-user/syscall.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

-- 
2.21.0



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

* [PULL 1/2] linux-user: fix missing break
  2019-11-12 16:16 [PULL 0/2] Linux user for 4.2 patches Laurent Vivier
@ 2019-11-12 16:16 ` Laurent Vivier
  2019-11-12 16:16 ` [PULL 2/2] linux-user: remove host stime() syscall Laurent Vivier
  2019-11-12 18:39 ` [PULL 0/2] Linux user for 4.2 patches Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Laurent Vivier @ 2019-11-12 16:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: Josh Kunz, Riku Voipio, Philippe Mathieu-Daudé, Laurent Vivier

Reported by Coverity (CID 1407221)
Fixes: a2d866827bd8 ("linux-user: Support for NETLINK socket options")
cc: Josh Kunz <jkz@google.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191112105055.32269-1-laurent@vivier.eu>
---
 linux-user/syscall.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ab9d933e53af..4e97bcf1e5a9 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2632,6 +2632,7 @@ static abi_long do_getsockopt(int sockfd, int level, int optname,
         default:
             goto unimplemented;
         }
+        break;
 #endif /* SOL_NETLINK */
     default:
     unimplemented:
-- 
2.21.0



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

* [PULL 2/2] linux-user: remove host stime() syscall
  2019-11-12 16:16 [PULL 0/2] Linux user for 4.2 patches Laurent Vivier
  2019-11-12 16:16 ` [PULL 1/2] linux-user: fix missing break Laurent Vivier
@ 2019-11-12 16:16 ` Laurent Vivier
  2019-11-12 18:39 ` [PULL 0/2] Linux user for 4.2 patches Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Laurent Vivier @ 2019-11-12 16:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Riku Voipio, Laurent Vivier, Cole Robinson

stime() has been withdrawn from glibc
(12cbde1dae6f "Use clock_settime to implement stime; withdraw stime.")

Implement the target stime() syscall using host
clock_settime(CLOCK_REALTIME, ...) as it is done internally in glibc.

Tested qemu-ppc/x86_64 with:

	#include <time.h>
	#include <stdio.h>

	int main(void)
	{
		time_t t;
		int ret;

		/* date -u -d"2019-11-12T15:11:00" "+%s" */
		t = 1573571460;
		ret = stime(&t);
		printf("ret %d\n", ret);
		return 0;
	}

        # date; ./stime; date
        Tue Nov 12 14:18:32 UTC 2019
        ret 0
        Tue Nov 12 15:11:00 UTC 2019

Buglink: https://bugs.launchpad.net/qemu/+bug/1852115
Reported-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20191112142556.6335-1-laurent@vivier.eu>
---
 linux-user/syscall.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 4e97bcf1e5a9..ce399a55f0db 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -7764,10 +7764,12 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
 #ifdef TARGET_NR_stime /* not on alpha */
     case TARGET_NR_stime:
         {
-            time_t host_time;
-            if (get_user_sal(host_time, arg1))
+            struct timespec ts;
+            ts.tv_nsec = 0;
+            if (get_user_sal(ts.tv_sec, arg1)) {
                 return -TARGET_EFAULT;
-            return get_errno(stime(&host_time));
+            }
+            return get_errno(clock_settime(CLOCK_REALTIME, &ts));
         }
 #endif
 #ifdef TARGET_NR_alarm /* not on alpha */
-- 
2.21.0



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

* Re: [PULL 0/2] Linux user for 4.2 patches
  2019-11-12 16:16 [PULL 0/2] Linux user for 4.2 patches Laurent Vivier
  2019-11-12 16:16 ` [PULL 1/2] linux-user: fix missing break Laurent Vivier
  2019-11-12 16:16 ` [PULL 2/2] linux-user: remove host stime() syscall Laurent Vivier
@ 2019-11-12 18:39 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2019-11-12 18:39 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: Riku Voipio, QEMU Developers

On Tue, 12 Nov 2019 at 16:18, Laurent Vivier <laurent@vivier.eu> wrote:
>
> The following changes since commit 2a7e7c3e103a5c29af7c583390c243d85a2527e8:
>
>   Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-and-tcg-121119-1' into staging (2019-11-12 14:51:00 +0000)
>
> are available in the Git repository at:
>
>   git://github.com/vivier/qemu.git tags/linux-user-for-4.2-pull-request
>
> for you to fetch changes up to 0f1f2d4596aee037d3ccbcf10592466daa54107f:
>
>   linux-user: remove host stime() syscall (2019-11-12 17:05:57 +0100)
>
> ----------------------------------------------------------------
> Fix CID 1407221 and stime()
>
> ----------------------------------------------------------------
>
> Laurent Vivier (2):
>   linux-user: fix missing break
>   linux-user: remove host stime() syscall
>


Applied, thanks.

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

-- PMM


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

end of thread, other threads:[~2019-11-12 18:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-12 16:16 [PULL 0/2] Linux user for 4.2 patches Laurent Vivier
2019-11-12 16:16 ` [PULL 1/2] linux-user: fix missing break Laurent Vivier
2019-11-12 16:16 ` [PULL 2/2] linux-user: remove host stime() syscall Laurent Vivier
2019-11-12 18:39 ` [PULL 0/2] Linux user for 4.2 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).