[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v1] stubdom: fix errors in newlib:cygmon-gmon.c


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Olaf Hering <olaf@xxxxxxxxx>
  • Date: Wed, 26 Apr 2023 10:51:56 +0000
  • Arc-authentication-results: i=1; strato.com; arc=none; dkim=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1682506319; s=strato-dkim-0002; d=strato.com; h=Message-Id:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=IrwdqgFkX0ZU6V+Dyc1PJ+89WpXrnJ6yDr5eITXGbIk=; b=ZXxDPWcAJaD17yqeCLXedK7trTlY678n7MviBf4sp6ZEnUJal1lPTmZedvVfiW33Z6 FQ7X3VB1EHJTA9czyTUST0oqbtGKyLdSzeDBakJfo+/e3I2GQzpnM454kVVWD3FWTtVX xhEaKXKtQmJCivn6nEZ5giPiiNqjO8cV+eVANoQ8ZJi+TiSHBNzn7HIsN8rACmKvsnye 5yDNv07Z+JH6h2GK7etnkkS2+MeVXT31m1fSaP0Uv9qStvdj1p/QCzVNYYjhc+AvsijN 4FNOIPHp/S+cmNtsOVYyUHyoVLo7+Ht0owSAXxCXpdjCUVS/8nrqLkmoPxq/ECjk+oB1 R5qQ==
  • Arc-seal: i=1; a=rsa-sha256; t=1682506319; cv=none; d=strato.com; s=strato-dkim-0002; b=YrrrVEKkY1xSgYZ/BuO72DGofk503zHM4gDgcFMX1aKdNWQ72EjkA92+M0TKuOnie1 v0qtaBCSPUgGrcPhhxbjpUVq4wZq9XnK4o6HLtVNPdiySYLH4g9MLZAnTVXxTUgjSE4l yDFIUeudjppMVwvOmTHhsEBILhaaiLAMEI23AEOcxgwCPBgO5OuD9pcNROQeTZff3ocp NI2A4x+s62tF3ZwPgCuKA3/aCf/FTMFkZIv2uGSkdfX/mlGyBWPhOVxsAR/AY0++NaM3 a/0OGXRUe0DueN+YuM0TsM0EW7jlGDl0UEhXLeBEw1zpKVEx3Hunjvd78gFOjSyojD3i epvA==
  • Cc: Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
  • Delivery-date: Wed, 26 Apr 2023 10:52:13 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

rpm post-build-checks found a few code bugs in newlib, and marks them as
errors. Add another newlib patch and apply it during stubdom build.

I: A function uses a 'return;' statement, but has actually a value
   to return, like an integer ('return 42;') or similar.
W: xen voidreturn ../../../../newlib-1.16.0/libgloss/i386/cygmon-gmon.c:117, 
125, 146, 157, 330

I: Program is using implicit definitions of special functions.
   these functions need to use their correct prototypes to allow
   the lightweight buffer overflow checking to work.
     - Implicit memory/string functions need #include <string.h>.
     - Implicit *printf functions need #include <stdio.h>.
     - Implicit *printf functions need #include <stdio.h>.
     - Implicit *read* functions need #include <unistd.h>.
     - Implicit *recv* functions need #include <sys/socket.h>.
E: xen implicit-fortify-decl 
../../../../newlib-1.16.0/libgloss/i386/cygmon-gmon.c:119

I: Program returns random data in a function
E: xen no-return-in-nonvoid-function 
../../../../newlib-1.16.0/libgloss/i386/cygmon-gmon.c:362

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
---
 stubdom/Makefile                 |  1 +
 stubdom/newlib-cygmon-gmon.patch | 60 ++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)
 create mode 100644 stubdom/newlib-cygmon-gmon.patch

diff --git a/stubdom/Makefile b/stubdom/Makefile
index b312f710cd..cddbbe2da0 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -95,6 +95,7 @@ newlib-$(NEWLIB_VERSION): newlib-$(NEWLIB_VERSION).tar.gz
        patch -d $@ -p0 < newlib-chk.patch
        patch -d $@ -p1 < newlib-stdint-size_max-fix-from-1.17.0.patch
        patch -d $@ -p1 < newlib-disable-texinfo.patch
+       patch -d $@ -p1 < newlib-cygmon-gmon.patch
        find $@ -type f | xargs perl -i.bak \
                -pe 's/\b_(tzname|daylight|timezone)\b/$$1/g'
        touch $@
diff --git a/stubdom/newlib-cygmon-gmon.patch b/stubdom/newlib-cygmon-gmon.patch
new file mode 100644
index 0000000000..b2dfbfafe2
--- /dev/null
+++ b/stubdom/newlib-cygmon-gmon.patch
@@ -0,0 +1,60 @@
+
+I: A function uses a 'return;' statement, but has actually a value
+   to return, like an integer ('return 42;') or similar.
+W: xen voidreturn ../../../../newlib-1.16.0/libgloss/i386/cygmon-gmon.c:117, 
125, 146, 157, 330
+
+I: Program is using implicit definitions of special functions.
+   these functions need to use their correct prototypes to allow
+   the lightweight buffer overflow checking to work.
+     - Implicit memory/string functions need #include <string.h>.
+     - Implicit *printf functions need #include <stdio.h>.
+     - Implicit *printf functions need #include <stdio.h>.
+     - Implicit *read* functions need #include <unistd.h>.
+     - Implicit *recv* functions need #include <sys/socket.h>.
+E: xen implicit-fortify-decl 
../../../../newlib-1.16.0/libgloss/i386/cygmon-gmon.c:119
+
+I: Program returns random data in a function
+E: xen no-return-in-nonvoid-function 
../../../../newlib-1.16.0/libgloss/i386/cygmon-gmon.c:362
+
+---
+ libgloss/i386/cygmon-gmon.c |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+Index: newlib-1.16.0/libgloss/i386/cygmon-gmon.c
+===================================================================
+--- newlib-1.16.0.orig/libgloss/i386/cygmon-gmon.c
++++ newlib-1.16.0/libgloss/i386/cygmon-gmon.c
+@@ -61,6 +61,8 @@
+ static char sccsid[] = "@(#)gmon.c    5.3 (Berkeley) 5/22/91";
+ #endif /* not lint */
+ 
++#include <string.h>
++#include <unistd.h>
+ #define DEBUG
+ #ifdef DEBUG
+ #include <stdio.h>
+@@ -89,7 +91,7 @@ static int   s_scale;
+ 
+ extern int errno;
+ 
+-int
++void
+ monstartup(lowpc, highpc)
+      char     *lowpc;
+      char     *highpc;
+@@ -199,6 +201,7 @@ _mcleanup()
+ 
+ static char already_setup = 0;
+ 
++void
+ _mcount()
+ {
+   register char                       *selfpc;
+@@ -341,6 +344,7 @@ overflow:
+  *    profiling is what mcount checks to see if
+  *    all the data structures are ready.
+  */
++void
+ moncontrol(mode)
+     int mode;
+ {



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.