lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190418125827.57479-1-ldufour@linux.ibm.com>
Date:   Thu, 18 Apr 2019 14:58:27 +0200
From:   Laurent Dufour <ldufour@...ux.ibm.com>
To:     mhocko@...nel.org, akpm@...ux-foundation.org
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        Yang Shi <yang.shi@...ux.alibaba.com>
Subject: [PATCH] mm: use mm.arg_lock in get_cmdline()

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@...ux.alibaba.com>
Signed-off-by: Laurent Dufour <ldufour@...ux.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ