* [Qemu-devel] [PULL] VirtFS update
@ 2015-06-16 15:29 Aneesh Kumar K.V
2015-06-16 15:29 ` [Qemu-devel] [PATCH 1/2] virtfs-proxy-helper: add missing long option terminator Aneesh Kumar K.V
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Aneesh Kumar K.V @ 2015-06-16 15:29 UTC (permalink / raw)
To: anthony, peter.maydell; +Cc: qemu-devel, Aneesh Kumar K.V
The following changes since commit 93f6d1c16036aaf34055d16f54ea770fb8d6d280:
Merge remote-tracking branch 'remotes/kraxel/tags/pull-vga-20150615-1' into staging (2015-06-16 10:35:43 +0100)
are available in the git repository at:
https://github.com/kvaneesh/qemu.git tags/for-upstream-signed
for you to fetch changes up to f8d30a4f96d6c3a12e692d2e69b8fe4734b916c6:
virtfs-proxy-helper: fail gracefully if socket path is too long (2015-06-16 20:32:29 +0530)
----------------------------------------------------------------
VirtFS update:
* Fix for virtfs-proxy-helper crash
* Gracefully handle the error condition on input validation in virtfs-proxy-helper
----------------------------------------------------------------
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(-)
--
2.1.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 1/2] virtfs-proxy-helper: add missing long option terminator
2015-06-16 15:29 [Qemu-devel] [PULL] VirtFS update Aneesh Kumar K.V
@ 2015-06-16 15:29 ` Aneesh Kumar K.V
2015-06-16 15:29 ` [Qemu-devel] [PATCH 2/2] virtfs-proxy-helper: fail gracefully if socket path is too long Aneesh Kumar K.V
2015-06-17 11:26 ` [Qemu-devel] [PULL] VirtFS update Peter Maydell
2 siblings, 0 replies; 5+ messages in thread
From: Aneesh Kumar K.V @ 2015-06-16 15:29 UTC (permalink / raw)
To: anthony, peter.maydell; +Cc: qemu-devel, Stefan Hajnoczi, Aneesh Kumar K.V
From: Stefan Hajnoczi <stefanha@redhat.com>
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)
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
fsdev/virtfs-proxy-helper.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
index a698e2dbb37b..91e8b9b7f1cf 100644
--- a/fsdev/virtfs-proxy-helper.c
+++ b/fsdev/virtfs-proxy-helper.c
@@ -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;
--
2.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 2/2] virtfs-proxy-helper: fail gracefully if socket path is too long
2015-06-16 15:29 [Qemu-devel] [PULL] VirtFS update Aneesh Kumar K.V
2015-06-16 15:29 ` [Qemu-devel] [PATCH 1/2] virtfs-proxy-helper: add missing long option terminator Aneesh Kumar K.V
@ 2015-06-16 15:29 ` Aneesh Kumar K.V
2015-06-17 11:26 ` [Qemu-devel] [PULL] VirtFS update Peter Maydell
2 siblings, 0 replies; 5+ messages in thread
From: Aneesh Kumar K.V @ 2015-06-16 15:29 UTC (permalink / raw)
To: anthony, peter.maydell
Cc: Aneesh Kumar K.V, qemu-devel, Stefan Hajnoczi, Shannon Zhao
From: Stefan Hajnoczi <stefanha@redhat.com>
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.
Cc: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
fsdev/virtfs-proxy-helper.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
index 91e8b9b7f1cf..9097d15c989c 100644
--- a/fsdev/virtfs-proxy-helper.c
+++ b/fsdev/virtfs-proxy-helper.c
@@ -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");
--
2.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PULL] VirtFS update
2015-06-16 15:29 [Qemu-devel] [PULL] VirtFS update Aneesh Kumar K.V
2015-06-16 15:29 ` [Qemu-devel] [PATCH 1/2] virtfs-proxy-helper: add missing long option terminator Aneesh Kumar K.V
2015-06-16 15:29 ` [Qemu-devel] [PATCH 2/2] virtfs-proxy-helper: fail gracefully if socket path is too long Aneesh Kumar K.V
@ 2015-06-17 11:26 ` Peter Maydell
2 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2015-06-17 11:26 UTC (permalink / raw)
To: Aneesh Kumar K.V; +Cc: QEMU Developers, Anthony Liguori
On 16 June 2015 at 16:29, Aneesh Kumar K.V
<aneesh.kumar@linux.vnet.ibm.com> wrote:
> The following changes since commit 93f6d1c16036aaf34055d16f54ea770fb8d6d280:
>
> Merge remote-tracking branch 'remotes/kraxel/tags/pull-vga-20150615-1' into staging (2015-06-16 10:35:43 +0100)
>
> are available in the git repository at:
>
> https://github.com/kvaneesh/qemu.git tags/for-upstream-signed
>
> for you to fetch changes up to f8d30a4f96d6c3a12e692d2e69b8fe4734b916c6:
>
> virtfs-proxy-helper: fail gracefully if socket path is too long (2015-06-16 20:32:29 +0530)
>
> ----------------------------------------------------------------
> VirtFS update:
>
> * Fix for virtfs-proxy-helper crash
> * Gracefully handle the error condition on input validation in virtfs-proxy-helper
>
> ----------------------------------------------------------------
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 0/2] virtfs-proxy-helper: small fixes
@ 2015-03-30 13:57 Stefan Hajnoczi
2015-03-30 13:57 ` [Qemu-devel] [PATCH 2/2] virtfs-proxy-helper: fail gracefully if socket path is too long Stefan Hajnoczi
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Hajnoczi @ 2015-03-30 13:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Aneesh Kumar K.V, 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(-)
--
2.1.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 2/2] virtfs-proxy-helper: fail gracefully if socket path is too long
2015-03-30 13:57 [Qemu-devel] [PATCH 0/2] virtfs-proxy-helper: small fixes Stefan Hajnoczi
@ 2015-03-30 13:57 ` Stefan Hajnoczi
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2015-03-30 13:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Aneesh Kumar K.V, Stefan Hajnoczi, Shannon Zhao
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.
Cc: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
fsdev/virtfs-proxy-helper.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
index 91e8b9b..9097d15 100644
--- a/fsdev/virtfs-proxy-helper.c
+++ b/fsdev/virtfs-proxy-helper.c
@@ -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");
--
2.1.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-06-17 11:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-16 15:29 [Qemu-devel] [PULL] VirtFS update Aneesh Kumar K.V
2015-06-16 15:29 ` [Qemu-devel] [PATCH 1/2] virtfs-proxy-helper: add missing long option terminator Aneesh Kumar K.V
2015-06-16 15:29 ` [Qemu-devel] [PATCH 2/2] virtfs-proxy-helper: fail gracefully if socket path is too long Aneesh Kumar K.V
2015-06-17 11:26 ` [Qemu-devel] [PULL] VirtFS update Peter Maydell
-- strict thread matches above, loose matches on Subject: below --
2015-03-30 13:57 [Qemu-devel] [PATCH 0/2] virtfs-proxy-helper: small fixes Stefan Hajnoczi
2015-03-30 13:57 ` [Qemu-devel] [PATCH 2/2] virtfs-proxy-helper: fail gracefully if socket path is too long Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).