Skip to contentSkip to conversation

virtfs-proxy-helper: small fixes

PATCH Applied Stefan Hajnoczi 3 participants 7 messages Mar 30, 2015 – Apr 24, 2015

lore
Share & tools
lore
#0 lore raw

cover virtfs-proxy-helper: small fixes

These fixes are not critical but it wouldn't hurt to get them into QEMU 2.3.

See patches for descriptions.

Stefan Hajnoczi (2):
virtfs-proxy-helper: add missing long option terminator
virtfs-proxy-helper: fail gracefully if socket path is too long

 fsdev/virtfs-proxy-helper.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Signature · 1 line
2.1.0
#2 lore raw

PATCH 2/2 virtfs-proxy-helper: fail gracefully if socket path is too long

Replace the assertion check with graceful failure when the socket path is too long. Programs should not crash on invalid input. Print an error message and exit properly.

---
 fsdev/virtfs-proxy-helper.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
fsdev/virtfs-proxy-helper.c +6 -1
index 91e8b9b..9097d15 100644
@@ -739,7 +739,12 @@ static int proxy_socket(const char *path, uid_t uid, gid_t gid)
         return -1;
     }
 
-    g_assert(strlen(path) < sizeof(proxy.sun_path));
+    if (strlen(path) >= sizeof(proxy.sun_path)) {
+        do_log(LOG_CRIT, "UNIX domain socket path exceeds %zu characters\n",
+               sizeof(proxy.sun_path));
+        return -1;
+    }
+
     sock = socket(AF_UNIX, SOCK_STREAM, 0);
     if (sock < 0) {
         do_perror("socket");
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/2 virtfs-proxy-helper: add missing long option terminator

In reply to Stefan Hajnoczi

The getopt_long(3) long options array must have a zeroed terminator.

This patch solves a segmentation fault when an unknown command-line option is encountered:

  $ fsdev/virtfs-proxy-helper --help
  Segmentation fault (core dumped)
---
 fsdev/virtfs-proxy-helper.c | 1 +
 1 file changed, 1 insertion(+)
fsdev/virtfs-proxy-helper.c +1 -0
index a698e2d..91e8b9b 100644
@@ -49,6 +49,7 @@ static struct option helper_opts[] = {
     {"socket", required_argument, NULL, 's'},
     {"uid", required_argument, NULL, 'u'},
     {"gid", required_argument, NULL, 'g'},
+    {},
 };
 
 static bool is_daemon;
Signature · 1 line
2.1.0
#3 lore raw
In reply to Stefan Hajnoczi
Quoted 10 lines · Stefan Hajnoczi

These fixes are not critical but it wouldn't hurt to get them into QEMU 2.3.

See patches for descriptions.

Stefan Hajnoczi (2):
virtfs-proxy-helper: add missing long option terminator
virtfs-proxy-helper: fail gracefully if socket path is too long

 fsdev/virtfs-proxy-helper.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Ping?

#4 lore raw
Quoted 5 lines · Stefan Hajnoczi
Quoted 4 lines · Stefan Hajnoczi

These fixes are not critical but it wouldn't hurt to get them into QEMU 2.3.

See patches for descriptions.

Quoted 8 lines
Quoted 6 lines

Stefan Hajnoczi (2):
virtfs-proxy-helper: add missing long option terminator
virtfs-proxy-helper: fail gracefully if socket path is too long

 fsdev/virtfs-proxy-helper.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Ping?

Applied.

-aneesh

#5 lore raw
Quoted 5 lines · Aneesh Kumar K.V
Quoted 3 lines · Stefan Hajnoczi
Quoted 2 lines · Stefan Hajnoczi

These fixes are not critical but it wouldn't hurt to get them into QEMU 2.3.

I am not sure whether this is critical enough to go to Qemu 2.3 ? If so I can send a pull request. I have already pushed the changes after testing to

https://github.com/kvaneesh/qemu.git tags/for-upstream-signed

-aneesh

#6 lore raw
Quoted 8 lines · Aneesh Kumar K.V
Quoted 5 lines · Aneesh Kumar K.V
Quoted 3 lines · Stefan Hajnoczi
Quoted 2 lines · Stefan Hajnoczi

These fixes are not critical but it wouldn't hurt to get them into QEMU 2.3.

Quoted 6 lines

I am not sure whether this is critical enough to go to Qemu 2.3 ? If so I can send a pull request. I have already pushed the changes after testing to

https://github.com/kvaneesh/qemu.git tags/for-upstream-signed

It's too late for QEMU 2.3 (release is planned for today) and they are not critical.

Feel free to send a pull request at your convenience and they'll go into QEMU 2.4.

Stefan