search for: vhost_page_size

Displaying 20 results from an estimated 37 matches for "vhost_page_size".

2010 Nov 29
1
[PATCH] vhost: correctly set bits of dirty pages
When counting pages we should increase it by 1 instead of VHOST_PAGE_SIZE, and also make log_write() can correctly process the request across pages with write_address not start at page boundary. Signed-off-by: Jason Wang <jasowang at redhat.com> --- drivers/vhost/vhost.c | 20 +++++++++----------- 1 files changed, 9 insertions(+), 11 deletions(-) diff --git a/...
2010 Nov 29
1
[PATCH] vhost: correctly set bits of dirty pages
When counting pages we should increase it by 1 instead of VHOST_PAGE_SIZE, and also make log_write() can correctly process the request across pages with write_address not start at page boundary. Signed-off-by: Jason Wang <jasowang at redhat.com> --- drivers/vhost/vhost.c | 20 +++++++++----------- 1 files changed, 9 insertions(+), 11 deletions(-) diff --git a/...
2019 May 09
2
[RFC PATCH V2] vhost: don't use kmap() to log dirty pages
...); + /* TODO: fallback to kmap() when -ENOSYS? */ + set_page_dirty_lock(page); put_page(page); - return 0; + return r; } -static int log_write(void __user *log_base, +static int log_write(u32 __user *log_base, u64 write_address, u64 write_length) { u64 write_page = write_address / VHOST_PAGE_SIZE; @@ -1726,12 +1727,10 @@ static int log_write(void __user *log_base, return 0; write_length += write_address % VHOST_PAGE_SIZE; for (;;) { - u64 base = (u64)(unsigned long)log_base; - u64 log = base + write_page / 8; - int bit = write_page % 8; - if ((u64)(unsigned long)log != log) - r...
2019 May 09
2
[RFC PATCH V2] vhost: don't use kmap() to log dirty pages
...); + /* TODO: fallback to kmap() when -ENOSYS? */ + set_page_dirty_lock(page); put_page(page); - return 0; + return r; } -static int log_write(void __user *log_base, +static int log_write(u32 __user *log_base, u64 write_address, u64 write_length) { u64 write_page = write_address / VHOST_PAGE_SIZE; @@ -1726,12 +1727,10 @@ static int log_write(void __user *log_base, return 0; write_length += write_address % VHOST_PAGE_SIZE; for (;;) { - u64 base = (u64)(unsigned long)log_base; - u64 log = base + write_page / 8; - int bit = write_page % 8; - if ((u64)(unsigned long)log != log) - r...
2010 Oct 11
1
[patch 2/2] vhost: fix return code for log_access_ok()
...ss_ok(void __user *log_base, u64 addr, unsigned long sz) /* Make sure 64 bit math will not overflow. */ if (a > ULONG_MAX - (unsigned long)log_base || a + (unsigned long)log_base > ULONG_MAX) - return -EFAULT; + return 0; return access_ok(VERIFY_WRITE, log_base + a, (sz + VHOST_PAGE_SIZE * 8 - 1) / VHOST_PAGE_SIZE / 8);
2010 Oct 11
1
[patch 2/2] vhost: fix return code for log_access_ok()
...ss_ok(void __user *log_base, u64 addr, unsigned long sz) /* Make sure 64 bit math will not overflow. */ if (a > ULONG_MAX - (unsigned long)log_base || a + (unsigned long)log_base > ULONG_MAX) - return -EFAULT; + return 0; return access_ok(VERIFY_WRITE, log_base + a, (sz + VHOST_PAGE_SIZE * 8 - 1) / VHOST_PAGE_SIZE / 8);
2019 May 13
5
[PATCH net] vhost: don't use kmap() to log dirty pages
...err; + mutex_unlock(&vhost_log_lock); + } return 0; +err: + mutex_unlock(&vhost_log_lock); + return r; } static int log_write(void __user *log_base, @@ -1725,13 +1731,13 @@ static int log_write(void __user *log_base, if (!write_length) return 0; write_length += write_address % VHOST_PAGE_SIZE; + log_base = (void __user *)((u64)log_base & ~0x3ULL); + write_page += ((u64)log_base & 0x3ULL) * 8; for (;;) { - u64 base = (u64)(unsigned long)log_base; - u64 log = base + write_page / 8; - int bit = write_page % 8; - if ((u64)(unsigned long)log != log) - return -EFAULT; - r = s...
2019 May 13
5
[PATCH net] vhost: don't use kmap() to log dirty pages
...err; + mutex_unlock(&vhost_log_lock); + } return 0; +err: + mutex_unlock(&vhost_log_lock); + return r; } static int log_write(void __user *log_base, @@ -1725,13 +1731,13 @@ static int log_write(void __user *log_base, if (!write_length) return 0; write_length += write_address % VHOST_PAGE_SIZE; + log_base = (void __user *)((u64)log_base & ~0x3ULL); + write_page += ((u64)log_base & 0x3ULL) * 8; for (;;) { - u64 base = (u64)(unsigned long)log_base; - u64 log = base + write_page / 8; - int bit = write_page % 8; - if ((u64)(unsigned long)log != log) - return -EFAULT; - r = s...
2019 May 09
0
[RFC PATCH V2] vhost: don't use kmap() to log dirty pages
...; set_page_dirty_lock(page); > put_page(page); > - return 0; > + return r; > } > > -static int log_write(void __user *log_base, > +static int log_write(u32 __user *log_base, > u64 write_address, u64 write_length) > { > u64 write_page = write_address / VHOST_PAGE_SIZE; > @@ -1726,12 +1727,10 @@ static int log_write(void __user *log_base, > return 0; > write_length += write_address % VHOST_PAGE_SIZE; > for (;;) { > - u64 base = (u64)(unsigned long)log_base; > - u64 log = base + write_page / 8; > - int bit = write_page % 8; > - i...
2018 Apr 10
6
[PATCH v2 0/2] vhost: fix vhost_vq_access_ok() log check
v2: * Rewrote the conditional to make the vq access check clearer [Linus] * Added Patch 2 to make the return type consistent and harder to misuse [Linus] The first patch fixes the vhost virtqueue access check which was recently broken. The second patch replaces the int return type with bool to prevent future bugs. Stefan Hajnoczi (2): vhost: fix vhost_vq_access_ok() log check vhost:
2018 Apr 10
6
[PATCH v2 0/2] vhost: fix vhost_vq_access_ok() log check
v2: * Rewrote the conditional to make the vq access check clearer [Linus] * Added Patch 2 to make the return type consistent and harder to misuse [Linus] The first patch fixes the vhost virtqueue access check which was recently broken. The second patch replaces the int return type with bool to prevent future bugs. Stefan Hajnoczi (2): vhost: fix vhost_vq_access_ok() log check vhost:
2009 Dec 20
0
[PATCH 2/3] vhost: add access_ok checks
...b/drivers/vhost/vhost.c index 29f1675..33e06bf 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -224,6 +224,91 @@ void vhost_dev_cleanup(struct vhost_dev *dev) dev->mm = NULL; } +static int log_access_ok(void __user *log_base, u64 addr, unsigned long sz) +{ + u64 a = addr / VHOST_PAGE_SIZE / 8; + /* Make sure 64 bit math will not overflow. */ + if (a > ULONG_MAX - (unsigned long)log_base || + a + (unsigned long)log_base > ULONG_MAX) + return -EFAULT; + + return access_ok(VERIFY_WRITE, log_base + a, + (sz + VHOST_PAGE_SIZE * 8 - 1) / VHOST_PAGE_SIZE / 8); +} + +/* Caller...
2009 Dec 20
0
[PATCH 2/3] vhost: add access_ok checks
...b/drivers/vhost/vhost.c index 29f1675..33e06bf 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -224,6 +224,91 @@ void vhost_dev_cleanup(struct vhost_dev *dev) dev->mm = NULL; } +static int log_access_ok(void __user *log_base, u64 addr, unsigned long sz) +{ + u64 a = addr / VHOST_PAGE_SIZE / 8; + /* Make sure 64 bit math will not overflow. */ + if (a > ULONG_MAX - (unsigned long)log_base || + a + (unsigned long)log_base > ULONG_MAX) + return -EFAULT; + + return access_ok(VERIFY_WRITE, log_base + a, + (sz + VHOST_PAGE_SIZE * 8 - 1) / VHOST_PAGE_SIZE / 8); +} + +/* Caller...
2019 May 10
2
[RFC PATCH V2] vhost: don't use kmap() to log dirty pages
..._page(page); >> - return 0; >> + return r; >> } >> >> -static int log_write(void __user *log_base, >> +static int log_write(u32 __user *log_base, >> u64 write_address, u64 write_length) >> { >> u64 write_page = write_address / VHOST_PAGE_SIZE; >> @@ -1726,12 +1727,10 @@ static int log_write(void __user *log_base, >> return 0; >> write_length += write_address % VHOST_PAGE_SIZE; >> for (;;) { >> - u64 base = (u64)(unsigned long)log_base; >> - u64 log = base + write_page / 8; >> - int...
2019 May 10
2
[RFC PATCH V2] vhost: don't use kmap() to log dirty pages
..._page(page); >> - return 0; >> + return r; >> } >> >> -static int log_write(void __user *log_base, >> +static int log_write(u32 __user *log_base, >> u64 write_address, u64 write_length) >> { >> u64 write_page = write_address / VHOST_PAGE_SIZE; >> @@ -1726,12 +1727,10 @@ static int log_write(void __user *log_base, >> return 0; >> write_length += write_address % VHOST_PAGE_SIZE; >> for (;;) { >> - u64 base = (u64)(unsigned long)log_base; >> - u64 log = base + write_page / 8; >> - int...
2018 Apr 11
7
[PATCH v3 0/2] vhost: fix vhost_vq_access_ok() log check
v3: * Rebased onto net/master and resolved conflict [DaveM] v2: * Rewrote the conditional to make the vq access check clearer [Linus] * Added Patch 2 to make the return type consistent and harder to misuse [Linus] The first patch fixes the vhost virtqueue access check which was recently broken. The second patch replaces the int return type with bool to prevent future bugs. Stefan Hajnoczi
2018 Apr 11
7
[PATCH v3 0/2] vhost: fix vhost_vq_access_ok() log check
v3: * Rebased onto net/master and resolved conflict [DaveM] v2: * Rewrote the conditional to make the vq access check clearer [Linus] * Added Patch 2 to make the return type consistent and harder to misuse [Linus] The first patch fixes the vhost virtqueue access check which was recently broken. The second patch replaces the int return type with bool to prevent future bugs. Stefan Hajnoczi
2018 Apr 10
0
[PATCH v2 2/2] vhost: return bool from *_access_ok() functions
...host/vhost.c @@ -641,14 +641,14 @@ void vhost_dev_cleanup(struct vhost_dev *dev) } EXPORT_SYMBOL_GPL(vhost_dev_cleanup); -static int log_access_ok(void __user *log_base, u64 addr, unsigned long sz) +static bool log_access_ok(void __user *log_base, u64 addr, unsigned long sz) { u64 a = addr / VHOST_PAGE_SIZE / 8; /* Make sure 64 bit math will not overflow. */ if (a > ULONG_MAX - (unsigned long)log_base || a + (unsigned long)log_base > ULONG_MAX) - return 0; + return false; return access_ok(VERIFY_WRITE, log_base + a, (sz + VHOST_PAGE_SIZE * 8 - 1) / VHOST_PAGE_SIZE / 8); @@...
2018 Apr 11
0
[PATCH v3 2/2] vhost: return bool from *_access_ok() functions
...host/vhost.c @@ -641,14 +641,14 @@ void vhost_dev_cleanup(struct vhost_dev *dev) } EXPORT_SYMBOL_GPL(vhost_dev_cleanup); -static int log_access_ok(void __user *log_base, u64 addr, unsigned long sz) +static bool log_access_ok(void __user *log_base, u64 addr, unsigned long sz) { u64 a = addr / VHOST_PAGE_SIZE / 8; /* Make sure 64 bit math will not overflow. */ if (a > ULONG_MAX - (unsigned long)log_base || a + (unsigned long)log_base > ULONG_MAX) - return 0; + return false; return access_ok(VERIFY_WRITE, log_base + a, (sz + VHOST_PAGE_SIZE * 8 - 1) / VHOST_PAGE_SIZE / 8); @@...
2019 May 14
0
[PATCH net] vhost: don't use kmap() to log dirty pages
...eturn 0; > +err: > + mutex_unlock(&vhost_log_lock); > + return r; > } > > static int log_write(void __user *log_base, > @@ -1725,13 +1731,13 @@ static int log_write(void __user *log_base, > if (!write_length) > return 0; > write_length += write_address % VHOST_PAGE_SIZE; > + log_base = (void __user *)((u64)log_base & ~0x3ULL); > + write_page += ((u64)log_base & 0x3ULL) * 8; > for (;;) { > - u64 base = (u64)(unsigned long)log_base; > - u64 log = base + write_page / 8; > - int bit = write_page % 8; > - if ((u64)(unsigned long)log !...