Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp747497pxa; Thu, 27 Aug 2020 14:53:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1N6WjheAOMQiEqNj9SEkhfbKZ6GCxkgkdvf2M/b/Ig81xxx+jEQaGnoD5WwtW8+B5WkOt X-Received: by 2002:a05:6402:1591:: with SMTP id c17mr21559293edv.111.1598565237101; Thu, 27 Aug 2020 14:53:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598565237; cv=none; d=google.com; s=arc-20160816; b=Gy62wcaqukRJGLYAcTxEEoqmNtd/BVCY7dpxY0dud7KQr7n52ubhk6e748kDm+cmeE NR05QSXUQgAD94/HJI4JbPCMZKY3klObYYXHn4AyrKn5XJKf/xiIcmrD/9GZ2spOb1yK uiH6qPk3xu9BDZVNc60rEyhLtT4r3pRLSiidd7EkIq0jAtxfKzvt61rR9Nx+13MGNihz vmDJEpiTHEzQefJ9Z5xj63AsJHqR3mLbdq1uEio8QQo7h06b60No4ZDdDrE4ghc36Jwv IO5s2LCCAWW3NuNRCA2wvY5s7HpE7WoWkd2D6sHIcWoK/o9po4bfqM1MsSh0eM0g2aN5 tXxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=wUV+gI4hcarMpqEbC2to6GF/7WDX4Bx1I5kjkmzQLEM=; b=JBdMj9K4xRgUY8GB+JHYkCIt40MiMZ0l6qj+CPC5Cdh1GSpdPv4r5MDqTZ3FKcIUKP h/ihgqx09IkBbcxYcVosaZEdOHOCWSrKiXcTz7ixLHfsCQ158EQ6pUHnZHgj1aSwMc6p K9Hi2CsRHRNEEsbWa9fDOp7PKcfo4DApDZKCN4tqniu/yrZdSSkf3WO8r6EqzMtLtSSx JcUmk9dkJPKOL7CKNxVXdtTcHYfpHHP1/aMVDHP4Ya2Ki4Wj4bpr5UhLGKsTtfQqKQhG sVKQ8O/sKppdwz1R4V74Qkk+WYrUImHRvRM2YL0A2cDJszHvsh7YlqyN5uKAiB/mZqhw 6U9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=DmYlVlPs; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i2si2309345ejp.500.2020.08.27.14.53.32; Thu, 27 Aug 2020 14:53:57 -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=@oracle.com header.s=corp-2020-01-29 header.b=DmYlVlPs; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726838AbgH0VvK (ORCPT + 99 others); Thu, 27 Aug 2020 17:51:10 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:58038 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726147AbgH0VvJ (ORCPT ); Thu, 27 Aug 2020 17:51:09 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 07RLU6P1160610; Thu, 27 Aug 2020 21:51:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=wUV+gI4hcarMpqEbC2to6GF/7WDX4Bx1I5kjkmzQLEM=; b=DmYlVlPs7VkLIg1bpyBiALvSK4vQQEdQSp0ef+hXF07hdwCH9zFuISoIDrr8g06l5HVI j2ohjopCku7duDBNyxfNt6IOQE6IcA5yFfGAiLDnoBvABdVDaKrI7PsDPGgOaGrIpfX3 AsKn+NJ+TzaStI0Erdr0H8kWitYq4JQdh1Ner33H3qCtfYf87UQbtyTggRbn+vpUDCUV +GFFutiyEwGFvnAf2h7/txJzvLCeqZvhu4/h1rzxwsfXx/w13tT8G/ybZcs2aTP+GIkA CufDxA+Ac4BaykI/6/LxSqjjwgW2c9dWWIm3PY43SNAcW08TaixTMVGAifFWQFZNeudh 9A== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 333dbs8x60-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 27 Aug 2020 21:51:04 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 07RLVeXO034484; Thu, 27 Aug 2020 21:51:03 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 333r9nsuj6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 27 Aug 2020 21:51:03 +0000 Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 07RLp27q003885; Thu, 27 Aug 2020 21:51:02 GMT Received: from [192.168.2.112] (/50.38.35.18) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 27 Aug 2020 14:51:02 -0700 Subject: Re: [External] Re: [PATCH] mm/hugetlb: Fix a race between hugetlb sysctl handlers To: Muchun Song Cc: Andrew Morton , ak@linux.intel.com, Linux Memory Management List , LKML 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> From: Mike Kravetz Message-ID: Date: Thu, 27 Aug 2020 14:51:01 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9726 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 suspectscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008270162 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9726 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008270162 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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. -- Mike Kravetz