[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <952ec26a-9492-6f71-bab1-c1def887e528@virtuozzo.com>
Date: Tue, 19 Nov 2019 12:54:08 +0300
From: Andrey Ryabinin <aryabinin@...tuozzo.com>
To: Daniel Axtens <dja@...ens.net>, Qian Cai <cai@....pw>,
kasan-dev@...glegroups.com, linux-mm@...ck.org, x86@...nel.org,
glider@...gle.com, luto@...nel.org, linux-kernel@...r.kernel.org,
mark.rutland@....com, dvyukov@...gle.com, christophe.leroy@....fr
Cc: linuxppc-dev@...ts.ozlabs.org, gor@...ux.ibm.com
Subject: Re: [PATCH v11 1/4] kasan: support backing vmalloc space with real
shadow memory
On 11/18/19 6:29 AM, Daniel Axtens wrote:
> Qian Cai <cai@....pw> writes:
>
>> On Thu, 2019-10-31 at 20:39 +1100, Daniel Axtens wrote:
>>> /*
>>> * In this function, newly allocated vm_struct has VM_UNINITIALIZED
>>> * flag. It means that vm_struct is not fully initialized.
>>> @@ -3377,6 +3411,9 @@ struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
>>>
>>> setup_vmalloc_vm_locked(vms[area], vas[area], VM_ALLOC,
>>> pcpu_get_vm_areas);
>>> +
>>> + /* assume success here */
>>> + kasan_populate_vmalloc(sizes[area], vms[area]);
>>> }
>>> spin_unlock(&vmap_area_lock);
>>
>> Here it is all wrong. GFP_KERNEL with in_atomic().
>
> I think this fix will work, I will do a v12 with it included.
You can send just the fix. Andrew will fold it into the original patch before sending it to Linus.
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index a4b950a02d0b..bf030516258c 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -3417,11 +3417,14 @@ struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
>
> setup_vmalloc_vm_locked(vms[area], vas[area], VM_ALLOC,
> pcpu_get_vm_areas);
> + }
> + spin_unlock(&vmap_area_lock);
>
> + /* populate the shadow space outside of the lock */
> + for (area = 0; area < nr_vms; area++) {
> /* assume success here */
> kasan_populate_vmalloc(sizes[area], vms[area]);
> }
> - spin_unlock(&vmap_area_lock);
>
> kfree(vas);
> return vms;
>
>
Powered by blists - more mailing lists