All of lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: linux-arm-kernel@lists.infradead.org
Cc: kernel-team@android.com, Will Deacon <will@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Marc Zyngier <maz@kernel.org>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Russell King <rmk+kernel@armlinux.org.uk>
Subject: [PATCH 5/5] arm64: compat: Poison the compat sigpage
Date: Thu, 18 Mar 2021 17:07:38 +0000	[thread overview]
Message-ID: <20210318170738.7756-6-will@kernel.org> (raw)
In-Reply-To: <20210318170738.7756-1-will@kernel.org>

Commit 9c698bff66ab ("ARM: ensure the signal page contains defined contents")
poisoned the unused portions of the signal page for 32-bit Arm.

Implement the same poisoning for the compat signal page on arm64 rather
than using __GFP_ZERO.

Signed-off-by: Will Deacon <will@kernel.org>
---
 arch/arm64/kernel/vdso.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c
index 16bf0b46fb70..159b72a646ab 100644
--- a/arch/arm64/kernel/vdso.c
+++ b/arch/arm64/kernel/vdso.c
@@ -318,17 +318,20 @@ static int aarch32_alloc_kuser_vdso_page(void)
 	return 0;
 }
 
+#define COMPAT_SIGPAGE_POISON_WORD	0xe7fddef1
 static int aarch32_alloc_sigpage(void)
 {
 	extern char __aarch32_sigret_code_start[], __aarch32_sigret_code_end[];
 	int sigret_sz = __aarch32_sigret_code_end - __aarch32_sigret_code_start;
-	unsigned long sigpage;
+	__le32 poison = cpu_to_le32(COMPAT_SIGPAGE_POISON_WORD);
+	void *sigpage;
 
-	sigpage = get_zeroed_page(GFP_KERNEL);
+	sigpage = (void *)__get_free_page(GFP_KERNEL);
 	if (!sigpage)
 		return -ENOMEM;
 
-	memcpy((void *)sigpage, __aarch32_sigret_code_start, sigret_sz);
+	memset32(sigpage, (__force u32)poison, PAGE_SIZE / sizeof(poison));
+	memcpy(sigpage, __aarch32_sigret_code_start, sigret_sz);
 	aarch32_sig_page = virt_to_page(sigpage);
 	return 0;
 }
-- 
2.31.0.rc2.261.g7f71774620-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-03-18 17:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 17:07 [PATCH 0/5] Minor improvements to the compat vdso and sigpage Will Deacon
2021-03-18 17:07 ` [PATCH 1/5] arm64: vdso: Use GFP_KERNEL for allocating compat vdso and signal pages Will Deacon
2021-03-18 18:03   ` Vincenzo Frascino
2021-03-24 17:28     ` Catalin Marinas
2021-03-18 17:07 ` [PATCH 2/5] arm64: vdso: Remove redundant calls to flush_dcache_page() Will Deacon
2021-03-18 18:05   ` Vincenzo Frascino
2021-03-18 17:07 ` [PATCH 3/5] arm64: compat: Allow signal page to be remapped Will Deacon
2021-03-18 18:06   ` Vincenzo Frascino
2021-03-18 17:07 ` [PATCH 4/5] arm64: vdso: Avoid ISB after reading from cntvct_el0 Will Deacon
2021-03-18 18:08   ` Vincenzo Frascino
2021-03-18 17:07 ` Will Deacon [this message]
2021-03-18 18:13   ` [PATCH 5/5] arm64: compat: Poison the compat sigpage Vincenzo Frascino
2021-03-24 16:58 ` [PATCH 0/5] Minor improvements to the compat vdso and sigpage Catalin Marinas

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=20210318170738.7756-6-will@kernel.org \
    --to=will@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=kernel-team@android.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=vincenzo.frascino@arm.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 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.