From: Muchun Song <songmuchun@bytedance.com>
To: Andi Kleen <ak@linux.intel.com>
Cc: mike.kravetz@oracle.com,
Andrew Morton <akpm@linux-foundation.org>,
npiggin@suse.de, agl@us.ibm.com, nacc@us.ibm.com,
Linux Memory Management List <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [Phishing Risk] [External] Re: [PATCH] mm/hugetlb: Fix a race between hugetlb sysctl handlers
Date: Wed, 26 Aug 2020 10:34:48 +0800 [thread overview]
Message-ID: <CAMZfGtUiN2GVA7scEyA3d=-Vk=8R58p6LWg3kU0URkkxzAJ8CA@mail.gmail.com> (raw)
In-Reply-To: <20200825152509.GO1509399@tassilo.jf.intel.com>
HI Andi,
On Tue, Aug 25, 2020 at 11:34 PM Andi Kleen <ak@linux.intel.com> wrote:
>
> > Fixes: e5ff215941d5 ("hugetlb: multiple hstates for multiple page sizes")
>
> I don't think the Fixes line is correct. The original patch
> just used a global variable and didn't have this race.
> It must have been added later in some other patch that added
> hugetlb_sysctl_handler_common.
I don't agree with you. The 'e5ff215941d5' is not used a global
variable. Below is the code snippet of this patch. Thanks.
@@ -1037,8 +1109,19 @@ int hugetlb_sysctl_handler(struct ctl_table
*table, int write,
struct file *file, void __user *buffer,
size_t *length, loff_t *ppos)
{
+ struct hstate *h = &default_hstate;
+ unsigned long tmp;
Here is a local variable of tmp.
+
+ if (!write)
+ tmp = h->max_huge_pages;
+
+ table->data = &tmp;
+ table->maxlen = sizeof(unsigned long);
proc_doulongvec_minmax(table, write, file, buffer, length, ppos);
- max_huge_pages = set_max_huge_pages(max_huge_pages);
+
+ if (write)
+ h->max_huge_pages = set_max_huge_pages(h, tmp);
+
return 0;
}
>
> -Andi
--
Yours,
Muchun
prev parent reply other threads:[~2020-08-26 2:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-22 9:53 Muchun Song
2020-08-24 20:59 ` Andrew Morton
2020-08-24 21:19 ` Mike Kravetz
2020-08-25 3:01 ` [External] " Muchun Song
2020-08-26 0:01 ` Mike Kravetz
2020-08-26 2:47 ` Muchun Song
2020-08-27 21:51 ` Mike Kravetz
2020-08-28 2:33 ` Muchun Song
2020-08-25 2:42 ` Muchun Song
2020-08-25 15:25 ` Andi Kleen
2020-08-26 2:34 ` Muchun Song [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAMZfGtUiN2GVA7scEyA3d=-Vk=8R58p6LWg3kU0URkkxzAJ8CA@mail.gmail.com' \
--to=songmuchun@bytedance.com \
--cc=agl@us.ibm.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=nacc@us.ibm.com \
--cc=npiggin@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox