linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Dufour <ldufour@linux.ibm.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	Yang Shi <yang.shi@linux.alibaba.com>,
	Michal Koutny <mkoutny@suse.com>
Subject: Re: [PATCH] mm: use mm.arg_lock in get_cmdline()
Date: Thu, 18 Apr 2019 15:05:21 +0200	[thread overview]
Message-ID: <749b8c73-a97d-b568-c0e5-a7bda77090c9@linux.ibm.com> (raw)
In-Reply-To: <20190418130310.GJ6567@dhcp22.suse.cz>

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 <yang.shi@linux.alibaba.com>
>> Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
>> ---
>>   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
> 


  reply	other threads:[~2019-04-18 13:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-18 12:58 Laurent Dufour
2019-04-18 13:03 ` Michal Hocko
2019-04-18 13:05   ` Laurent Dufour [this message]
2019-04-18 16:48     ` Yang Shi

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=749b8c73-a97d-b568-c0e5-a7bda77090c9@linux.ibm.com \
    --to=ldufour@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=mkoutny@suse.com \
    --cc=yang.shi@linux.alibaba.com \
    /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