qemu: Replace stime() API with clock_settime
PATCH 1/1 qemu: Replace stime() API with clock_settime
From: Khem Raj <[email protected]>
--- meta/recipes-devtools/qemu/qemu.inc | 1 + ...linux-user-remove-host-stime-syscall.patch | 61 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patch
meta/recipes-devtools/qemu/qemu.inc +1 -0
@@ -27,6 +27,7 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \ file://0008-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch \ file://0009-Fix-webkitgtk-builds.patch \ file://0010-configure-Add-pkg-config-handling-for-libgcrypt.patch \ + file://0011-linux-user-remove-host-stime-syscall.patch \ file://CVE-2019-15890.patch \ file://CVE-2019-12068.patch \ file://CVE-2020-1711.patch \
meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patch new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
2.25.1
Why? glibc on zeus doesn't need it.
Quoted 94 lines · Martin Jansa
From: Khem Raj <[email protected]>
Signed-off-by Khem Raj <[email protected]>Signed-off-by Richard Purdie <[email protected]>--- meta/recipes-devtools/qemu/qemu.inc | 1 + ...linux-user-remove-host-stime-syscall.patch | 61 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patchmeta/recipes-devtools/qemu/qemu.inc +1
-0@@ -27,6 +27,7 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \ file://0008-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch \ file://0009-Fix-webkitgtk-builds.patch \ file://0010-configure-Add-pkg-config-handling-for-libgcrypt.patch \ + file://0011-linux-user-remove-host-stime-syscall.patch \ file://CVE-2019-15890.patch \ file://CVE-2019-12068.patch \ file://CVE-2020-1711.patch \meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patch new file +61
-0@@ -0,0 +1,61 @@ +From 0f1f2d4596aee037d3ccbcf10592466daa54107f Mon Sep 17 00:00:00 2001 +From: Laurent Vivier <[email protected]> +Date: Tue, 12 Nov 2019 15:25:56 +0100 +Subject: [PATCH] linux-user: remove host stime() syscall + +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 + +Upstream-Status: Backport [https://git.qemu.org/?p=qemu.git;a=commit;h=0f1f2d4596aee037d3ccbcf10592466daa54107f] +Buglink: https://bugs.launchpad.net/qemu/+bug/1852115 +Reported-by: Cole Robinson <[email protected]> +Signed-off-by: Laurent Vivier <[email protected]> +Reviewed-by: Peter Maydell <[email protected]> +Message-Id: <[email protected]> +--- + linux-user/syscall.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -7651,10 +7651,12 @@ static abi_long do_syscall1(void *cpu_en + #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 */Signature · 1 line
2.25.1
qemu-native in more recent host distributions needs it, because it uses glibc from host, not glibc from zeus (and it fails with uninative as well).
I'm seeing this issue with Ubuntu 20.04 and someone reported the same with Opensuse Tumbleweed in:
https://stackoverflow.com/questions/61367173/core-image-minimal-fails
Quoted 110 lines · Denys Dmytriyenko
Why? glibc on zeus doesn't need it.
Quoted 9 lines · Martin Jansa
From: Khem Raj <[email protected]>
Signed-off-by Khem Raj <[email protected]>Signed-off-by Richard Purdie <[email protected]>--- meta/recipes-devtools/qemu/qemu.inc | 1 + ...linux-user-remove-host-stime-syscall.patch | 61 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644
meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patchReview
Quoted 2 lines
(quoted diff) +0
-0b/meta/recipes-devtools/qemu/qemu.inc
meta/recipes-devtools/qemu/qemu.inc SRC_URI = "
Quoted 4 lines
index
f451017f6d..ad4ff52892100644meta/recipes-devtools/qemu/qemu.inc +0
-0@@ -27,6 +27,7 @@ SRC_URI = "Quoted 1 line
file://0008-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch \
Quoted 2 lines
file://0009-Fix-webkitgtk-builds.patch \file://0010-configure-Add-pkg-config-handling-for-libgcrypt.patch \
Quoted 5 lines
+ file://0011-linux-user-remove-host-stime-syscall.patch \ file://CVE-2019-15890.patch \ file://CVE-2019-12068.patch \ file://CVE-2020-1711.patch \diff --git
a/meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patchb/meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patchQuoted 4 lines
new file mode 100644
index 0000000000..659e6be45d
---/dev/null
+++
b/meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patchQuoted 25 lines
meta/recipes-devtools/qemu/qemu.inc +24
-0@@ -0,0 +1,61 @@ +From 0f1f2d4596aee037d3ccbcf10592466daa54107f Mon Sep 17 00:00:00 2001 +From: Laurent Vivier <[email protected]> +Date: Tue, 12 Nov 2019 15:25:56 +0100 +Subject: [PATCH] linux-user: remove host stime() syscall + +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);meta/recipes-devtools/qemu/qemu.inc line 34
Quoted 10 lines
meta/recipes-devtools/qemu/qemu.inc +10
-0+ 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 + +Upstream-Status: Backport [https://git.qemu.org/?p=qemu.git;a=commit;h=0f1f2d4596aee037d3ccbcf10592466daa54107f
]Quoted 32 lines
meta/recipes-devtools/qemu/qemu.inc +27
-1+Buglink: https://bugs.launchpad.net/qemu/+bug/1852115 +Reported-by: Cole Robinson <[email protected]> +Signed-off-by: Laurent Vivier <[email protected]> +Reviewed-by: Peter Maydell <[email protected]> +Message-Id: <[email protected]> +--- + linux-user/syscall.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -7651,10 +7651,12 @@ static abi_long do_syscall1(void *cpu_en + #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.25.1
Quoted 57 lines · Martin Jansa
From: Khem Raj <[email protected]>
Signed-off-by Khem Raj <[email protected]>Signed-off-by Richard Purdie <[email protected]>--- meta/recipes-devtools/qemu/qemu.inc | 1 + ...linux-user-remove-host-stime-syscall.patch | 61 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patchmeta/recipes-devtools/qemu/qemu.inc +1
-0@@ -27,6 +27,7 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \ file://0008-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch \ file://0009-Fix-webkitgtk-builds.patch \ file://0010-configure-Add-pkg-config-handling-for-libgcrypt.patch \ + file://0011-linux-user-remove-host-stime-syscall.patch \ file://CVE-2019-15890.patch \ file://CVE-2019-12068.patch \ file://CVE-2020-1711.patch \meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patch new file +29
-0@@ -0,0 +1,61 @@ +From 0f1f2d4596aee037d3ccbcf10592466daa54107f Mon Sep 17 00:00:00 2001 +From: Laurent Vivier <[email protected]> +Date: Tue, 12 Nov 2019 15:25:56 +0100 +Subject: [PATCH] linux-user: remove host stime() syscall + +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
meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patch line 39
Quoted 10 lines
meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patch new file +10
-0+ Tue Nov 12 14:18:32 UTC 2019 + ret 0 + Tue Nov 12 15:11:00 UTC 2019 + +Upstream-Status: Backport [https://git.qemu.org/?p=qemu.git;a=commit;h=0f1f2d4596aee037d3ccbcf10592466daa54107f] +Buglink: https://bugs.launchpad.net/qemu/+bug/1852115 +Reported-by: Cole Robinson <[email protected]> +Signed-off-by: Laurent Vivier <[email protected]> +Reviewed-by: Peter Maydell <[email protected]> +Message-Id: <[email protected]>
Who signed this patch off?
- armin
Quoted 24 lines
meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patch new file +22
-0+--- + linux-user/syscall.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -7651,10 +7651,12 @@ static abi_long do_syscall1(void *cpu_en + #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 */
Quoted 63 lines · On Wed, Apr 22, 2020 at 09:54:20AM -0700, akuster808 wrote:
Quoted 60 lines · Martin Jansa
From: Khem Raj <[email protected]>
Signed-off-by Khem Raj <[email protected]>Signed-off-by Richard Purdie <[email protected]>--- meta/recipes-devtools/qemu/qemu.inc | 1 + ...linux-user-remove-host-stime-syscall.patch | 61 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patchmeta/recipes-devtools/qemu/qemu.inc +1
-0@@ -27,6 +27,7 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \ file://0008-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch \ file://0009-Fix-webkitgtk-builds.patch \ file://0010-configure-Add-pkg-config-handling-for-libgcrypt.patch \ + file://0011-linux-user-remove-host-stime-syscall.patch \ file://CVE-2019-15890.patch \ file://CVE-2019-12068.patch \ file://CVE-2020-1711.patch \meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patch new file +32
-0@@ -0,0 +1,61 @@ +From 0f1f2d4596aee037d3ccbcf10592466daa54107f Mon Sep 17 00:00:00 2001 +From: Laurent Vivier <[email protected]> +Date: Tue, 12 Nov 2019 15:25:56 +0100 +Subject: [PATCH] linux-user: remove host stime() syscall + +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
Quoted 8 lines
meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patch line 39
Quoted 7 lines
meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patch new file +7
-0+ +Upstream-Status: Backport [https://git.qemu.org/?p=qemu.git;a=commit;h=0f1f2d4596aee037d3ccbcf10592466daa54107f] +Buglink: https://bugs.launchpad.net/qemu/+bug/1852115 +Reported-by: Cole Robinson <[email protected]> +Signed-off-by: Laurent Vivier <[email protected]> +Reviewed-by: Peter Maydell <[email protected]> +Message-Id: <[email protected]>Who signed this patch off?
Are SOBs in .patch files more strict for .patch files for zeus than for master?
It was merged to master here:
https://git.openembedded.org/openembedded-core/commit/meta/recipes-devtools/qemu/?id=2cca75155baec8358939e2aae822e256bed4cfe0
in this exact form with SOB from Laurent Vivier, if you think it's worth modifying the .patch just for this, then I'll send v2 with SOB from Khem.
At least the .patch was already removed from master in:
https://git.openembedded.org/openembedded-core/commit/meta/recipes-devtools/qemu/qemu?id=ca276b77904429a1ff3188d2373535a462afe266
so it won't show as unnecessary diff between zeus and dunfell.
Quoted 26 lines
- armin
Quoted 24 lines
meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patch new file +22
-0+--- + linux-user/syscall.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -7651,10 +7651,12 @@ static abi_long do_syscall1(void *cpu_en + #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 */
Quoted 71 lines · Martin Jansa
Quoted 62 lines · On Wed, Apr 22, 2020 at 09:54:20AM -0700, akuster808 wrote:
Quoted 60 lines · Martin Jansa
From: Khem Raj <[email protected]>
Signed-off-by Khem Raj <[email protected]>Signed-off-by Richard Purdie <[email protected]>--- meta/recipes-devtools/qemu/qemu.inc | 1 + ...linux-user-remove-host-stime-syscall.patch | 61 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patchmeta/recipes-devtools/qemu/qemu.inc +1
-0@@ -27,6 +27,7 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \ file://0008-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch \ file://0009-Fix-webkitgtk-builds.patch \ file://0010-configure-Add-pkg-config-handling-for-libgcrypt.patch \ + file://0011-linux-user-remove-host-stime-syscall.patch \ file://CVE-2019-15890.patch \ file://CVE-2019-12068.patch \ file://CVE-2020-1711.patch \meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patch new file +32
-0@@ -0,0 +1,61 @@ +From 0f1f2d4596aee037d3ccbcf10592466daa54107f Mon Sep 17 00:00:00 2001 +From: Laurent Vivier <[email protected]> +Date: Tue, 12 Nov 2019 15:25:56 +0100 +Subject: [PATCH] linux-user: remove host stime() syscall + +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 2019Quoted 8 lines
meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patch line 39
Quoted 7 lines
meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patch new file +7
-0+ +Upstream-Status: Backport [https://git.qemu.org/?p=qemu.git;a=commit;h=0f1f2d4596aee037d3ccbcf10592466daa54107f] +Buglink: https://bugs.launchpad.net/qemu/+bug/1852115 +Reported-by: Cole Robinson <[email protected]> +Signed-off-by: Laurent Vivier <[email protected]> +Reviewed-by: Peter Maydell <[email protected]> +Message-Id: <[email protected]>Who signed this patch off?
Quoted 2 lines
Are SOBs in .patch files more strict for .patch files for zeus than for master?
Not really.
Quoted 6 lines
It was merged to master here:
https://git.openembedded.org/openembedded-core/commit/meta/recipes-devtools/qemu/?id=2cca75155baec8358939e2aae822e256bed4cfe0
in this exact form with SOB from Laurent Vivier, if you think it's worth modifying the .patch just for this, then I'll send v2 with SOB from Khem.
I tried looking for it in dunfell for it before I sent my reply so its a no-op as it looks I my hunting skills nee
Quoted 30 lines
At least the .patch was already removed from master in:
https://git.openembedded.org/openembedded-core/commit/meta/recipes-devtools/qemu/qemu?id=ca276b77904429a1ff3188d2373535a462afe266
so it won't show as unnecessary diff between zeus and dunfell.Quoted 25 lines
- armin
Quoted 24 lines
meta/recipes-devtools/qemu/qemu/0011-linux-user-remove-host-stime-syscall.patch new file +22
-0+--- + linux-user/syscall.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -7651,10 +7651,12 @@ static abi_long do_syscall1(void *cpu_en + #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 */