On Fri, 10 Nov 2017, Thomas Gleixner wrote:

> On Fri, 10 Nov 2017, Prarit Bhargava wrote:
> > On 11/09/2017 07:43 PM, Thomas Gleixner wrote:
> > > On Sun, 5 Nov 2017, Prarit Bhargava wrote:
> > >> [v5]: Change kmalloc to GFP_ATOMIC to fix "sleeping function" warning on
> > >> virtual machines.
> > > 
> > > What has this to do with virtual machines? The very same issue is on
> > > physcial hardware because this is called from the early CPU bringup code
> > > with interrupts and preemption disabled.
> > 
> > There was a Intel test bot report of a failure during boot on virtual 
> > systems
> > with Andi's patch.
> 
> Sure, but the problem has nothing to do with virtual machines at all.

The same is true for the KASAN report of out of bound access:

        new = logical_packages++;
-       if (new != pkg) {
-               pr_info("CPU %u Converting physical %u to logical package %u\n",
-                       cpu, pkg, new);
+
+       /* Allocate and copy a new array */
+       ltp_pkg_map_new = kmalloc(logical_packages * sizeof(u16), GFP_KERNEL);
+       BUG_ON(!ltp_pkg_map_new);
+       if (logical_to_physical_pkg_map) {
+               memcpy(ltp_pkg_map_new, logical_to_physical_pkg_map,
+                      logical_packages * sizeof(u16));

That's caused by incrementing logical_packages _before_ the memcpy(), but
the old array is one u16 shorter than the newly allocated.

That's reported on a VM as well, but is a genuine code bug.

Thanks,

        tglx

Reply via email to