]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/qemu-4.1.0-build-fix-glibc-2.31.patch
suricata: Change midstream policy to "pass-flow"
[ipfire-2.x.git] / src / patches / qemu-4.1.0-build-fix-glibc-2.31.patch
1 From 0f1f2d4596aee037d3ccbcf10592466daa54107f Mon Sep 17 00:00:00 2001
2 From: Laurent Vivier <laurent@vivier.eu>
3 Date: Tue, 12 Nov 2019 15:25:56 +0100
4 Subject: [PATCH] linux-user: remove host stime() syscall
5
6 stime() has been withdrawn from glibc
7 (12cbde1dae6f "Use clock_settime to implement stime; withdraw stime.")
8
9 Implement the target stime() syscall using host
10 clock_settime(CLOCK_REALTIME, ...) as it is done internally in glibc.
11
12 Tested qemu-ppc/x86_64 with:
13
14 #include <time.h>
15 #include <stdio.h>
16
17 int main(void)
18 {
19 time_t t;
20 int ret;
21
22 /* date -u -d"2019-11-12T15:11:00" "+%s" */
23 t = 1573571460;
24 ret = stime(&t);
25 printf("ret %d\n", ret);
26 return 0;
27 }
28
29 # date; ./stime; date
30 Tue Nov 12 14:18:32 UTC 2019
31 ret 0
32 Tue Nov 12 15:11:00 UTC 2019
33
34 Buglink: https://bugs.launchpad.net/qemu/+bug/1852115
35 Reported-by: Cole Robinson <crobinso@redhat.com>
36 Signed-off-by: Laurent Vivier <laurent@vivier.eu>
37 Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
38 Message-Id: <20191112142556.6335-1-laurent@vivier.eu>
39 ---
40 linux-user/syscall.c | 8 +++++---
41 1 file changed, 5 insertions(+), 3 deletions(-)
42
43 diff --git a/linux-user/syscall.c b/linux-user/syscall.c
44 index 4e97bcf..ce399a5 100644
45 --- a/linux-user/syscall.c
46 +++ b/linux-user/syscall.c
47 @@ -7764,10 +7764,12 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
48 #ifdef TARGET_NR_stime /* not on alpha */
49 case TARGET_NR_stime:
50 {
51 - time_t host_time;
52 - if (get_user_sal(host_time, arg1))
53 + struct timespec ts;
54 + ts.tv_nsec = 0;
55 + if (get_user_sal(ts.tv_sec, arg1)) {
56 return -TARGET_EFAULT;
57 - return get_errno(stime(&host_time));
58 + }
59 + return get_errno(clock_settime(CLOCK_REALTIME, &ts));
60 }
61 #endif
62 #ifdef TARGET_NR_alarm /* not on alpha */
63 --
64 1.8.3.1
65