<div dir="ltr">merged.<div><br></div><div>Bruce</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 15, 2018 at 11:19 AM, Jason Wessel <span dir="ltr"><<a href="mailto:jason.wessel@windriver.com" target="_blank">jason.wessel@windriver.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The patch to hypterstart was also submitted to the upstream project.<br>
It fixes these errors/warnings:<br>
<br>
container.c: In function 'hyper_setup_container_rootfs'<wbr>:<br>
container.c:630:24: error: '/' directive writing 1 byte into a region of size between 0 and 511 [-Werror=format-overflow=]<br>
  sprintf(rootfs, "%s/%s/", root, container->rootfs);<br>
                        ^<br>
container.c:630:2: note: 'sprintf' output 3 or more bytes (assuming 514) into a destination of size 512<br>
  sprintf(rootfs, "%s/%s/", root, container->rootfs);<br>
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<wbr>~~~~~~~~~~~~~~~~~~~~<br>
container.c:262:18: error: '%s' directive writing up to 511 bytes into a region of size 510 [-Werror=format-overflow=]<br>
  sprintf(dst, "./%s", src);<br>
                  ^~   ~~~<br>
container.c:262:2: note: 'sprintf' output between 3 and 514 bytes into a destination of size 512<br>
  sprintf(dst, "./%s", src);<br>
  ^~~~~~~~~~~~~~~~~~~~~~~~~<br>
container.c:218:24: error: '/_data' directive writing 6 bytes into a region of size between 1 and 512 [-Werror=format-overflow=]<br>
     sprintf(volume, "%s/_data", path);<br>
                        ^~~~~~<br>
container.c:218:5: note: 'sprintf' output between 7 and 518 bytes into a destination of size 512<br>
     sprintf(volume, "%s/_data", path);<br>
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<wbr>~~~<br>
container.c:149:24: error: '/_data' directive writing 6 bytes into a region of size between 0 and 511 [-Werror=format-overflow=]<br>
    sprintf(volume, "/%s/_data", path);<br>
                        ^~~~~~<br>
container.c:149:4: note: 'sprintf' output between 8 and 519 bytes into a destination of size 512<br>
    sprintf(volume, "/%s/_data", path);<br>
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<wbr>~~~~<br>
container.c:131:24: error: '/' directive writing 1 byte into a region of size between 0 and 511 [-Werror=format-overflow=]<br>
    sprintf(volume, "/%s/", path);<br>
                        ^<br>
container.c:131:4: note: 'sprintf' output between 3 and 514 bytes into a destination of size 512<br>
    sprintf(volume, "/%s/", path);<br>
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
container.c:176:24: error: '/_data/' directive writing 7 bytes into a region of size between 0 and 511 [-Werror=format-overflow=]<br>
    sprintf(volume, "/%s/_data/%s", path, filevolume);<br>
                        ^~~~~~~<br>
container.c:176:4: note: 'sprintf' output 9 or more bytes (assuming 520) into a destination of size 512<br>
    sprintf(volume, "/%s/_data/%s", path, filevolume);<br>
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<wbr>~~~~~~~~~~~~~~~~~~~<br>
<br>
Signed-off-by: Jason Wessel <<a href="mailto:jason.wessel@windriver.com">jason.wessel@windriver.com</a>><br>
---<br>
 ...compiler-errors-that-gcc-8.<wbr>1.0-repor.patch | 230 ++++++++++++++++++<br>
 recipes-extended/hyperstart/<a href="http://hyperstart_git.bb" rel="noreferrer" target="_blank">hy<wbr>perstart_git.bb</a> |   1 +<br>
 2 files changed, 231 insertions(+)<br>
 create mode 100644 recipes-extended/hyperstart/<wbr>hyperstart/0001-container.c-<wbr>Fix-compiler-errors-that-gcc-<wbr>8.1.0-repor.patch<br>
<br>
diff --git a/recipes-extended/hyperstart/<wbr>hyperstart/0001-container.c-<wbr>Fix-compiler-errors-that-gcc-<wbr>8.1.0-repor.patch b/recipes-extended/hyperstart/<wbr>hyperstart/0001-container.c-<wbr>Fix-compiler-errors-that-gcc-<wbr>8.1.0-repor.patch<br>
new file mode 100644<br>
index 0000000..4a01de5<br>
--- /dev/null<br>
+++ b/recipes-extended/hyperstart/<wbr>hyperstart/0001-container.c-<wbr>Fix-compiler-errors-that-gcc-<wbr>8.1.0-repor.patch<br>
@@ -0,0 +1,230 @@<br>
+From 11f5089300c1c368d896c95890827d<wbr>c85a67f132 Mon Sep 17 00:00:00 2001<br>
+From: Jason Wessel <<a href="mailto:jason.wessel@windriver.com">jason.wessel@windriver.com</a>><br>
+Date: Fri, 15 Jun 2018 08:04:35 -0700<br>
+Subject: [PATCH] container.c: Fix compiler errors that gcc 8.1.0 reports<br>
+<br>
+gcc 8.1.0 reports the following compiler errors/warnings.  They can be<br>
+fixed by using snprintf and checking the result for truncation.  This<br>
+patch also uses a named constant instead of inserting the value 512 in<br>
+many locations.<br>
+<br>
+container.c: In function 'hyper_setup_container_rootfs'<wbr>:<br>
+container.c:630:24: error: '/' directive writing 1 byte into a region of size between 0 and 511 [-Werror=format-overflow=]<br>
+  sprintf(rootfs, "%s/%s/", root, container->rootfs);<br>
+                        ^<br>
+container.c:630:2: note: 'sprintf' output 3 or more bytes (assuming 514) into a destination of size 512<br>
+  sprintf(rootfs, "%s/%s/", root, container->rootfs);<br>
+  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<wbr>~~~~~~~~~~~~~~~~~~~~<br>
+container.c:262:18: error: '%s' directive writing up to 511 bytes into a region of size 510 [-Werror=format-overflow=]<br>
+  sprintf(dst, "./%s", src);<br>
+                  ^~   ~~~<br>
+container.c:262:2: note: 'sprintf' output between 3 and 514 bytes into a destination of size 512<br>
+  sprintf(dst, "./%s", src);<br>
+  ^~~~~~~~~~~~~~~~~~~~~~~~~<br>
+container.c:218:24: error: '/_data' directive writing 6 bytes into a region of size between 1 and 512 [-Werror=format-overflow=]<br>
+     sprintf(volume, "%s/_data", path);<br>
+                        ^~~~~~<br>
+container.c:218:5: note: 'sprintf' output between 7 and 518 bytes into a destination of size 512<br>
+     sprintf(volume, "%s/_data", path);<br>
+     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<wbr>~~~<br>
+container.c:149:24: error: '/_data' directive writing 6 bytes into a region of size between 0 and 511 [-Werror=format-overflow=]<br>
+    sprintf(volume, "/%s/_data", path);<br>
+                        ^~~~~~<br>
+container.c:149:4: note: 'sprintf' output between 8 and 519 bytes into a destination of size 512<br>
+    sprintf(volume, "/%s/_data", path);<br>
+    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<wbr>~~~~<br>
+container.c:131:24: error: '/' directive writing 1 byte into a region of size between 0 and 511 [-Werror=format-overflow=]<br>
+    sprintf(volume, "/%s/", path);<br>
+                        ^<br>
+container.c:131:4: note: 'sprintf' output between 3 and 514 bytes into a destination of size 512<br>
+    sprintf(volume, "/%s/", path);<br>
+    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
+container.c:176:24: error: '/_data/' directive writing 7 bytes into a region of size between 0 and 511 [-Werror=format-overflow=]<br>
+    sprintf(volume, "/%s/_data/%s", path, filevolume);<br>
+                        ^~~~~~~<br>
+container.c:176:4: note: 'sprintf' output 9 or more bytes (assuming 520) into a destination of size 512<br>
+    sprintf(volume, "/%s/_data/%s", path, filevolume);<br>
+    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<wbr>~~~~~~~~~~~~~~~~~~~<br>
+<br>
+Signed-off-by: Jason Wessel <<a href="mailto:jason.wessel@windriver.com">jason.wessel@windriver.com</a>><br>
+---<br>
+ src/container.c | 47 ++++++++++++++++++++++++++++--<wbr>-----------------<br>
+ 1 file changed, 28 insertions(+), 19 deletions(-)<br>
+<br>
+diff --git a/src/container.c b/src/container.c<br>
+index 0938d82..b1c52d4 100644<br>
+--- a/src/container.c<br>
++++ b/src/container.c<br>
+@@ -22,6 +22,8 @@<br>
+ #include "syscall.h"<br>
+ #include "netlink.h"<br>
+ <br>
++#define MAX_PBUF 512<br>
++<br>
+ static int container_populate_volume(char *src, char *dest)<br>
+ {<br>
+       struct stat st;<br>
+@@ -99,12 +101,12 @@ static int container_setup_volume(struct hyper_pod *pod,<br>
+                                 struct hyper_container *container)<br>
+ {<br>
+       int i;<br>
+-      char dev[512], path[512];<br>
++      char dev[MAX_PBUF], path[MAX_PBUF];<br>
+       struct volume *vol;<br>
+ <br>
+       for (i = 0; i < container->vols_num; i++) {<br>
+-              char volume[512];<br>
+-              char mountpoint[512];<br>
++              char volume[MAX_PBUF];<br>
++              char mountpoint[MAX_PBUF];<br>
+               char *options = NULL;<br>
+               const char *filevolume = NULL;<br>
+               vol = &container->vols[i];<br>
+@@ -128,7 +130,8 @@ static int container_setup_volume(struct hyper_pod *pod,<br>
+                       if (hyper_mount_nfs(vol->device, path) < 0)<br>
+                               return -1;<br>
+                       /* nfs export has implicitly included _data part of the volume */<br>
+-                      sprintf(volume, "/%s/", path);<br>
++                      if (snprintf(volume, MAX_PBUF, "/%s/", path) >= MAX_PBUF)<br>
++                                return -1;<br>
+               } else {<br>
+                       fprintf(stdout, "mount %s to %s, tmp path %s\n",<br>
+                               dev, vol->mountpoint, path);<br>
+@@ -137,7 +140,7 @@ static int container_setup_volume(struct hyper_pod *pod,<br>
+                               options = "nouuid";<br>
+ <br>
+                       if (access(dev, R_OK) < 0) {<br>
+-                              char device[512];<br>
++                              char device[MAX_PBUF];<br>
+                               sprintf(device, "/block/%s", vol->device);<br>
+                               hyper_netlink_wait_dev(pod-><wbr>ueventfd, device);<br>
+                       }<br>
+@@ -146,7 +149,8 @@ static int container_setup_volume(struct hyper_pod *pod,<br>
+                               perror("mount volume device failed");<br>
+                               return -1;<br>
+                       }<br>
+-                      sprintf(volume, "/%s/_data", path);<br>
++                      if (snprintf(volume, MAX_PBUF, "/%s/_data", path) >= MAX_PBUF)<br>
++                                return -1;<br>
+               }<br>
+ <br>
+               if (container_check_file_volume(<wbr>volume, &filevolume) < 0)<br>
+@@ -173,7 +177,8 @@ static int container_setup_volume(struct hyper_pod *pod,<br>
+                               perror("create volume file failed");<br>
+                               return -1;<br>
+                       }<br>
+-                      sprintf(volume, "/%s/_data/%s", path, filevolume);<br>
++                      if (snprintf(volume, MAX_PBUF, "/%s/_data/%s", path, filevolume) >= MAX_PBUF)<br>
++                                return -1;<br>
+                       /* 0777 so that any user can read/write the new file volume */<br>
+                       if (chmod(volume, 0777) < 0) {<br>
+                               fprintf(stderr, "fail to chmod directory %s\n", volume);<br>
+@@ -197,9 +202,9 @@ static int container_setup_volume(struct hyper_pod *pod,<br>
+ <br>
+       for (i = 0; i < container->maps_num; i++) {<br>
+               struct stat st;<br>
+-              char *src, path[512], volume[512];<br>
++              char *src, path[MAX_PBUF], volume[MAX_PBUF];<br>
+               struct fsmap *map = &container->maps[i];<br>
+-              char mountpoint[512];<br>
++              char mountpoint[MAX_PBUF];<br>
+ <br>
+               sprintf(path, "%s/%s", SHARED_DIR, map->source);<br>
+               sprintf(mountpoint, "./%s", map->path);<br>
+@@ -215,7 +220,8 @@ static int container_setup_volume(struct hyper_pod *pod,<br>
+                       }<br>
+                       if (map->docker) {<br>
+                               /* converted from volume */<br>
+-                              sprintf(volume, "%s/_data", path);<br>
++                              if (snprintf(volume, MAX_PBUF, "%s/_data", path) >= MAX_PBUF)<br>
++                                        return -1;<br>
+                               src = volume;<br>
+                               if (container->initialize &&<br>
+                                   (container_populate_volume(<wbr>mountpoint, volume) < 0)) {<br>
+@@ -251,7 +257,7 @@ static int container_setup_modules(struct hyper_container *container)<br>
+ {<br>
+       struct stat st;<br>
+       struct utsname uts;<br>
+-      char src[512], dst[512];<br>
++      char src[MAX_PBUF], dst[MAX_PBUF];<br>
+ <br>
+       if (uname(&uts) < 0) {<br>
+               perror("fail to call uname");<br>
+@@ -259,7 +265,8 @@ static int container_setup_modules(struct hyper_container *container)<br>
+       }<br>
+ <br>
+       sprintf(src, "/lib/modules/%s", uts.release);<br>
+-      sprintf(dst, "./%s", src);<br>
++      if (snprintf(dst, MAX_PBUF, "./%s", src) >= MAX_PBUF)<br>
++        return -1;<br>
+ <br>
+       if (stat(dst, &st) == 0) {<br>
+               struct dirent **list;<br>
+@@ -291,7 +298,7 @@ static int container_setup_modules(struct hyper_container *container)<br>
+ <br>
+ static int container_setup_mount(struct hyper_container *container)<br>
+ {<br>
+-      char src[512];<br>
++      char src[MAX_PBUF];<br>
+ <br>
+       // current dir is container rootfs, the operations on "./PATH" are the operations on container's "/PATH"<br>
+       if (!container->readonly) {<br>
+@@ -546,7 +553,7 @@ static int hyper_setup_container_rootfs(<wbr>void *data)<br>
+ {<br>
+       struct hyper_container_arg *arg = data;<br>
+       struct hyper_container *container = arg->c;<br>
+-      char root[512], rootfs[512];<br>
++      char root[MAX_PBUF], rootfs[MAX_PBUF];<br>
+       int setup_dns;<br>
+ <br>
+       /* wait for ns-opened ready message */<br>
+@@ -609,7 +616,7 @@ static int hyper_setup_container_rootfs(<wbr>void *data)<br>
+                       goto fail;<br>
+               }<br>
+       } else {<br>
+-              char path[512];<br>
++              char path[MAX_PBUF];<br>
+ <br>
+               sprintf(path, "%s/%s/", SHARED_DIR, container->image);<br>
+               fprintf(stdout, "src directory %s\n", path);<br>
+@@ -627,7 +634,9 @@ static int hyper_setup_container_rootfs(<wbr>void *data)<br>
+       fprintf(stdout, "root directory for container is %s/%s, init task %s\n",<br>
+               root, container->rootfs, container->exec.argv[0]);<br>
+ <br>
+-      sprintf(rootfs, "%s/%s/", root, container->rootfs);<br>
++      if (snprintf(rootfs, MAX_PBUF, "%s/%s/", root, container->rootfs) >= MAX_PBUF)<br>
++        goto fail;<br>
++    <br>
+       if (mount(rootfs, rootfs, NULL, MS_BIND|MS_REC, NULL) < 0) {<br>
+               perror("failed to bind rootfs");<br>
+               goto fail;<br>
+@@ -710,7 +719,7 @@ fail:<br>
+ <br>
+ static int hyper_setup_pty(struct hyper_container *c)<br>
+ {<br>
+-      char root[512];<br>
++      char root[MAX_PBUF];<br>
+ <br>
+       sprintf(root, "/tmp/hyper/%s/devpts/", c->id);<br>
+ <br>
+@@ -730,7 +739,7 @@ static int hyper_setup_pty(struct hyper_container *c)<br>
+ <br>
+ static void hyper_cleanup_pty(struct hyper_container *c)<br>
+ {<br>
+-      char path[512];<br>
++      char path[MAX_PBUF];<br>
+ <br>
+       sprintf(path, "/tmp/hyper/%s/devpts/", c->id);<br>
+       if (umount(path) < 0)<br>
+@@ -739,7 +748,7 @@ static void hyper_cleanup_pty(struct hyper_container *c)<br>
+ <br>
+ int container_prepare_rootfs_dev(<wbr>struct hyper_container *container, struct hyper_pod *pod)<br>
+ {<br>
+-      char dev[512];<br>
++      char dev[MAX_PBUF];<br>
+ <br>
+       if (container->fstype == NULL)<br>
+               return 0;<br>
+-- <br>
+2.17.1<br>
+<br>
diff --git a/recipes-extended/hyperstart/<a href="http://hyperstart_git.bb" rel="noreferrer" target="_blank"><wbr>hyperstart_git.bb</a> b/recipes-extended/hyperstart/<a href="http://hyperstart_git.bb" rel="noreferrer" target="_blank"><wbr>hyperstart_git.bb</a><br>
index 0297477..99c2195 100644<br>
--- a/recipes-extended/hyperstart/<a href="http://hyperstart_git.bb" rel="noreferrer" target="_blank"><wbr>hyperstart_git.bb</a><br>
+++ b/recipes-extended/hyperstart/<a href="http://hyperstart_git.bb" rel="noreferrer" target="_blank"><wbr>hyperstart_git.bb</a><br>
@@ -7,6 +7,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=<wbr>fa818a259cbed7ce8bc2a22d35a464<wbr>fc"<br>
 inherit autotools-brokensep <br>
<br>
 SRC_URI = "git://<a href="http://github.com/hyperhq/hyperstart.git" rel="noreferrer" target="_blank">github.com/hyperhq/<wbr>hyperstart.git</a>"<br>
+SRC_URI += "file://0001-container.c-Fix-<wbr>compiler-errors-that-gcc-8.1.<wbr>0-repor.patch"<br>
<br>
 SRCREV = "<wbr>ad48a3230836f59ada163659cde151<wbr>a37522068b"<br>
 PV = "v0.2+git${SRCREV}"<br>
<span class="HOEnZb"><font color="#888888">-- <br>
2.17.1<br>
<br>
-- <br>
______________________________<wbr>_________________<br>
meta-virtualization mailing list<br>
<a href="mailto:meta-virtualization@yoctoproject.org">meta-virtualization@<wbr>yoctoproject.org</a><br>
<a href="https://lists.yoctoproject.org/listinfo/meta-virtualization" rel="noreferrer" target="_blank">https://lists.yoctoproject.<wbr>org/listinfo/meta-<wbr>virtualization</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"</div>
</div>