Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp565204yba; Thu, 18 Apr 2019 06:07:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqz493iJczAFUwCdXlUoPv8q9IeeWvVVTkOa2FLI0pykcVy3MwXZy3M2VC1tyXmIYxfQkxIr X-Received: by 2002:a17:902:3324:: with SMTP id a33mr27942639plc.186.1555592850820; Thu, 18 Apr 2019 06:07:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555592850; cv=none; d=google.com; s=arc-20160816; b=JCeAWy9iUaQft0H4fY09Y8JqBsLvJ7bq8i6ommaosfUY4Kx6mRKfFElrBI2QDfc/dx 87muWgemliEFYv4OkUZ4yR+hy7BW7aEeIbxOUAQdmUoMjJZPoD9q+03Q4/P2JzGf+ljA 018wGaX7qx7SKBwCBak4PLYScOyLay7+9mpi82DtuQvg8Avqn1pFx6bR1f3QY2SLQ4mK CHUlzAsr4UePc+sWTTyjurktx4Oa8Mfd8iK9olNQMiFkdI7e3/GHJ+ZHBAU2t6RVznAM KjaPAUOx2N+5f/fAYoJc6uU9dhSkc3gJqPoK7c18flugdTCFhLnC2n6UUlciMyJ3Aazo K8lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date:from :references:cc:to:subject; bh=CA7nKj6cXWX2K2ZEnHqn1G5dSNvdpij3k5GjBfdMQYI=; b=LACSFCrJZZE9X4si1ZCiai7kgd/QbLMTTA0AtCXPuwGvtKB8affX4WHM201dI3cHUS 2GejtaRap2BKlT8exmR3YI95IgdnDSqf6g6LB2BXXvGfc3EXQom8pF9cDie8y88cgk1f evg9z6NDGbPdVbqX4mWrkiM7OGk7UDIF1VYxnEuGfUMe9JXZ0mv5QA4TWg6b5oz1jlwI nE11q/t80x2LCBjto38YO7cvmDvicVkDQMAVfBW7yCoi9c0B+9HayH2aXqfXARa7LEQ0 YUSkgxb63wqk0UnXkk75zk/O+gePPuZgRQjV9s1Nsa/cTL8CgyB6vktzBNm6A88wfRUY 2Y6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k12si2026472plt.28.2019.04.18.06.07.14; Thu, 18 Apr 2019 06:07:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388921AbfDRNGP (ORCPT + 99 others); Thu, 18 Apr 2019 09:06:15 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:36902 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727807AbfDRNGP (ORCPT ); Thu, 18 Apr 2019 09:06:15 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x3ID55lK107407 for ; Thu, 18 Apr 2019 09:06:12 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2rxqjrxdcv-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Apr 2019 09:06:08 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Apr 2019 14:05:26 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 18 Apr 2019 14:05:24 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x3ID5NKZ42008590 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 Apr 2019 13:05:23 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 13D6411C04A; Thu, 18 Apr 2019 13:05:23 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 10A6711C064; Thu, 18 Apr 2019 13:05:22 +0000 (GMT) Received: from [9.145.32.15] (unknown [9.145.32.15]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 18 Apr 2019 13:05:21 +0000 (GMT) Subject: Re: [PATCH] mm: use mm.arg_lock in get_cmdline() To: Michal Hocko Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yang Shi , Michal Koutny References: <20190418125827.57479-1-ldufour@linux.ibm.com> <20190418130310.GJ6567@dhcp22.suse.cz> From: Laurent Dufour Date: Thu, 18 Apr 2019 15:05:21 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190418130310.GJ6567@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 19041813-0028-0000-0000-00000362388D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19041813-0029-0000-0000-00002421792A Message-Id: <749b8c73-a97d-b568-c0e5-a7bda77090c9@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-04-18_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=768 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904180093 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 18/04/2019 à 15:03, Michal Hocko a écrit : > Michal has posted the same patch few days ago http://lkml.kernel.org/r/20190417120347.15397-1-mkoutny@suse.com Oups, sorry for the noise, I missed it. > On Thu 18-04-19 14:58:27, Laurent Dufour wrote: >> The commit 88aa7cc688d4 ("mm: introduce arg_lock to protect arg_start|end >> and env_start|end in mm_struct") introduce the spinlock arg_lock to protect >> the arg_* and env_* field of the mm_struct structure. >> >> While reading the code, I found that this new spinlock was not used in >> get_cmdline() to protect access to these fields. >> >> Fixing this even if there is no issue reported yet for this. >> >> Fixes: 88aa7cc688d4 ("mm: introduce arg_lock to protect arg_start|end and env_start|end in mm_struct") >> Cc: Yang Shi >> Signed-off-by: Laurent Dufour >> --- >> mm/util.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/mm/util.c b/mm/util.c >> index 05a464929b3e..789760c3028b 100644 >> --- a/mm/util.c >> +++ b/mm/util.c >> @@ -758,12 +758,12 @@ int get_cmdline(struct task_struct *task, char *buffer, int buflen) >> if (!mm->arg_end) >> goto out_mm; /* Shh! No looking before we're done */ >> >> - down_read(&mm->mmap_sem); >> + spin_lock(&mm->arg_lock); >> arg_start = mm->arg_start; >> arg_end = mm->arg_end; >> env_start = mm->env_start; >> env_end = mm->env_end; >> - up_read(&mm->mmap_sem); >> + spin_unlock(&mm->arg_lock); >> >> len = arg_end - arg_start; >> >> -- >> 2.21.0 >