Re: [kernel-hardening] [PATCH v2 1/2] fork: free vmapped stacks in cache when cpus are offline
From: Hoeun Ryu
Date: Thu Feb 09 2017 - 08:35:32 EST
On Thu, Feb 9, 2017 at 1:22 PM, Eric Biggers <ebiggers3@xxxxxxxxx> wrote:
> Hi Hoeun,
>
> On Thu, Feb 09, 2017 at 01:03:46PM +0900, Hoeun Ryu wrote:
>> +static int free_vm_stack_cache(unsigned int cpu)
>> +{
>> + int i;
>> +
>> + for (i = 0; i < NR_CACHED_STACKS; i++) {
>> + struct vm_struct *vm_stack = this_cpu_read(cached_stacks[i]);
>> + if (!vm_stack)
>> + continue;
>> +
>> + vfree(vm_stack->addr);
>> + this_cpu_write(cached_stacks[i], NULL);
>> + }
>> +
>> + return 0;
>> +}
>
> Doesn't this need to free the stacks for the 'cpu' that's passed in, instead of
> "this" CPU?
>
Sorry, Thank you for your correction. I will fix this.
> - Eric