All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shyam Thombre <sthombre@codeaurora.org>
To: catalin.marinas@arm.com, will.deacon@arm.com,
	ard.biesheuvel@arm.com, mark.rutland@arm.com,
	anshuman.khandual@arm.com, sashal@kernel.org
Cc: Shyam Thombre <sthombre@codeaurora.org>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: mm: reset address tag set by kasan sw tagging
Date: Wed, 10 Jun 2020 16:39:44 +0530	[thread overview]
Message-ID: <1591787384-5823-1-git-send-email-sthombre@codeaurora.org> (raw)

KASAN sw tagging sets a random tag of 8 bits in the top byte of the pointer
returned by the memory allocating functions. So for the functions unaware
of this change, the top 8 bits of the address must be reset which is done
by the function arch_kasan_reset_tag().

Signed-off-by: Shyam Thombre <sthombre@codeaurora.org>
---
 arch/arm64/mm/mmu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index e7fbc62..eae7655 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -723,6 +723,7 @@ int kern_addr_valid(unsigned long addr)
 	pmd_t *pmdp, pmd;
 	pte_t *ptep, pte;
 
+	addr = arch_kasan_reset_tag(addr);
 	if ((((long)addr) >> VA_BITS) != -1UL)
 		return 0;
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


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

WARNING: multiple messages have this Message-ID (diff)
From: Shyam Thombre <sthombre@codeaurora.org>
To: catalin.marinas@arm.com, will.deacon@arm.com,
	ard.biesheuvel@arm.com, mark.rutland@arm.com,
	anshuman.khandual@arm.com, sashal@kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Shyam Thombre <sthombre@codeaurora.org>
Subject: [PATCH] arm64: mm: reset address tag set by kasan sw tagging
Date: Wed, 10 Jun 2020 16:39:44 +0530	[thread overview]
Message-ID: <1591787384-5823-1-git-send-email-sthombre@codeaurora.org> (raw)

KASAN sw tagging sets a random tag of 8 bits in the top byte of the pointer
returned by the memory allocating functions. So for the functions unaware
of this change, the top 8 bits of the address must be reset which is done
by the function arch_kasan_reset_tag().

Signed-off-by: Shyam Thombre <sthombre@codeaurora.org>
---
 arch/arm64/mm/mmu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index e7fbc62..eae7655 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -723,6 +723,7 @@ int kern_addr_valid(unsigned long addr)
 	pmd_t *pmdp, pmd;
 	pte_t *ptep, pte;
 
+	addr = arch_kasan_reset_tag(addr);
 	if ((((long)addr) >> VA_BITS) != -1UL)
 		return 0;
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


             reply	other threads:[~2020-06-10 11:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-10 11:09 Shyam Thombre [this message]
2020-06-10 11:09 ` [PATCH] arm64: mm: reset address tag set by kasan sw tagging Shyam Thombre
2020-06-10 11:36 ` Catalin Marinas
2020-06-10 11:36   ` Catalin Marinas
2020-06-12 13:57   ` Shyam Thombre
2020-06-12 13:57     ` Shyam Thombre
2020-06-15 16:34 ` Will Deacon
2020-06-15 16:34   ` Will Deacon

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=1591787384-5823-1-git-send-email-sthombre@codeaurora.org \
    --to=sthombre@codeaurora.org \
    --cc=anshuman.khandual@arm.com \
    --cc=ard.biesheuvel@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=sashal@kernel.org \
    --cc=will.deacon@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.