powerpc/kvm: Handle the boundary condition correctly
Subsystems (2)
PATCH 1/1 powerpc/kvm: Handle the boundary condition correctly
From: "Aneesh Kumar K.V" <[email protected]>
We should be able to copy upto count bytes
--- arch/powerpc/kvm/book3s_64_mmu_hv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kvm/book3s_64_mmu_hv.c +2 -2
@@ -1362,7 +1362,7 @@ static ssize_t kvm_htab_read(struct file *file, char __user *buf, lbuf = (unsigned long __user *)buf; nb =0 ; -while (nb +sizeof (hdr) +HPTE_SIZE < count) { +while (nb +sizeof (hdr) +HPTE_SIZE <= count) {/* Initialize header */ hptr = (struct kvm_get_htab_header __user *)buf; hdr.n_valid =0 ;
@@ -1385,7 +1385,7 @@ static ssize_t kvm_htab_read(struct file *file, char __user *buf,/* Grab a series of valid entries */ while (i < kvm->arch.hpt_npte && hdr.n_valid <0xffff && - nb +HPTE_SIZE < count && + nb +HPTE_SIZE <= count &&record_hpte (flags, hptp, hpte, revp,1 , first_pass)) {/* valid entry, write it out */ ++hdr.n_valid;
Signature · 1 line
1.8.1.2
Quoted 1 line · Aneesh Kumar K.V
From: "Aneesh Kumar K.V" <[email protected]>
Isn't this you?
Quoted 2 lines
We should be able to copy upto count bytes
Why?
Alex
Quoted 31 lines
Signed-off-by Aneesh Kumar K.V <[email protected]>---
arch/powerpc/kvm/book3s_64_mmu_hv.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)arch/powerpc/kvm/book3s_64_mmu_hv.c +2
-2@@ -1362,7 +1362,7 @@ static ssize_t kvm_htab_read(struct file *file, char __user *buf, lbuf = (unsigned long __user *)buf; nb =0 ; -while (nb +sizeof (hdr) +HPTE_SIZE < count) { +while (nb +sizeof (hdr) +HPTE_SIZE <= count) {/* Initialize header */ hptr = (struct kvm_get_htab_header __user *)buf; hdr.n_valid =0 ;@@ -1385,7 +1385,7 @@ static ssize_t kvm_htab_read(struct file *file, char __user *buf,/* Grab a series of valid entries */ while (i < kvm->arch.hpt_npte && hdr.n_valid <0xffff && - nb +HPTE_SIZE < count && + nb +HPTE_SIZE <= count &&record_hpte (flags, hptp, hpte, revp,1 , first_pass)) {/* valid entry, write it out */ ++hdr.n_valid;Signature · 1 line
1.8.1.2
Quoted 5 lines · Alexander Graf
Quoted 1 line · Aneesh Kumar K.V
From: "Aneesh Kumar K.V" <[email protected]>
Isn't this you?
Yes. The patches are generated using git format-patch and sent by git send-email. That's how it always created patches for me. I am not sure if there is a config I can change to avoid having From:
Quoted 6 lines
Quoted 3 lines
We should be able to copy upto count bytes
Why?
Without this we end up doing
+ struct kvm_get_htab_buf {
+ struct kvm_get_htab_header header;
+ /*
+ * Older kernel required one extra byte.
+ */
+ unsigned long hpte[3];
+ } hpte_buf;
even though we are only looking for one hpte entry.
http://mid.gmane.org/1376995766-16526-4-git-send-email-aneesh.kumar@linux.vnet.ibm.com
Quoted 34 lines
Alex
Quoted 31 lines
Signed-off-by Aneesh Kumar K.V <[email protected]>---
arch/powerpc/kvm/book3s_64_mmu_hv.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)arch/powerpc/kvm/book3s_64_mmu_hv.c +2
-2@@ -1362,7 +1362,7 @@ static ssize_t kvm_htab_read(struct file *file, char __user *buf, lbuf = (unsigned long __user *)buf; nb =0 ; -while (nb +sizeof (hdr) +HPTE_SIZE < count) { +while (nb +sizeof (hdr) +HPTE_SIZE <= count) {/* Initialize header */ hptr = (struct kvm_get_htab_header __user *)buf; hdr.n_valid =0 ;@@ -1385,7 +1385,7 @@ static ssize_t kvm_htab_read(struct file *file, char __user *buf,/* Grab a series of valid entries */ while (i < kvm->arch.hpt_npte && hdr.n_valid <0xffff && - nb +HPTE_SIZE < count && + nb +HPTE_SIZE <= count &&record_hpte (flags, hptp, hpte, revp,1 , first_pass)) {/* valid entry, write it out */ ++hdr.n_valid;Signature · 1 line
1.8.1.2
Quoted 11 lines · Aneesh Kumar K.V
Quoted 5 lines · Alexander Graf
Quoted 1 line · Aneesh Kumar K.V
From: "Aneesh Kumar K.V" <[email protected]>
Isn't this you?
Yes. The patches are generated using git format-patch and sent by git send-email. That's how it always created patches for me. I am not sure if there is a config I can change to avoid having From:
Don't bother, that's perfectly fine, and git am will do the right thing.
Cheers,
Ben.
Quoted 56 lines
Quoted 6 lines
Quoted 3 lines
We should be able to copy upto count bytes
Why?
Without this we end up doing
+ struct
kvm_get_htab_buf{
+ structkvm_get_htab_headerheader;
+ /*
+ * Older kernel required one extra byte.
+ */
+ unsigned long hpte[3];
+ }hpte_buf;even though we are only looking for one hpte entry.
http://mid.gmane.org/1376995766-16526-4-git-send-email-aneesh.kumar@linux.vnet.ibm.com
Quoted 34 lines
Alex
Quoted 31 lines
Signed-off-by Aneesh Kumar K.V <[email protected]>---
arch/powerpc/kvm/book3s_64_mmu_hv.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)arch/powerpc/kvm/book3s_64_mmu_hv.c +2
-2@@ -1362,7 +1362,7 @@ static ssize_t kvm_htab_read(struct file *file, char __user *buf, lbuf = (unsigned long __user *)buf; nb =0 ; -while (nb +sizeof (hdr) +HPTE_SIZE < count) { +while (nb +sizeof (hdr) +HPTE_SIZE <= count) {/* Initialize header */ hptr = (struct kvm_get_htab_header __user *)buf; hdr.n_valid =0 ;@@ -1385,7 +1385,7 @@ static ssize_t kvm_htab_read(struct file *file, char __user *buf,/* Grab a series of valid entries */ while (i < kvm->arch.hpt_npte && hdr.n_valid <0xffff && - nb +HPTE_SIZE < count && + nb +HPTE_SIZE <= count &&record_hpte (flags, hptp, hpte, revp,1 , first_pass)) {/* valid entry, write it out */ ++hdr.n_valid;Signature · 1 line
1.8.1.2
Quoted 7 lines · Benjamin Herrenschmidt
Quoted 6 lines · Aneesh Kumar K.V
Quoted 4 lines · Alexander Graf
Quoted 1 line · Aneesh Kumar K.V
From: "Aneesh Kumar K.V" <[email protected]>
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Isn't this you?
Yes. The patches are generated using git format-patch and sent by git send-email. That's how it always created patches for me. I am not sure if there is a config I can change to avoid having From:
Don't bother, that's perfectly fine, and git am will do the right thing.
It will, but it's an indicator that something in his git config is misconfigured. Usually when git sees "Author = Sender" it will omit the From: line.
Alex
Quoted 30 lines · Aneesh Kumar K.V
Quoted 5 lines · Alexander Graf
Quoted 1 line · Aneesh Kumar K.V
From: "Aneesh Kumar K.V" <[email protected]>
Isn't this you?
Yes. The patches are generated using git format-patch and sent by git send-email. That's how it always created patches for me. I am not sure if there is a config I can change to avoid having From:
Quoted 6 lines
Quoted 3 lines
We should be able to copy upto count bytes
Why?
Without this we end up doing
(quoted diff) +7
-0+ struct kvm_get_htab_buf { + struct kvm_get_htab_header header; + /* + * Older kernel required one extra byte. + */ + unsigned long hpte[3]; + } hpte_buf;
Quoted 1 line
even though we are only looking for one hpte entry.
Ok, please give me an example with real numbers and why it breaks.
Alex
Quoted 42 lines
http://mid.gmane.org/1376995766-16526-4-git-send-email-aneesh.kumar@linux.vnet.ibm.com
Quoted 26 lines
Alex
Quoted 23 lines
Signed-off-by Aneesh Kumar K.V <[email protected]>---
arch/powerpc/kvm/book3s_64_mmu_hv.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)arch/powerpc/kvm/book3s_64_mmu_hv.c +1
-1@@ -1362,7 +1362,7 @@ static ssize_t kvm_htab_read(struct file *file, char __user *buf, lbuf = (unsigned long __user *)buf; nb =0 ; -while (nb +sizeof (hdr) +HPTE_SIZE < count) { +while (nb +sizeof (hdr) +HPTE_SIZE <= count) {/* Initialize header */ hptr = (struct kvm_get_htab_header __user *)buf; hdr.n_valid =0 ;@@ -1385,7 +1385,7 @@ static ssize_t kvm_htab_read(struct file *file, char __user *buf,/* Grab a series of valid entries */ while (i < kvm->arch.hpt_npte && hdr.n_valid < 0xffff &&Quoted 8 lines
Quoted 8 lines
arch/powerpc/kvm/book3s_64_mmu_hv.c +1
-1- nb + HPTE_SIZE < count && + nb + HPTE_SIZE <= count && record_hpte(flags, hptp, hpte, revp, 1, first_pass)) {/* valid entry, write it out */ ++hdr.n_valid;Signature · 1 line
1.8.1.2--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 32 lines · Alexander Graf
Quoted 30 lines · Aneesh Kumar K.V
Quoted 5 lines · Alexander Graf
Quoted 1 line · Aneesh Kumar K.V
From: "Aneesh Kumar K.V" <[email protected]>
Isn't this you?
Yes. The patches are generated using git format-patch and sent by git send-email. That's how it always created patches for me. I am not sure if there is a config I can change to avoid having From:
Quoted 6 lines
Quoted 3 lines
We should be able to copy upto count bytes
Why?
Without this we end up doing
(quoted diff) +7
-0+ struct kvm_get_htab_buf { + struct kvm_get_htab_header header; + /* + * Older kernel required one extra byte. + */ + unsigned long hpte[3]; + } hpte_buf;
Quoted 7 lines
Quoted 1 line
even though we are only looking for one hpte entry.
Ok, please give me an example with real numbers and why it breaks.
Didn't quiet get what you are looking for. As explained before, we now need to pass an array with array size 3 even though we know we need to read only 2 entries because kernel doesn't loop correctly.
-aneesh
Quoted 39 lines · Aneesh Kumar K.V
Quoted 37 lines · Alexander Graf
Quoted 30 lines · Aneesh Kumar K.V
Quoted 5 lines · Alexander Graf
Quoted 1 line · Aneesh Kumar K.V
From: "Aneesh Kumar K.V" <[email protected]>
Isn't this you?
Yes. The patches are generated using git format-patch and sent by git send-email. That's how it always created patches for me. I am not sure if there is a config I can change to avoid having From:
Quoted 6 lines
Quoted 3 lines
We should be able to copy upto count bytes
Why?
Without this we end up doing
(quoted diff) +7
-0+ struct kvm_get_htab_buf { + struct kvm_get_htab_header header; + /* + * Older kernel required one extra byte. + */ + unsigned long hpte[3]; + } hpte_buf;Quoted 1 line
even though we are only looking for one hpte entry.
Ok, please give me an example with real numbers and why it breaks.
Quoted 1 line
Quoted 6 lines
Quoted 2 lines
Didn't quiet get what you are looking for. As explained before, we now need to pass an array with array size 3 even though we know we need to read only 2 entries because kernel doesn't loop correctly.
But we need to do that regardless, because newer QEMU needs to be able to run on older kernels, no?
Alex
Quoted 41 lines · Alexander Graf
Quoted 39 lines · Aneesh Kumar K.V
Quoted 37 lines · Alexander Graf
Quoted 30 lines · Aneesh Kumar K.V
Quoted 5 lines · Alexander Graf
Quoted 1 line · Aneesh Kumar K.V
From: "Aneesh Kumar K.V" <[email protected]>
Isn't this you?
Yes. The patches are generated using git format-patch and sent by git send-email. That's how it always created patches for me. I am not sure if there is a config I can change to avoid having From:
Quoted 6 lines
Quoted 3 lines
We should be able to copy upto count bytes
Why?
Without this we end up doing
(quoted diff) +7
-0+ struct kvm_get_htab_buf { + struct kvm_get_htab_header header; + /* + * Older kernel required one extra byte. + */ + unsigned long hpte[3]; + } hpte_buf;Quoted 1 line
even though we are only looking for one hpte entry.
Ok, please give me an example with real numbers and why it breaks.
Quoted 1 line
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
Didn't quiet get what you are looking for. As explained before, we now need to pass an array with array size 3 even though we know we need to read only 2 entries because kernel doesn't loop correctly.
But we need to do that regardless, because newer QEMU needs to be able to run on older kernels, no?
yes. So use space will have to pass an array of size 3. But that should not prevent us from fixing this right ?
-aneesh
Hi Alex,
Quoted 10 lines · Aneesh Kumar K.V
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
Ok, please give me an example with real numbers and why it breaks.
Didn't quiet get what you are looking for. As explained before, we now need to pass an array with array size 3 even though we know we need to read only 2 entries because kernel doesn't loop correctly.
Quoted 6 lines
Quoted 2 lines
But we need to do that regardless, because newer QEMU needs to be able to run on older kernels, no?
yes. So use space will have to pass an array of size 3. But that should not prevent us from fixing this right ?
Do we still want this patch or should I drop this ?
-aneesh
Quoted 14 lines · Aneesh Kumar K.V
Hi Alex,
Quoted 10 lines · Aneesh Kumar K.V
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
Ok, please give me an example with real numbers and why it breaks.
Didn't quiet get what you are looking for. As explained before, we now need to pass an array with array size 3 even though we know we need to read only 2 entries because kernel doesn't loop correctly.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
But we need to do that regardless, because newer QEMU needs to be able to run on older kernels, no?
yes. So use space will have to pass an array of size 3. But that should not prevent us from fixing this right ?
Do we still want this patch or should I drop this ?
If we really want it we need to be able to tell user space that we support this feature through a CAP, so that it can act accordingly. Given the additional complexity of this and the fact that we do want to support older KVM versions regardless, I don't think it's worth the hassle.
Alex