* [Buildroot] [PATCH] package/qemu: fix crash with uClibc-ng
@ 2019-10-19 2:09 unixmania at gmail.com
2019-10-20 14:26 ` Thomas Petazzoni
2019-10-30 8:58 ` Peter Korsgaard
0 siblings, 2 replies; 5+ messages in thread
From: unixmania at gmail.com @ 2019-10-19 2:09 UTC (permalink / raw)
To: buildroot
From: Carlos Santos <unixmania@gmail.com>
On uClibc-ng sysconf(_SC_LEVEL1_{I,D}CACHE_LINESIZE) returns -1, which
is a valid result, meaning that the limit is indeterminate. Add a patch
that handles this situation using fallback values instead of crashing
due to an assertion failure.
Upstream status:
https://lists.nongnu.org/archive/html/qemu-devel/2019-10/msg04115.html
Signed-off-by: Carlos Santos <unixmania@gmail.com>
---
...fix-crash-when-compiling-with-uClibc.patch | 43 +++++++++++++++++++
1 file changed, 43 insertions(+)
create mode 100644 package/qemu/3.1.1/0003-util-cacheinfo-fix-crash-when-compiling-with-uClibc.patch
diff --git a/package/qemu/3.1.1/0003-util-cacheinfo-fix-crash-when-compiling-with-uClibc.patch b/package/qemu/3.1.1/0003-util-cacheinfo-fix-crash-when-compiling-with-uClibc.patch
new file mode 100644
index 0000000000..d1b9e35709
--- /dev/null
+++ b/package/qemu/3.1.1/0003-util-cacheinfo-fix-crash-when-compiling-with-uClibc.patch
@@ -0,0 +1,43 @@
+From d82b8540ecaf3cb09a033e4971d8645d3343211e Mon Sep 17 00:00:00 2001
+From: Carlos Santos <casantos@redhat.com>
+Date: Wed, 16 Oct 2019 22:27:30 -0300
+Subject: [PATCH] util/cacheinfo: fix crash when compiling with uClibc
+
+uClibc defines _SC_LEVEL1_ICACHE_LINESIZE and _SC_LEVEL1_DCACHE_LINESIZE
+but the corresponding sysconf calls returns -1, which is a valid result,
+meaning that the limit is indeterminate.
+
+Handle this situation using the fallback values instead of crashing due
+to an assertion failure.
+
+Signed-off-by: Carlos Santos <casantos@redhat.com>
+---
+ util/cacheinfo.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/util/cacheinfo.c b/util/cacheinfo.c
+index ea6f3e99bf..d94dc6adc8 100644
+--- a/util/cacheinfo.c
++++ b/util/cacheinfo.c
+@@ -93,10 +93,16 @@ static void sys_cache_info(int *isize, int *dsize)
+ static void sys_cache_info(int *isize, int *dsize)
+ {
+ # ifdef _SC_LEVEL1_ICACHE_LINESIZE
+- *isize = sysconf(_SC_LEVEL1_ICACHE_LINESIZE);
++ int tmp_isize = (int) sysconf(_SC_LEVEL1_ICACHE_LINESIZE);
++ if (tmp_isize > 0) {
++ *isize = tmp_isize;
++ }
+ # endif
+ # ifdef _SC_LEVEL1_DCACHE_LINESIZE
+- *dsize = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
++ int tmp_dsize = (int) sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
++ if (tmp_dsize > 0) {
++ *dsize = tmp_dsize;
++ }
+ # endif
+ }
+ #endif /* sys_cache_info */
+--
+2.18.1
+
--
2.18.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [Buildroot] [PATCH] package/qemu: fix crash with uClibc-ng
2019-10-19 2:09 [Buildroot] [PATCH] package/qemu: fix crash with uClibc-ng unixmania at gmail.com
@ 2019-10-20 14:26 ` Thomas Petazzoni
2019-10-21 14:28 ` Carlos Santos
2019-10-30 8:58 ` Peter Korsgaard
1 sibling, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2019-10-20 14:26 UTC (permalink / raw)
To: buildroot
On Fri, 18 Oct 2019 23:09:28 -0300
unixmania at gmail.com wrote:
> From: Carlos Santos <unixmania@gmail.com>
>
> On uClibc-ng sysconf(_SC_LEVEL1_{I,D}CACHE_LINESIZE) returns -1, which
> is a valid result, meaning that the limit is indeterminate. Add a patch
> that handles this situation using fallback values instead of crashing
> due to an assertion failure.
>
> Upstream status:
> https://lists.nongnu.org/archive/html/qemu-devel/2019-10/msg04115.html
>
> Signed-off-by: Carlos Santos <unixmania@gmail.com>
> ---
> ...fix-crash-when-compiling-with-uClibc.patch | 43 +++++++++++++++++++
> 1 file changed, 43 insertions(+)
> create mode 100644 package/qemu/3.1.1/0003-util-cacheinfo-fix-crash-when-compiling-with-uClibc.patch
Applied to master, thanks.
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 5+ messages in thread* [Buildroot] [PATCH] package/qemu: fix crash with uClibc-ng
2019-10-20 14:26 ` Thomas Petazzoni
@ 2019-10-21 14:28 ` Carlos Santos
2019-10-21 14:31 ` Thomas Petazzoni
0 siblings, 1 reply; 5+ messages in thread
From: Carlos Santos @ 2019-10-21 14:28 UTC (permalink / raw)
To: buildroot
On Sun, Oct 20, 2019 at 11:26 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> On Fri, 18 Oct 2019 23:09:28 -0300
> unixmania at gmail.com wrote:
>
> > From: Carlos Santos <unixmania@gmail.com>
> >
> > On uClibc-ng sysconf(_SC_LEVEL1_{I,D}CACHE_LINESIZE) returns -1, which
> > is a valid result, meaning that the limit is indeterminate. Add a patch
> > that handles this situation using fallback values instead of crashing
> > due to an assertion failure.
> >
> > Upstream status:
> > https://lists.nongnu.org/archive/html/qemu-devel/2019-10/msg04115.html
> >
> > Signed-off-by: Carlos Santos <unixmania@gmail.com>
> > ---
> > ...fix-crash-when-compiling-with-uClibc.patch | 43 +++++++++++++++++++
> > 1 file changed, 43 insertions(+)
> > create mode 100644 package/qemu/3.1.1/0003-util-cacheinfo-fix-crash-when-compiling-with-uClibc.patch
>
> Applied to master, thanks.
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
Still appears as "New" in patchwork: https://patchwork.ozlabs.org/patch/1179727/
--
Carlos Santos <unixmania@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread* [Buildroot] [PATCH] package/qemu: fix crash with uClibc-ng
2019-10-21 14:28 ` Carlos Santos
@ 2019-10-21 14:31 ` Thomas Petazzoni
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Petazzoni @ 2019-10-21 14:31 UTC (permalink / raw)
To: buildroot
On Mon, 21 Oct 2019 11:28:55 -0300
Carlos Santos <unixmania@gmail.com> wrote:
> > > ...fix-crash-when-compiling-with-uClibc.patch | 43 +++++++++++++++++++
> > > 1 file changed, 43 insertions(+)
> > > create mode 100644 package/qemu/3.1.1/0003-util-cacheinfo-fix-crash-when-compiling-with-uClibc.patch
> >
> > Applied to master, thanks.
> >
> > Thomas
> > --
> > Thomas Petazzoni, CTO, Bootlin
> > Embedded Linux and Kernel engineering
> > https://bootlin.com
>
> Still appears as "New" in patchwork: https://patchwork.ozlabs.org/patch/1179727/
Thanks for reporting, I fixed the patch state. I guess I got distracted
by some $reallife interruption :-)
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH] package/qemu: fix crash with uClibc-ng
2019-10-19 2:09 [Buildroot] [PATCH] package/qemu: fix crash with uClibc-ng unixmania at gmail.com
2019-10-20 14:26 ` Thomas Petazzoni
@ 2019-10-30 8:58 ` Peter Korsgaard
1 sibling, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2019-10-30 8:58 UTC (permalink / raw)
To: buildroot
>>>>> "unixmania" == unixmania <unixmania@gmail.com> writes:
> From: Carlos Santos <unixmania@gmail.com>
> On uClibc-ng sysconf(_SC_LEVEL1_{I,D}CACHE_LINESIZE) returns -1, which
> is a valid result, meaning that the limit is indeterminate. Add a patch
> that handles this situation using fallback values instead of crashing
> due to an assertion failure.
> Upstream status:
> https://lists.nongnu.org/archive/html/qemu-devel/2019-10/msg04115.html
> Signed-off-by: Carlos Santos <unixmania@gmail.com>
Committed to 2019.02.x and 2019.08.x, thanks.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-10-30 8:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-19 2:09 [Buildroot] [PATCH] package/qemu: fix crash with uClibc-ng unixmania at gmail.com
2019-10-20 14:26 ` Thomas Petazzoni
2019-10-21 14:28 ` Carlos Santos
2019-10-21 14:31 ` Thomas Petazzoni
2019-10-30 8:58 ` Peter Korsgaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox