[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMZfGtU9U5dv5oOCopnsFN7XErY52nA47b0jreUqZ2C6VBmC7w@mail.gmail.com>
Date: Fri, 28 Aug 2020 10:33:40 +0800
From: Muchun Song <songmuchun@...edance.com>
To: Mike Kravetz <mike.kravetz@...cle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Andi Kleen <ak@...ux.intel.com>,
Linux Memory Management List <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [External] Re: [PATCH] mm/hugetlb: Fix a race between hugetlb
sysctl handlers
On Fri, Aug 28, 2020 at 5:51 AM Mike Kravetz <mike.kravetz@...cle.com> wrote:
>
> On 8/25/20 7:47 PM, Muchun Song wrote:
> >
> > CPU0: CPU1:
> > proc_sys_write
> > hugetlb_sysctl_handler proc_sys_call_handler
> > hugetlb_sysctl_handler_common hugetlb_sysctl_handler
> > table->data = &tmp; hugetlb_sysctl_handler_common
> > table->data = &tmp;
> > proc_doulongvec_minmax
> > do_proc_doulongvec_minmax sysctl_head_finish
> > __do_proc_doulongvec_minmax
> > i = table->data;
> > *i = val; // corrupt CPU1 stack
>
> Thanks Muchun!
> Can you please add this to the commit message.
OK, I will do that. Thanks.
>
> Also, when looking closer at the patch I do not think setting table->maxlen
> is necessary in these routines. maxlen is set when the hugetlb ctl_table
> entries are defined and initialized. This is not something you introduced.
> The unnecessary assignments are in the existing code. However, there is no
> need to carry them forward.
Yeah, I agree with you. I will remove the unnecessary assignment of
table->maxlen.
>
> --
> Mike Kravetz
--
Yours,
Muchun
Powered by blists - more mailing lists