vhost: block speculation of translated descriptors
Subsystems (5)
Michael S. Tsirkin
maintainerPATCH v2 1/1 vhost: block speculation of translated descriptors
iovec addresses coming from vhost are assumed to be pre-validated, but in fact can be speculated to a value out of range.
Userspace address are later validated with array_index_nospec so we can be sure kernel info does not leak through these addresses, but vhost must also not leak userspace info outside the allowed memory table to guests.
Following the defence in depth principle, make sure the address is not validated out of node range.
---
changes from v1: fix build on 32 bit
drivers/vhost/vhost.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/vhost/vhost.c +4 -2
@@ -2071,8 +2071,10 @@ static int translate_desc(struct vhost_virtqueue *vq, u64 addr, u32 len, _iov = iov + ret; size = node->size - addr + node->start; _iov->iov_len =min ((u64 )len - s, size); - _iov->iov_base = (void __user *)(unsigned long ) - (node->userspace_addr + addr - node->start); + _iov->iov_base = (void __user *) + ((unsigned long )node->userspace_addr + +array_index_nospec ((unsigned long )(addr - node->start), + node->size)); s += size; addr += size; ++ret;
Signature · 1 line
MST
Quoted 9 lines · Michael S. Tsirkin
iovec addresses coming from vhost are assumed to be pre-validated, but in fact can be speculated to a value out of range.
Userspace address are later validated with
array_index_nospecso we can be sure kernel info does not leak through these addresses, but vhost must also not leak userspace info outside the allowed memory table to guests.
Quoted 6 lines
Following the defence in depth principle, make sure the address is not validated out of node range.
Signed-off-by Michael S. Tsirkin <[email protected]>Acked-by Jason Wang <[email protected]>Tested-by Jason Wang <[email protected]>
no need to mark fo stable? Other spectre fixes tend to be backported even when the security implications are not really clear. The risk should be low and better to be covered in case.
Quoted 26 lines
---
changes from v1: fix build on 32 bit
drivers/vhost/vhost.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/vhost/vhost.c +4
-2@@ -2071,8 +2071,10 @@ static int translate_desc(struct vhost_virtqueue *vq, u64 addr, u32 len, _iov = iov + ret; size = node->size - addr + node->start; _iov->iov_len =min ((u64 )len - s, size); - _iov->iov_base = (void __user *)(unsigned long ) - (node->userspace_addr + addr - node->start); + _iov->iov_base = (void __user *) + ((unsigned long )node->userspace_addr + +array_index_nospec ((unsigned long )(addr - node->start), + node->size)); s += size; addr += size; ++ret;Signature · 1 line
MST
Signature · 2 lines
Michal Hocko SUSE Labs
Michael S. Tsirkin
maintainerQuoted 13 lines · Michal Hocko
Quoted 12 lines · Michael S. Tsirkin
iovec addresses coming from vhost are assumed to be pre-validated, but in fact can be speculated to a value out of range.
Userspace address are later validated with
array_index_nospecso we can be sure kernel info does not leak through these addresses, but vhost must also not leak userspace info outside the allowed memory table to guests.Following the defence in depth principle, make sure the address is not validated out of node range.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Michael S. Tsirkin <[email protected]>Acked-by Jason Wang <[email protected]>Tested-by Jason Wang <[email protected]>no need to mark fo stable? Other spectre fixes tend to be backported even when the security implications are not really clear. The risk should be low and better to be covered in case.
This is not really a fix - more a defence in depth thing, quite similar to e.g. commit b3bbfb3fb5d25776b8e3f361d2eedaabb0b496cd
x86: Introduce __uaccess_begin_nospec() and uaccess_try_nospec in scope.
That one doesn't seem to be tagged for stable. Was it queued there in practice?
Quoted 30 lines
Quoted 26 lines
---
changes from v1: fix build on 32 bit
drivers/vhost/vhost.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/vhost/vhost.c +4
-2@@ -2071,8 +2071,10 @@ static int translate_desc(struct vhost_virtqueue *vq, u64 addr, u32 len, _iov = iov + ret; size = node->size - addr + node->start; _iov->iov_len =min ((u64 )len - s, size); - _iov->iov_base = (void __user *)(unsigned long ) - (node->userspace_addr + addr - node->start); + _iov->iov_base = (void __user *) + ((unsigned long )node->userspace_addr + +array_index_nospec ((unsigned long )(addr - node->start), + node->size)); s += size; addr += size; ++ret;Signature · 1 line
MSTSignature · 2 lines
Michal Hocko SUSE Labs
Michael S. Tsirkin
maintainerQuoted 13 lines · Michal Hocko
Quoted 12 lines · Michael S. Tsirkin
iovec addresses coming from vhost are assumed to be pre-validated, but in fact can be speculated to a value out of range.
Userspace address are later validated with
array_index_nospecso we can be sure kernel info does not leak through these addresses, but vhost must also not leak userspace info outside the allowed memory table to guests.Following the defence in depth principle, make sure the address is not validated out of node range.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Michael S. Tsirkin <[email protected]>Acked-by Jason Wang <[email protected]>Tested-by Jason Wang <[email protected]>no need to mark fo stable? Other spectre fixes tend to be backported even when the security implications are not really clear. The risk should be low and better to be covered in case.
This is not really a fix - more a defence in depth thing, quite similar to e.g. commit b3bbfb3fb5d25776b8e3f361d2eedaabb0b496cd
x86: Introduce __uaccess_begin_nospec() and uaccess_try_nospec in scope.
That one doesn't seem to be tagged for stable. Was it queued there in practice?
Quoted 30 lines
Quoted 26 lines
---
changes from v1: fix build on 32 bit
drivers/vhost/vhost.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/vhost/vhost.c +4
-2@@ -2071,8 +2071,10 @@ static int translate_desc(struct vhost_virtqueue *vq, u64 addr, u32 len, _iov = iov + ret; size = node->size - addr + node->start; _iov->iov_len =min ((u64 )len - s, size); - _iov->iov_base = (void __user *)(unsigned long ) - (node->userspace_addr + addr - node->start); + _iov->iov_base = (void __user *) + ((unsigned long )node->userspace_addr + +array_index_nospec ((unsigned long )(addr - node->start), + node->size)); s += size; addr += size; ++ret;Signature · 1 line
MSTSignature · 2 lines
Michal Hocko SUSE Labs
Quoted 22 lines · Michael S. Tsirkin
Quoted 13 lines · Michal Hocko
Quoted 12 lines · Michael S. Tsirkin
iovec addresses coming from vhost are assumed to be pre-validated, but in fact can be speculated to a value out of range.
Userspace address are later validated with
array_index_nospecso we can be sure kernel info does not leak through these addresses, but vhost must also not leak userspace info outside the allowed memory table to guests.Following the defence in depth principle, make sure the address is not validated out of node range.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Michael S. Tsirkin <[email protected]>Acked-by Jason Wang <[email protected]>Tested-by Jason Wang <[email protected]>no need to mark fo stable? Other spectre fixes tend to be backported even when the security implications are not really clear. The risk should be low and better to be covered in case.
Quoted 7 lines
This is not really a fix - more a defence in depth thing, quite similar to e.g. commit
b3bbfb3fb5d25776b8e3f361d2eedaabb0b496cd
x86: Introduce__uaccess_begin_nospec()anduaccess_try_nospecin scope.That one doesn't seem to be tagged for stable. Was it queued there in practice?
not marked for stable but it went in. At least to 4.4.
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 22 lines · Michael S. Tsirkin
Quoted 13 lines · Michal Hocko
Quoted 12 lines · Michael S. Tsirkin
iovec addresses coming from vhost are assumed to be pre-validated, but in fact can be speculated to a value out of range.
Userspace address are later validated with
array_index_nospecso we can be sure kernel info does not leak through these addresses, but vhost must also not leak userspace info outside the allowed memory table to guests.Following the defence in depth principle, make sure the address is not validated out of node range.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Michael S. Tsirkin <[email protected]>Acked-by Jason Wang <[email protected]>Tested-by Jason Wang <[email protected]>no need to mark fo stable? Other spectre fixes tend to be backported even when the security implications are not really clear. The risk should be low and better to be covered in case.
Quoted 7 lines
This is not really a fix - more a defence in depth thing, quite similar to e.g. commit
b3bbfb3fb5d25776b8e3f361d2eedaabb0b496cd
x86: Introduce__uaccess_begin_nospec()anduaccess_try_nospecin scope.That one doesn't seem to be tagged for stable. Was it queued there in practice?
not marked for stable but it went in. At least to 4.4.
Signature · 2 lines
Michal Hocko SUSE Labs
Michael S. Tsirkin
maintainerQuoted 28 lines · Michal Hocko
Quoted 27 lines · Michael S. Tsirkin
Quoted 13 lines · Michal Hocko
Quoted 12 lines · Michael S. Tsirkin
iovec addresses coming from vhost are assumed to be pre-validated, but in fact can be speculated to a value out of range.
Userspace address are later validated with
array_index_nospecso we can be sure kernel info does not leak through these addresses, but vhost must also not leak userspace info outside the allowed memory table to guests.Following the defence in depth principle, make sure the address is not validated out of node range.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Michael S. Tsirkin <[email protected]>Acked-by Jason Wang <[email protected]>Tested-by Jason Wang <[email protected]>no need to mark fo stable? Other spectre fixes tend to be backported even when the security implications are not really clear. The risk should be low and better to be covered in case.
This is not really a fix - more a defence in depth thing, quite similar to e.g. commit
b3bbfb3fb5d25776b8e3f361d2eedaabb0b496cd
x86: Introduce__uaccess_begin_nospec()anduaccess_try_nospecin scope.
Quoted 4 lines
Quoted 2 lines
That one doesn't seem to be tagged for stable. Was it queued there in practice?
not marked for stable but it went in. At least to 4.4.
So I guess the answer is I don't know. If you feel it's justified, then sure, feel free to forward.
Signature · 1 line
MST
Michael S. Tsirkin
maintainerQuoted 28 lines · Michal Hocko
Quoted 27 lines · Michael S. Tsirkin
Quoted 13 lines · Michal Hocko
Quoted 12 lines · Michael S. Tsirkin
iovec addresses coming from vhost are assumed to be pre-validated, but in fact can be speculated to a value out of range.
Userspace address are later validated with
array_index_nospecso we can be sure kernel info does not leak through these addresses, but vhost must also not leak userspace info outside the allowed memory table to guests.Following the defence in depth principle, make sure the address is not validated out of node range.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Michael S. Tsirkin <[email protected]>Acked-by Jason Wang <[email protected]>Tested-by Jason Wang <[email protected]>no need to mark fo stable? Other spectre fixes tend to be backported even when the security implications are not really clear. The risk should be low and better to be covered in case.
This is not really a fix - more a defence in depth thing, quite similar to e.g. commit
b3bbfb3fb5d25776b8e3f361d2eedaabb0b496cd
x86: Introduce__uaccess_begin_nospec()anduaccess_try_nospecin scope.
Quoted 4 lines
Quoted 2 lines
That one doesn't seem to be tagged for stable. Was it queued there in practice?
not marked for stable but it went in. At least to 4.4.
So I guess the answer is I don't know. If you feel it's justified, then sure, feel free to forward.
Signature · 1 line
MST
Quoted 29 lines · Michael S. Tsirkin
Quoted 28 lines · Michal Hocko
Quoted 27 lines · Michael S. Tsirkin
Quoted 13 lines · Michal Hocko
Quoted 12 lines · Michael S. Tsirkin
iovec addresses coming from vhost are assumed to be pre-validated, but in fact can be speculated to a value out of range.
Userspace address are later validated with
array_index_nospecso we can be sure kernel info does not leak through these addresses, but vhost must also not leak userspace info outside the allowed memory table to guests.Following the defence in depth principle, make sure the address is not validated out of node range.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Michael S. Tsirkin <[email protected]>Acked-by Jason Wang <[email protected]>Tested-by Jason Wang <[email protected]>no need to mark fo stable? Other spectre fixes tend to be backported even when the security implications are not really clear. The risk should be low and better to be covered in case.
This is not really a fix - more a defence in depth thing, quite similar to e.g. commit
b3bbfb3fb5d25776b8e3f361d2eedaabb0b496cd
x86: Introduce__uaccess_begin_nospec()anduaccess_try_nospecin scope.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
That one doesn't seem to be tagged for stable. Was it queued there in practice?
not marked for stable but it went in. At least to 4.4.
So I guess the answer is I don't know. If you feel it's justified, then sure, feel free to forward.
Well, that obviously depends on you as a maintainer but the point is that spectre gatgets are quite hard to find. There is a smack check AFAIK but that generates quite some false possitives and it is PITA to crawl through those. If you want an interesting (I am not saying vulnerable on purpose) gatget then it would be great to mark it for stable so all stable consumers (disclaimer: I am not one of those) and add that really great feeling of safety ;)
So take this as my 2c
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 29 lines · Michael S. Tsirkin
Quoted 28 lines · Michal Hocko
Quoted 27 lines · Michael S. Tsirkin
Quoted 13 lines · Michal Hocko
Quoted 12 lines · Michael S. Tsirkin
iovec addresses coming from vhost are assumed to be pre-validated, but in fact can be speculated to a value out of range.
Userspace address are later validated with
array_index_nospecso we can be sure kernel info does not leak through these addresses, but vhost must also not leak userspace info outside the allowed memory table to guests.Following the defence in depth principle, make sure the address is not validated out of node range.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Michael S. Tsirkin <[email protected]>Acked-by Jason Wang <[email protected]>Tested-by Jason Wang <[email protected]>no need to mark fo stable? Other spectre fixes tend to be backported even when the security implications are not really clear. The risk should be low and better to be covered in case.
This is not really a fix - more a defence in depth thing, quite similar to e.g. commit
b3bbfb3fb5d25776b8e3f361d2eedaabb0b496cd
x86: Introduce__uaccess_begin_nospec()anduaccess_try_nospecin scope.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
That one doesn't seem to be tagged for stable. Was it queued there in practice?
not marked for stable but it went in. At least to 4.4.
So I guess the answer is I don't know. If you feel it's justified, then sure, feel free to forward.
Well, that obviously depends on you as a maintainer but the point is that spectre gatgets are quite hard to find. There is a smack check AFAIK but that generates quite some false possitives and it is PITA to crawl through those. If you want an interesting (I am not saying vulnerable on purpose) gatget then it would be great to mark it for stable so all stable consumers (disclaimer: I am not one of those) and add that really great feeling of safety ;)
So take this as my 2c
Signature · 2 lines
Michal Hocko SUSE Labs
Michael S. Tsirkin
maintainerQuoted 46 lines · Michal Hocko
Quoted 29 lines · Michael S. Tsirkin
Quoted 28 lines · Michal Hocko
Quoted 27 lines · Michael S. Tsirkin
Quoted 13 lines · Michal Hocko
Quoted 12 lines · Michael S. Tsirkin
iovec addresses coming from vhost are assumed to be pre-validated, but in fact can be speculated to a value out of range.
Userspace address are later validated with
array_index_nospecso we can be sure kernel info does not leak through these addresses, but vhost must also not leak userspace info outside the allowed memory table to guests.Following the defence in depth principle, make sure the address is not validated out of node range.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Michael S. Tsirkin <[email protected]>Acked-by Jason Wang <[email protected]>Tested-by Jason Wang <[email protected]>no need to mark fo stable? Other spectre fixes tend to be backported even when the security implications are not really clear. The risk should be low and better to be covered in case.
This is not really a fix - more a defence in depth thing, quite similar to e.g. commit
b3bbfb3fb5d25776b8e3f361d2eedaabb0b496cd
x86: Introduce__uaccess_begin_nospec()anduaccess_try_nospecin scope.Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
That one doesn't seem to be tagged for stable. Was it queued there in practice?
not marked for stable but it went in. At least to 4.4.
So I guess the answer is I don't know. If you feel it's justified, then sure, feel free to forward.
Well, that obviously depends on you as a maintainer but the point is that spectre gatgets are quite hard to find. There is a smack check AFAIK but that generates quite some false possitives and it is PITA to crawl through those. If you want an interesting (I am not saying vulnerable on purpose) gatget then it would be great to mark it for stable so all stable consumers (disclaimer: I am not one of those) and add that really great feeling of safety ;)
Quoted 1 line
So take this as my 2c
OK it seems [email protected] is the way to handle these things. I'll try that.
Quoted 3 lines
Signature · 2 lines
Michal Hocko SUSE Labs
Michael S. Tsirkin
maintainerQuoted 46 lines · Michal Hocko
Quoted 29 lines · Michael S. Tsirkin
Quoted 28 lines · Michal Hocko
Quoted 27 lines · Michael S. Tsirkin
Quoted 13 lines · Michal Hocko
Quoted 12 lines · Michael S. Tsirkin
iovec addresses coming from vhost are assumed to be pre-validated, but in fact can be speculated to a value out of range.
Userspace address are later validated with
array_index_nospecso we can be sure kernel info does not leak through these addresses, but vhost must also not leak userspace info outside the allowed memory table to guests.Following the defence in depth principle, make sure the address is not validated out of node range.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Michael S. Tsirkin <[email protected]>Acked-by Jason Wang <[email protected]>Tested-by Jason Wang <[email protected]>no need to mark fo stable? Other spectre fixes tend to be backported even when the security implications are not really clear. The risk should be low and better to be covered in case.
This is not really a fix - more a defence in depth thing, quite similar to e.g. commit
b3bbfb3fb5d25776b8e3f361d2eedaabb0b496cd
x86: Introduce__uaccess_begin_nospec()anduaccess_try_nospecin scope.Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
That one doesn't seem to be tagged for stable. Was it queued there in practice?
not marked for stable but it went in. At least to 4.4.
So I guess the answer is I don't know. If you feel it's justified, then sure, feel free to forward.
Well, that obviously depends on you as a maintainer but the point is that spectre gatgets are quite hard to find. There is a smack check AFAIK but that generates quite some false possitives and it is PITA to crawl through those. If you want an interesting (I am not saying vulnerable on purpose) gatget then it would be great to mark it for stable so all stable consumers (disclaimer: I am not one of those) and add that really great feeling of safety ;)
Quoted 1 line
So take this as my 2c
OK it seems [email protected] is the way to handle these things. I'll try that.
Quoted 3 lines
Signature · 2 lines
Michal Hocko SUSE Labs
Michael S. Tsirkin
maintainerQuoted 9 lines · Michael S. Tsirkin
iovec addresses coming from vhost are assumed to be pre-validated, but in fact can be speculated to a value out of range.
Userspace address are later validated with
array_index_nospecso we can be sure kernel info does not leak through these addresses, but vhost must also not leak userspace info outside the allowed memory table to guests.
Quoted 7 lines
Following the defence in depth principle, make sure the address is not validated out of node range.
Signed-off-by Michael S. Tsirkin <[email protected]>Acked-by Jason Wang <[email protected]>Tested-by Jason Wang <[email protected]>---
Pls advise on whether you'd like me to merge this directly, Cc stable, or handle it in some other way.
Quoted 24 lines
changes from v1: fix build on 32 bit
drivers/vhost/vhost.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/vhost/vhost.c +4
-2@@ -2071,8 +2071,10 @@ static int translate_desc(struct vhost_virtqueue *vq, u64 addr, u32 len, _iov = iov + ret; size = node->size - addr + node->start; _iov->iov_len =min ((u64 )len - s, size); - _iov->iov_base = (void __user *)(unsigned long ) - (node->userspace_addr + addr - node->start); + _iov->iov_base = (void __user *) + ((unsigned long )node->userspace_addr + +array_index_nospec ((unsigned long )(addr - node->start), + node->size)); s += size; addr += size; ++ret;Signature · 1 line
MST
Michael S. Tsirkin
maintainerQuoted 9 lines · Michael S. Tsirkin
iovec addresses coming from vhost are assumed to be pre-validated, but in fact can be speculated to a value out of range.
Userspace address are later validated with
array_index_nospecso we can be sure kernel info does not leak through these addresses, but vhost must also not leak userspace info outside the allowed memory table to guests.
Quoted 7 lines
Following the defence in depth principle, make sure the address is not validated out of node range.
Signed-off-by Michael S. Tsirkin <[email protected]>Acked-by Jason Wang <[email protected]>Tested-by Jason Wang <[email protected]>---
Pls advise on whether you'd like me to merge this directly, Cc stable, or handle it in some other way.
Quoted 24 lines
changes from v1: fix build on 32 bit
drivers/vhost/vhost.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/vhost/vhost.c +4
-2@@ -2071,8 +2071,10 @@ static int translate_desc(struct vhost_virtqueue *vq, u64 addr, u32 len, _iov = iov + ret; size = node->size - addr + node->start; _iov->iov_len =min ((u64 )len - s, size); - _iov->iov_base = (void __user *)(unsigned long ) - (node->userspace_addr + addr - node->start); + _iov->iov_base = (void __user *) + ((unsigned long )node->userspace_addr + +array_index_nospec ((unsigned long )(addr - node->start), + node->size)); s += size; addr += size; ++ret;Signature · 1 line
MST
Quoted 18 lines · Michael S. Tsirkin
Quoted 9 lines · Michael S. Tsirkin
iovec addresses coming from vhost are assumed to be pre-validated, but in fact can be speculated to a value out of range.
Userspace address are later validated with
array_index_nospecso we can be sure kernel info does not leak through these addresses, but vhost must also not leak userspace info outside the allowed memory table to guests.Quoted 7 lines
Following the defence in depth principle, make sure the address is not validated out of node range.
Signed-off-by Michael S. Tsirkin <[email protected]>Acked-by Jason Wang <[email protected]>Tested-by Jason Wang <[email protected]>---
Quoted 4 lines
Pls advise on whether you'd like me to merge this directly, Cc stable, or handle it in some other way.
I think you're fine taking it directly, with a cc stable and a Fixes: tag.
Cheers,
Will
Quoted 18 lines · Michael S. Tsirkin
Quoted 9 lines · Michael S. Tsirkin
iovec addresses coming from vhost are assumed to be pre-validated, but in fact can be speculated to a value out of range.
Userspace address are later validated with
array_index_nospecso we can be sure kernel info does not leak through these addresses, but vhost must also not leak userspace info outside the allowed memory table to guests.Quoted 7 lines
Following the defence in depth principle, make sure the address is not validated out of node range.
Signed-off-by Michael S. Tsirkin <[email protected]>Acked-by Jason Wang <[email protected]>Tested-by Jason Wang <[email protected]>---
Quoted 4 lines
Pls advise on whether you'd like me to merge this directly, Cc stable, or handle it in some other way.
I think you're fine taking it directly, with a cc stable and a Fixes: tag.
Cheers,
Will