From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59A8DC10F0E for ; Thu, 18 Apr 2019 13:06:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2369A20674 for ; Thu, 18 Apr 2019 13:06:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388953AbfDRNGP (ORCPT ); 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 >