x86/monitor: Fixed CID 1412966: Memory - corruptions (OVERRUN)
PATCH v2 1/1 x86/monitor: Fixed CID 1412966: Memory - corruptions (OVERRUN)
Fixed an issue where the maximum index allowed (31) goes beyond the actual number of array elements (4) of ad->monitor.write_ctrlreg_mask.
Coverity-ID: 1412966
---
Changes since V1:
- Changed '3' to 'ARRAY_SIZE(...)'.
--- xen/arch/x86/monitor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
xen/arch/x86/monitor.c +2 -1
@@ -133,7 +133,8 @@ int arch_monitor_domctl_event(struct domain *d,bool_t old_status;/* sanity check: avoid left-shift undefined behavior */ -if (unlikely (mop->u.mov_to_cr.index >31 ) ) +if (unlikely (mop->u.mov_to_cr.index >= +ARRAY_SIZE (ad->monitor.write_ctrlreg_mask)) )return -EINVAL ;if (unlikely (mop->u.mov_to_cr.pad1 || mop->u.mov_to_cr.pad2) )
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 5 lines · Razvan Cojocaru
Fixed an issue where the maximum index allowed (31) goes beyond the actual number of array elements (4) of
ad->monitor.write_ctrlreg_mask.
Coverity-ID: 1412966Signed-off-by Razvan Cojocaru <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 18 lines · Razvan Cojocaru
Fixed an issue where the maximum index allowed (31) goes beyond the actual number of array elements (4) of
ad->monitor.write_ctrlreg_mask.
Coverity-ID: 1412966Signed-off-by Razvan Cojocaru <[email protected]>---
Changes since V1:
- Changed '3' to 'ARRAY_SIZE(...)'.--- xen/arch/x86/monitor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)xen/arch/x86/monitor.c +0
-0
xen/arch/x86/monitor.c int arch_monitor_domctl_event(struct domain *d, · line 135
Quoted 3 lines
xen/arch/x86/monitor.c +0
-0@@ -133,7 +133,8 @@ int arch_monitor_domctl_event(struct domain *d,bool_t old_status;/* sanity check: avoid left-shift undefined behavior */
This comment should be deleted now.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 21 lines · Wei Liu
Quoted 20 lines · Razvan Cojocaru
Fixed an issue where the maximum index allowed (31) goes beyond the actual number of array elements (4) of
ad->monitor.write_ctrlreg_mask.
Coverity-ID: 1412966Signed-off-by Razvan Cojocaru <[email protected]>---
Changes since V1:
- Changed '3' to 'ARRAY_SIZE(...)'.--- xen/arch/x86/monitor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)xen/arch/x86/monitor.c +0
-0@@ -133,7 +133,8 @@ int arch_monitor_domctl_event(struct domain *d,bool_t old_status;
Quoted 3 lines
xen/arch/x86/monitor.c int arch_monitor_domctl_event(struct domain *d, · line 135
Quoted 1 line
xen/arch/x86/monitor.c +0
-0/* sanity check: avoid left-shift undefined behavior */ This comment should be deleted now.
It technically continues to be correct, but if you'd like I can send V3
- otherwise (and if it's not too much hassle) it can be deleted on commit. I'm happy to accomodate either scenario.
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 22 lines · Razvan Cojocaru
Quoted 21 lines · Wei Liu
Quoted 20 lines · Razvan Cojocaru
Fixed an issue where the maximum index allowed (31) goes beyond the actual number of array elements (4) of
ad->monitor.write_ctrlreg_mask.
Coverity-ID: 1412966Signed-off-by Razvan Cojocaru <[email protected]>---
Changes since V1:
- Changed '3' to 'ARRAY_SIZE(...)'.--- xen/arch/x86/monitor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)xen/arch/x86/monitor.c +0
-0@@ -133,7 +133,8 @@ int arch_monitor_domctl_event(struct domain *d,bool_t old_status;
Quoted 8 lines
Quoted 3 lines
xen/arch/x86/monitor.c int arch_monitor_domctl_event(struct domain *d, · line 135
Quoted 1 line
xen/arch/x86/monitor.c +0
-0/* sanity check: avoid left-shift undefined behavior */ This comment should be deleted now.
It technically continues to be correct, but if you'd like I can send V3
- otherwise (and if it's not too much hassle) it can be deleted on commit. I'm happy to accomodate either scenario.
I don't think I care enough really. :-)
Since Andrew has reviewed this patch, it can be committed (by him) at some point.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
xen/arch/x86/monitor.c int arch_monitor_domctl_event(struct domain *d, · line 137
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 21.06.17 at 16:56, <[email protected]> wrote:
xen/arch/x86/monitor.c +2
-1@@ -133,7 +133,8 @@ int arch_monitor_domctl_event(struct domain *d,bool_t old_status;/* sanity check: avoid left-shift undefined behavior */ -if (unlikely (mop->u.mov_to_cr.index >31 ) ) +if (unlikely (mop->u.mov_to_cr.index >= +ARRAY_SIZE (ad->monitor.write_ctrlreg_mask)) )
Indentation.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 21.06.17 at 16:56, <[email protected]> wrote:
xen/arch/x86/monitor.c +0
-0@@ -133,7 +133,8 @@ int arch_monitor_domctl_event(struct domain *d,bool_t old_status;
Quoted 6 lines
xen/arch/x86/monitor.c int arch_monitor_domctl_event(struct domain *d, · line 137
Quoted 4 lines
xen/arch/x86/monitor.c +2
-1/* sanity check: avoid left-shift undefined behavior */ -if (unlikely (mop->u.mov_to_cr.index >31 ) ) +if (unlikely (mop->u.mov_to_cr.index >= +ARRAY_SIZE (ad->monitor.write_ctrlreg_mask)) )Indentation.
Right, that should have matched the end of the "unlikely(" above. I'll modify it, remove the comment Wei commented on and submit V3.
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
(Re-sent with CCs preserved).
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 21.06.17 at 16:56, <[email protected]> wrote:
xen/arch/x86/monitor.c +0
-0@@ -133,7 +133,8 @@ int arch_monitor_domctl_event(struct domain *d,bool_t old_status;
Quoted 6 lines
xen/arch/x86/monitor.c int arch_monitor_domctl_event(struct domain *d, · line 137
Quoted 4 lines
xen/arch/x86/monitor.c +2
-1/* sanity check: avoid left-shift undefined behavior */ -if (unlikely (mop->u.mov_to_cr.index >31 ) ) +if (unlikely (mop->u.mov_to_cr.index >= +ARRAY_SIZE (ad->monitor.write_ctrlreg_mask)) )Indentation.
Right, that should have matched the end of the "unlikely(" above. I'll modify it, remove the comment Wei commented on and submit V3.
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel