Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp883763pxa; Thu, 27 Aug 2020 19:38:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyt1hqrsuNWkJvyQ0AQYk+r6YKFbcYKqqrG12809v5yrJZxL/dAgJ4CLvLMRm9Y4apGoFHS X-Received: by 2002:a17:906:44e:: with SMTP id e14mr20016643eja.352.1598582315724; Thu, 27 Aug 2020 19:38:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598582315; cv=none; d=google.com; s=arc-20160816; b=XGdzXBFO39fG0x219uiflmWlaC2+Sav7nloB/KBMfYkaD+b6arpfD4bTH+X6fYI8Zq BN4CVhAl8oViYa0N9BLpLw/WqdD0+/lEYL8yJDNr6RmNNDQCzFIL0CXXsvY3J3a/Bjow imvP92SL72qWLuVMrwoOVP3l7bJ+xzsx71YIUAwXah2aVImGlLWFRAX1l/X/lFmhX57u qlo1mA4tW36nwkiiZU84hAO/o3bQriR3aCmF3cn+Gn9aMdK9Dlg1rEhyKrHL2QS5Hk8C lI7LnuOtCaScQDbfuxbZ2Y7XxRvlVwY4F/ZAF8Q+VnyZ0J58YulgHsR6ffl6GKBdX0BM 6w8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Wq4bW80PYQOUvc+r7HK1lpXC6FPGn4j7cEEATFFs/9U=; b=uyyOt+kdgJF50hlxXCOxRhGVXLJyELYj4hSyo7TMh8E+bTxKvi+JrHtNOfUL1yciuP OdsP8of4y6nORf7ACIuW10fgFyxasehocg7Pev1lsvuHla5L0bRN8nGWvXOzgs/+Fbnq 1GBj7L0hzkbgbDbPyMfknDFPEypPYNfBzRKrI6y3HKDmuZJjXvc+Biykd2zKs4oIJ+fX MU6q/2JULP4FgGmS1zIDznATwxTVyb4wnnxFLeExnM21MdjQxtknJbGXhYOp5orJjAy0 AiK/r7b8BRwrndM8nAbPHEz/59c6zITjpjnhHS/deAEd6YzY/WO0UjUwFxnIwZqYMBel KlEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=oTCOBXxK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n8si519771eda.580.2020.08.27.19.38.10; Thu, 27 Aug 2020 19:38:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=oTCOBXxK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728356AbgH1CeR (ORCPT + 99 others); Thu, 27 Aug 2020 22:34:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728015AbgH1CeR (ORCPT ); Thu, 27 Aug 2020 22:34:17 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33093C061264 for ; Thu, 27 Aug 2020 19:34:17 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id w186so4727525pgb.8 for ; Thu, 27 Aug 2020 19:34:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Wq4bW80PYQOUvc+r7HK1lpXC6FPGn4j7cEEATFFs/9U=; b=oTCOBXxK+fBohpDAkvRznZQumncoBJKZyRDUp5HFU+2ZRiPwLX6uWoA9NjpXlRv9Uj icW2nB2LIYQ3BBJJ5jc0w7AyYINngxONh8FoCPrv8LE173SZAToDmWc4rLiQ6SMAWZkG V9U0nE2JGZmvxGpYfNpVz8bUrpq79nkE0RWb6j8X8UbgpE4mUlI7eV5Qt2A7HlcdNAE5 bqrR58QdJQi+3SKs2tTAraud3ZnTNgEeD5z/SW2yRbzo5PmThtJJQq3gtKXn3Qim7R3K qMwKqM00zkG0/U+F4JcjD4I9lY0EvI7MsjALkGdm2syGd6euU7+d0cfNOlGm3F9JZq63 oMLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Wq4bW80PYQOUvc+r7HK1lpXC6FPGn4j7cEEATFFs/9U=; b=S3dv41007LS3gOjSfsLIZpEFknx3uT3+ykwmo70useusKhxuj8aW2NvbW+wytZoA+Z bxvXtYmho/A3ySNBPC0P73VkNlFl2lQ49gdt35JkAPma4uHYnoxc1OUwOXVdwkxiF4ie SAOppdeSQR9CUZJS8/Jn6bTOWVnIXkl2bInfBMTh4vtDjivPqBeVdDFPVkggaRWZNYvT D6Bh/rMJdMIVi72RwtkTbj/cRSwdDOshIFOKzQhkyiyqTz4Gp5fsq1qb4eAjx3O5Skpl I6HxozOYux0Jl3/inOn55fFDs76bFk68SjAJsrm0+JY2hqGxWRnfr4pF8MDmh5tPst3Z sTig== X-Gm-Message-State: AOAM532G/GwrmqpqebFgMscCJpyHu/MCQZ5ZNzK1eCmZp3mNg3Ua8l68 NWLlaFtnDRiYd1/YpfQGItKJAgYKA+nfgp1eDmaDSTFp1/w2OX8H X-Received: by 2002:a17:902:221:: with SMTP id 30mr19150363plc.222.1598582056522; Thu, 27 Aug 2020 19:34:16 -0700 (PDT) MIME-Version: 1.0 References: <20200822095328.61306-1-songmuchun@bytedance.com> <20200824135924.b485e000d358cee817c4f05c@linux-foundation.org> <79800508-54c9-4cda-02de-29b1a6912e75@oracle.com> <231ec1f1-fe7a-c48a-2427-1311360d4b9b@oracle.com> In-Reply-To: From: Muchun Song Date: Fri, 28 Aug 2020 10:33:40 +0800 Message-ID: Subject: Re: [External] Re: [PATCH] mm/hugetlb: Fix a race between hugetlb sysctl handlers To: Mike Kravetz Cc: Andrew Morton , Andi Kleen , Linux Memory Management List , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 28, 2020 at 5:51 AM Mike Kravetz 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