From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Doug Berger <opendmb@gmail.com>,
Laura Abbott <labbott@redhat.com>,
Mike Rapoport <rppt@linux.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Florian Fainelli <f.fainelli@gmail.com>,
Rob Herring <robh@kernel.org>,
"Steven Rostedt (VMware)" <rostedt@goodmis.org>,
Peng Fan <peng.fan@nxp.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Russell King <rmk+kernel@armlinux.org.uk>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH AUTOSEL 4.4 07/20] ARM: 8874/1: mm: only adjust sections of valid mm structures
Date: Wed, 4 Sep 2019 12:02:50 -0400 [thread overview]
Message-ID: <20190904160303.5062-7-sashal@kernel.org> (raw)
In-Reply-To: <20190904160303.5062-1-sashal@kernel.org>
From: Doug Berger <opendmb@gmail.com>
[ Upstream commit c51bc12d06b3a5494fbfcbd788a8e307932a06e9 ]
A timing hazard exists when an early fork/exec thread begins
exiting and sets its mm pointer to NULL while a separate core
tries to update the section information.
This commit ensures that the mm pointer is not NULL before
setting its section parameters. The arguments provided by
commit 11ce4b33aedc ("ARM: 8672/1: mm: remove tasklist locking
from update_sections_early()") are equally valid for not
requiring grabbing the task_lock around this check.
Fixes: 08925c2f124f ("ARM: 8464/1: Update all mm structures with section adjustments")
Signed-off-by: Doug Berger <opendmb@gmail.com>
Acked-by: Laura Abbott <labbott@redhat.com>
Cc: Mike Rapoport <rppt@linux.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Rob Herring <robh@kernel.org>
Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm/mm/init.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index a9f6705aea238..731b7e64715b9 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -691,7 +691,8 @@ static void update_sections_early(struct section_perm perms[], int n)
if (t->flags & PF_KTHREAD)
continue;
for_each_thread(t, s)
- set_section_perms(perms, n, true, s->mm);
+ if (s->mm)
+ set_section_perms(perms, n, true, s->mm);
}
read_unlock(&tasklist_lock);
set_section_perms(perms, n, true, current->active_mm);
--
2.20.1
next prev parent reply other threads:[~2019-09-04 16:03 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-04 16:02 [PATCH AUTOSEL 4.4 01/20] s390/bpf: fix lcgr instruction encoding Sasha Levin
2019-09-04 16:02 ` [PATCH AUTOSEL 4.4 02/20] ARM: OMAP2+: Fix omap4 errata warning on other SoCs Sasha Levin
2019-09-04 16:02 ` [PATCH AUTOSEL 4.4 03/20] s390/bpf: use 32-bit index for tail calls Sasha Levin
2019-09-04 16:02 ` [PATCH AUTOSEL 4.4 04/20] NFSv4: Fix return values for nfs4_file_open() Sasha Levin
2019-09-04 16:02 ` [PATCH AUTOSEL 4.4 05/20] NFS: Fix initialisation of I/O result struct in nfs_pgio_rpcsetup Sasha Levin
2019-09-04 16:02 ` [PATCH AUTOSEL 4.4 06/20] Kconfig: Fix the reference to the IDT77105 Phy driver in the description of ATM_NICSTAR_USE_IDT77105 Sasha Levin
2019-09-04 16:02 ` Sasha Levin [this message]
2019-09-04 16:02 ` [PATCH AUTOSEL 4.4 08/20] r8152: Set memory to all 0xFFs on failed reg reads Sasha Levin
2019-09-04 16:02 ` [PATCH AUTOSEL 4.4 09/20] x86/apic: Fix arch_dynirq_lower_bound() bug for DT enabled machines Sasha Levin
2019-09-04 16:02 ` [PATCH AUTOSEL 4.4 10/20] netfilter: nf_conntrack_ftp: Fix debug output Sasha Levin
2019-09-04 16:02 ` [PATCH AUTOSEL 4.4 11/20] NFSv2: Fix eof handling Sasha Levin
2019-09-04 16:02 ` [PATCH AUTOSEL 4.4 12/20] NFSv2: Fix write regression Sasha Levin
2019-09-04 16:02 ` [PATCH AUTOSEL 4.4 13/20] cifs: set domainName when a domain-key is used in multiuser Sasha Levin
2019-09-04 16:02 ` [PATCH AUTOSEL 4.4 14/20] cifs: Use kzfree() to zero out the password Sasha Levin
2019-09-04 16:02 ` [PATCH AUTOSEL 4.4 15/20] x86/build: Add -Wnoaddress-of-packed-member to REALMODE_CFLAGS, to silence GCC9 build warning Sasha Levin
2019-09-04 16:02 ` [PATCH AUTOSEL 4.4 16/20] sky2: Disable MSI on yet another ASUS boards (P6Xxxx) Sasha Levin
2019-09-04 16:03 ` [PATCH AUTOSEL 4.4 17/20] perf/x86/intel: Restrict period on Nehalem Sasha Levin
2019-09-04 16:03 ` [PATCH AUTOSEL 4.4 18/20] net: stmmac: dwmac-rk: Don't fail if phy regulator is absent Sasha Levin
2019-09-04 16:03 ` [PATCH AUTOSEL 4.4 19/20] tools/power turbostat: fix buffer overrun Sasha Levin
2019-09-04 16:03 ` [PATCH AUTOSEL 4.4 20/20] net: seeq: Fix the function used to release some memory in an error handling path Sasha Levin
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=20190904160303.5062-7-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=f.fainelli@gmail.com \
--cc=geert@linux-m68k.org \
--cc=labbott@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=opendmb@gmail.com \
--cc=peng.fan@nxp.com \
--cc=rmk+kernel@armlinux.org.uk \
--cc=robh@kernel.org \
--cc=rostedt@goodmis.org \
--cc=rppt@linux.ibm.com \
--cc=stable@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).