* [dpdk-dev] [PATCH] net/virtio: fix of untrusted scalar value
@ 2017-09-20 9:19 Daniel Mrzyglod
2017-09-20 9:31 ` Mrzyglod, DanielX T
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Daniel Mrzyglod @ 2017-09-20 9:19 UTC (permalink / raw)
To: yliu; +Cc: dev, Daniel Mrzyglod, jianfeng.tan
The unscrutinized value may be incorrectly assumed to be within a certain
range by later operations.
In vhost_user_read: An unscrutinized value from an untrusted source used
in a trusted context - the value of sz_payload may be harmfull and we need
limit them to the max value of payload.
Fixes: 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")
Cc: jianfeng.tan@intel.com
Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
---
drivers/net/virtio/virtio_user/vhost_user.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c
index 4ad7b21..b490336 100644
--- a/drivers/net/virtio/virtio_user/vhost_user.c
+++ b/drivers/net/virtio/virtio_user/vhost_user.c
@@ -130,6 +130,10 @@ vhost_user_read(int fd, struct vhost_user_msg *msg)
}
sz_payload = msg->size;
+
+ if (sz_payload > sizeof(msg->payload))
+ goto fail;
+
if (sz_payload) {
ret = recv(fd, (void *)((char *)msg + sz_hdr), sz_payload, 0);
if (ret < sz_payload) {
--
2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH] net/virtio: fix of untrusted scalar value
2017-09-20 9:19 [dpdk-dev] [PATCH] net/virtio: fix of untrusted scalar value Daniel Mrzyglod
@ 2017-09-20 9:31 ` Mrzyglod, DanielX T
2017-09-20 9:38 ` Tan, Jianfeng
2017-09-20 13:25 ` [dpdk-dev] [PATCH v2] " Daniel Mrzyglod
2 siblings, 0 replies; 6+ messages in thread
From: Mrzyglod, DanielX T @ 2017-09-20 9:31 UTC (permalink / raw)
To: yliu; +Cc: dev, Tan, Jianfeng
This patch is for Coverity issue: 139601
Does it need v2 for updating Message Body ?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH] net/virtio: fix of untrusted scalar value
2017-09-20 9:19 [dpdk-dev] [PATCH] net/virtio: fix of untrusted scalar value Daniel Mrzyglod
2017-09-20 9:31 ` Mrzyglod, DanielX T
@ 2017-09-20 9:38 ` Tan, Jianfeng
2017-09-20 13:25 ` [dpdk-dev] [PATCH v2] " Daniel Mrzyglod
2 siblings, 0 replies; 6+ messages in thread
From: Tan, Jianfeng @ 2017-09-20 9:38 UTC (permalink / raw)
To: Mrzyglod, DanielX T, yliu; +Cc: dev
Hi,
> -----Original Message-----
> From: Mrzyglod, DanielX T
> Sent: Wednesday, September 20, 2017 5:19 PM
> To: yliu@fridaylinux.org
> Cc: dev@dpdk.org; Mrzyglod, DanielX T; Tan, Jianfeng
> Subject: [PATCH] net/virtio: fix of untrusted scalar value
>
> The unscrutinized value may be incorrectly assumed to be within a certain
> range by later operations.
>
> In vhost_user_read: An unscrutinized value from an untrusted source used
> in a trusted context - the value of sz_payload may be harmfull and we need
> limit them to the max value of payload.
Please add below line.
Coverity issue: 139601
>
> Fixes: 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")
> Cc: jianfeng.tan@intel.com
>
> Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
Thanks,
Jianfeng
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH v2] net/virtio: fix of untrusted scalar value
2017-09-20 9:19 [dpdk-dev] [PATCH] net/virtio: fix of untrusted scalar value Daniel Mrzyglod
2017-09-20 9:31 ` Mrzyglod, DanielX T
2017-09-20 9:38 ` Tan, Jianfeng
@ 2017-09-20 13:25 ` Daniel Mrzyglod
2017-09-22 15:21 ` [dpdk-dev] [PATCH v3] " Daniel Mrzyglod
2 siblings, 1 reply; 6+ messages in thread
From: Daniel Mrzyglod @ 2017-09-20 13:25 UTC (permalink / raw)
To: yliu; +Cc: dev, Daniel Mrzyglod, jianfeng.tan, stable
The unscrutinized value may be incorrectly assumed to be within a certain
range by later operations.
In vhost_user_read: An unscrutinized value from an untrusted source used
in a trusted context - the value of sz_payload may be harmfull and we need
limit them to the max value of payload.
Coverity issue: 139601
Fixes: 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")
Cc: jianfeng.tan@intel.com
Cc: stable@stable@dpdk.org
Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
---
v2:
* Add Cc for stable in gitlog massage
* Add Coverity line
* v1 was acked by Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
drivers/net/virtio/virtio_user/vhost_user.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c
index 4ad7b21..b490336 100644
--- a/drivers/net/virtio/virtio_user/vhost_user.c
+++ b/drivers/net/virtio/virtio_user/vhost_user.c
@@ -130,6 +130,10 @@ vhost_user_read(int fd, struct vhost_user_msg *msg)
}
sz_payload = msg->size;
+
+ if (sz_payload > sizeof(msg->payload))
+ goto fail;
+
if (sz_payload) {
ret = recv(fd, (void *)((char *)msg + sz_hdr), sz_payload, 0);
if (ret < sz_payload) {
--
2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH v3] net/virtio: fix of untrusted scalar value
2017-09-20 13:25 ` [dpdk-dev] [PATCH v2] " Daniel Mrzyglod
@ 2017-09-22 15:21 ` Daniel Mrzyglod
2017-09-27 9:25 ` Yuanhan Liu
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Mrzyglod @ 2017-09-22 15:21 UTC (permalink / raw)
To: yliu; +Cc: dev, Daniel Mrzyglod, jianfeng.tan, stable
The unscrutinized value may be incorrectly assumed to be within a certain
range by later operations.
In vhost_user_read: An unscrutinized value from an untrusted source used
in a trusted context - the value of sz_payload may be harmfull and we need
limit them to the max value of payload.
Coverity issue: 139601
Fixes: 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")
Cc: jianfeng.tan@intel.com
Cc: stable@dpdk.org
Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
---
v3:
* there were wrong v2 email adress for stable dpdk mailinglist
* fix compilation errors
v2:
* Add Cc for stable in gitlog massage
* Add Coverity line
* v1 was acked by Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
drivers/net/virtio/virtio_user/vhost_user.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c
index 4ad7b21..97bd832 100644
--- a/drivers/net/virtio/virtio_user/vhost_user.c
+++ b/drivers/net/virtio/virtio_user/vhost_user.c
@@ -130,6 +130,10 @@ vhost_user_read(int fd, struct vhost_user_msg *msg)
}
sz_payload = msg->size;
+
+ if ((size_t)sz_payload > sizeof(msg->payload))
+ goto fail;
+
if (sz_payload) {
ret = recv(fd, (void *)((char *)msg + sz_hdr), sz_payload, 0);
if (ret < sz_payload) {
--
2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH v3] net/virtio: fix of untrusted scalar value
2017-09-22 15:21 ` [dpdk-dev] [PATCH v3] " Daniel Mrzyglod
@ 2017-09-27 9:25 ` Yuanhan Liu
0 siblings, 0 replies; 6+ messages in thread
From: Yuanhan Liu @ 2017-09-27 9:25 UTC (permalink / raw)
To: Daniel Mrzyglod; +Cc: dev, jianfeng.tan, stable
On Fri, Sep 22, 2017 at 05:21:49PM +0200, Daniel Mrzyglod wrote:
> The unscrutinized value may be incorrectly assumed to be within a certain
> range by later operations.
>
> In vhost_user_read: An unscrutinized value from an untrusted source used
> in a trusted context - the value of sz_payload may be harmfull and we need
> limit them to the max value of payload.
>
> Coverity issue: 139601
>
> Fixes: 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")
> Cc: jianfeng.tan@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
FYI, you should put the Ack from Jianfeng here, so that it will be
there when I apply your patch. Otherwise, I have to add it back manually.
But never mind, I have done it this time. So, applied to dpdk-next-virtio.
Thanks.
--yliu
> ---
> v3:
> * there were wrong v2 email adress for stable dpdk mailinglist
> * fix compilation errors
>
> v2:
> * Add Cc for stable in gitlog massage
> * Add Coverity line
> * v1 was acked by Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
>
>
> drivers/net/virtio/virtio_user/vhost_user.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c
> index 4ad7b21..97bd832 100644
> --- a/drivers/net/virtio/virtio_user/vhost_user.c
> +++ b/drivers/net/virtio/virtio_user/vhost_user.c
> @@ -130,6 +130,10 @@ vhost_user_read(int fd, struct vhost_user_msg *msg)
> }
>
> sz_payload = msg->size;
> +
> + if ((size_t)sz_payload > sizeof(msg->payload))
> + goto fail;
> +
> if (sz_payload) {
> ret = recv(fd, (void *)((char *)msg + sz_hdr), sz_payload, 0);
> if (ret < sz_payload) {
> --
> 2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-09-27 9:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-20 9:19 [dpdk-dev] [PATCH] net/virtio: fix of untrusted scalar value Daniel Mrzyglod
2017-09-20 9:31 ` Mrzyglod, DanielX T
2017-09-20 9:38 ` Tan, Jianfeng
2017-09-20 13:25 ` [dpdk-dev] [PATCH v2] " Daniel Mrzyglod
2017-09-22 15:21 ` [dpdk-dev] [PATCH v3] " Daniel Mrzyglod
2017-09-27 9:25 ` Yuanhan Liu
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).