* [PATCH] mm: fix protection of mm_struct fields in get_cmdline()
@ 2019-05-15 8:15 Konstantin Khlebnikov
2019-05-15 8:22 ` Oscar Salvador
2019-05-15 8:38 ` Kirill Tkhai
0 siblings, 2 replies; 4+ messages in thread
From: Konstantin Khlebnikov @ 2019-05-15 8:15 UTC (permalink / raw)
To: linux-mm, Andrew Morton, linux-kernel; +Cc: Michal Hocko, Yang Shi
Since commit 88aa7cc688d4 ("mm: introduce arg_lock to protect arg_start|
end and env_start|end in mm_struct") related mm fields are protected with
separate spinlock and mmap_sem held for read is not enough for protection.
Fixes: 88aa7cc688d4 ("mm: introduce arg_lock to protect arg_start|end and env_start|end in mm_struct")
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
---
mm/util.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/util.c b/mm/util.c
index e2e4f8c3fa12..540e7c157cf2 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -717,12 +717,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;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: fix protection of mm_struct fields in get_cmdline()
2019-05-15 8:15 [PATCH] mm: fix protection of mm_struct fields in get_cmdline() Konstantin Khlebnikov
@ 2019-05-15 8:22 ` Oscar Salvador
2019-05-15 8:36 ` Konstantin Khlebnikov
2019-05-15 8:38 ` Kirill Tkhai
1 sibling, 1 reply; 4+ messages in thread
From: Oscar Salvador @ 2019-05-15 8:22 UTC (permalink / raw)
To: Konstantin Khlebnikov
Cc: linux-mm, Andrew Morton, linux-kernel, Michal Hocko, Yang Shi, mkoutny
On Wed, May 15, 2019 at 11:15:37AM +0300, Konstantin Khlebnikov wrote:
> Since commit 88aa7cc688d4 ("mm: introduce arg_lock to protect arg_start|
> end and env_start|end in mm_struct") related mm fields are protected with
> separate spinlock and mmap_sem held for read is not enough for protection.
>
> Fixes: 88aa7cc688d4 ("mm: introduce arg_lock to protect arg_start|end and env_start|end in mm_struct")
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
This was already addressed by [1]?
[1] https://patchwork.kernel.org/patch/10923003/
> ---
> mm/util.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/util.c b/mm/util.c
> index e2e4f8c3fa12..540e7c157cf2 100644
> --- a/mm/util.c
> +++ b/mm/util.c
> @@ -717,12 +717,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;
>
>
--
Oscar Salvador
SUSE L3
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: fix protection of mm_struct fields in get_cmdline()
2019-05-15 8:22 ` Oscar Salvador
@ 2019-05-15 8:36 ` Konstantin Khlebnikov
0 siblings, 0 replies; 4+ messages in thread
From: Konstantin Khlebnikov @ 2019-05-15 8:36 UTC (permalink / raw)
To: Oscar Salvador
Cc: linux-mm, Andrew Morton, linux-kernel, Michal Hocko, Yang Shi, mkoutny
On 15.05.2019 11:22, Oscar Salvador wrote:
> On Wed, May 15, 2019 at 11:15:37AM +0300, Konstantin Khlebnikov wrote:
>> Since commit 88aa7cc688d4 ("mm: introduce arg_lock to protect arg_start|
>> end and env_start|end in mm_struct") related mm fields are protected with
>> separate spinlock and mmap_sem held for read is not enough for protection.
>>
>> Fixes: 88aa7cc688d4 ("mm: introduce arg_lock to protect arg_start|end and env_start|end in mm_struct")
>> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
>
> This was already addressed by [1]?
Yep.
>
> [1] https://patchwork.kernel.org/patch/10923003/
>
>> ---
>> mm/util.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/mm/util.c b/mm/util.c
>> index e2e4f8c3fa12..540e7c157cf2 100644
>> --- a/mm/util.c
>> +++ b/mm/util.c
>> @@ -717,12 +717,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;
>>
>>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: fix protection of mm_struct fields in get_cmdline()
2019-05-15 8:15 [PATCH] mm: fix protection of mm_struct fields in get_cmdline() Konstantin Khlebnikov
2019-05-15 8:22 ` Oscar Salvador
@ 2019-05-15 8:38 ` Kirill Tkhai
1 sibling, 0 replies; 4+ messages in thread
From: Kirill Tkhai @ 2019-05-15 8:38 UTC (permalink / raw)
To: Konstantin Khlebnikov, linux-mm, mkoutny, Andrew Morton, linux-kernel
Cc: Michal Hocko, Yang Shi
Hi, Konstantin,
On 15.05.2019 11:15, Konstantin Khlebnikov wrote:
> Since commit 88aa7cc688d4 ("mm: introduce arg_lock to protect arg_start|
> end and env_start|end in mm_struct") related mm fields are protected with
> separate spinlock and mmap_sem held for read is not enough for protection.
>
> Fixes: 88aa7cc688d4 ("mm: introduce arg_lock to protect arg_start|end and env_start|end in mm_struct")
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
is this already fixed in Michal's series: https://lkml.org/lkml/2019/5/2/422 ?
Thanks,
Kirill
> ---
> mm/util.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/util.c b/mm/util.c
> index e2e4f8c3fa12..540e7c157cf2 100644
> --- a/mm/util.c
> +++ b/mm/util.c
> @@ -717,12 +717,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;
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-05-15 8:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-15 8:15 [PATCH] mm: fix protection of mm_struct fields in get_cmdline() Konstantin Khlebnikov
2019-05-15 8:22 ` Oscar Salvador
2019-05-15 8:36 ` Konstantin Khlebnikov
2019-05-15 8:38 ` Kirill Tkhai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.