* [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 1/2] virtfs-proxy-helper: add missing long option terminator Stefan Hajnoczi
` (2 more replies)
0 siblings, 3 replies; 8+ 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] 8+ messages in thread
* [Qemu-devel] [PATCH 1/2] virtfs-proxy-helper: add missing long option terminator
2015-03-30 13:57 [Qemu-devel] [PATCH 0/2] virtfs-proxy-helper: small fixes Stefan Hajnoczi
@ 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
2015-04-20 13:25 ` [Qemu-devel] [PATCH 0/2] virtfs-proxy-helper: small fixes Stefan Hajnoczi
2 siblings, 0 replies; 8+ messages in thread
From: Stefan Hajnoczi @ 2015-03-30 13:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Aneesh Kumar K.V, 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)
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.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 a698e2d..91e8b9b 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.0
^ permalink raw reply related [flat|nested] 8+ 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 ` [Qemu-devel] [PATCH 1/2] virtfs-proxy-helper: add missing long option terminator Stefan Hajnoczi
@ 2015-03-30 13:57 ` Stefan Hajnoczi
2015-04-20 13:25 ` [Qemu-devel] [PATCH 0/2] virtfs-proxy-helper: small fixes Stefan Hajnoczi
2 siblings, 0 replies; 8+ 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] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] virtfs-proxy-helper: small fixes
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 1/2] virtfs-proxy-helper: add missing long option terminator 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
@ 2015-04-20 13:25 ` Stefan Hajnoczi
2015-04-23 7:48 ` Aneesh Kumar K.V
2 siblings, 1 reply; 8+ messages in thread
From: Stefan Hajnoczi @ 2015-04-20 13:25 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: qemu-devel, Aneesh Kumar K.V
[-- Attachment #1: Type: text/plain, Size: 450 bytes --]
On Mon, Mar 30, 2015 at 02:57:14PM +0100, Stefan Hajnoczi wrote:
> 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?
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] virtfs-proxy-helper: small fixes
2015-04-20 13:25 ` [Qemu-devel] [PATCH 0/2] virtfs-proxy-helper: small fixes Stefan Hajnoczi
@ 2015-04-23 7:48 ` Aneesh Kumar K.V
2015-04-23 8:45 ` Aneesh Kumar K.V
0 siblings, 1 reply; 8+ messages in thread
From: Aneesh Kumar K.V @ 2015-04-23 7:48 UTC (permalink / raw)
To: Stefan Hajnoczi, Stefan Hajnoczi; +Cc: qemu-devel
Stefan Hajnoczi <stefanha@gmail.com> writes:
> On Mon, Mar 30, 2015 at 02:57:14PM +0100, Stefan Hajnoczi wrote:
>> 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?
Applied.
-aneesh
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] virtfs-proxy-helper: small fixes
2015-04-23 7:48 ` Aneesh Kumar K.V
@ 2015-04-23 8:45 ` Aneesh Kumar K.V
2015-04-24 8:32 ` Stefan Hajnoczi
0 siblings, 1 reply; 8+ messages in thread
From: Aneesh Kumar K.V @ 2015-04-23 8:45 UTC (permalink / raw)
To: Stefan Hajnoczi, Stefan Hajnoczi; +Cc: qemu-devel
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> writes:
> Stefan Hajnoczi <stefanha@gmail.com> writes:
>
>> On Mon, Mar 30, 2015 at 02:57:14PM +0100, Stefan Hajnoczi wrote:
>>> 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] virtfs-proxy-helper: small fixes
2015-04-23 8:45 ` Aneesh Kumar K.V
@ 2015-04-24 8:32 ` Stefan Hajnoczi
0 siblings, 0 replies; 8+ messages in thread
From: Stefan Hajnoczi @ 2015-04-24 8:32 UTC (permalink / raw)
To: Aneesh Kumar K.V; +Cc: qemu-devel, Stefan Hajnoczi
[-- Attachment #1: Type: text/plain, Size: 776 bytes --]
On Thu, Apr 23, 2015 at 02:15:26PM +0530, Aneesh Kumar K.V wrote:
> "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> writes:
>
> > Stefan Hajnoczi <stefanha@gmail.com> writes:
> >
> >> On Mon, Mar 30, 2015 at 02:57:14PM +0100, Stefan Hajnoczi wrote:
> >>> 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
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
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 8+ 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 ` Aneesh Kumar K.V
0 siblings, 0 replies; 8+ 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] 8+ messages in thread
end of thread, other threads:[~2015-06-16 15:30 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 1/2] virtfs-proxy-helper: add missing long option terminator 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
2015-04-20 13:25 ` [Qemu-devel] [PATCH 0/2] virtfs-proxy-helper: small fixes Stefan Hajnoczi
2015-04-23 7:48 ` Aneesh Kumar K.V
2015-04-23 8:45 ` Aneesh Kumar K.V
2015-04-24 8:32 ` Stefan Hajnoczi
-- strict thread matches above, loose matches on Subject: below --
2015-06-16 15:29 [Qemu-devel] [PULL] VirtFS update 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
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).