linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Andrey Konovalov <andreyknvl@google.com>,
	Alexander Potapenko <glider@google.com>,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	Evgeniy Stepanov <eugenis@google.com>,
	Kostya Serebryany <kcc@google.com>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Sasha Levin <sashal@kernel.org>,
	linux-mm@kvack.org
Subject: [PATCH AUTOSEL 4.9 14/24] kasan, slab: fix conflicts with CONFIG_HARDENED_USERCOPY
Date: Wed, 13 Mar 2019 15:16:37 -0400	[thread overview]
Message-ID: <20190313191647.160171-14-sashal@kernel.org> (raw)
In-Reply-To: <20190313191647.160171-1-sashal@kernel.org>

From: Andrey Konovalov <andreyknvl@google.com>

[ Upstream commit 219667c23c68eb3dbc0d5662b9246f28477fe529 ]

Similarly to commit 96fedce27e13 ("kasan: make tag based mode work with
CONFIG_HARDENED_USERCOPY"), we need to reset pointer tags in
__check_heap_object() in mm/slab.c before doing any pointer math.

Link: http://lkml.kernel.org/r/9a5c0f958db10e69df5ff9f2b997866b56b7effc.1550602886.git.andreyknvl@google.com
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Tested-by: Qian Cai <cai@lca.pw>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Evgeniy Stepanov <eugenis@google.com>
Cc: Kostya Serebryany <kcc@google.com>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 mm/slab.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/slab.c b/mm/slab.c
index 354a09deecff..b30b58de793b 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -4461,6 +4461,8 @@ const char *__check_heap_object(const void *ptr, unsigned long n,
 	unsigned int objnr;
 	unsigned long offset;
 
+	ptr = kasan_reset_tag(ptr);
+
 	/* Find and validate object. */
 	cachep = page->slab_cache;
 	objnr = obj_to_index(cachep, page, (void *)ptr);
-- 
2.19.1


  parent reply	other threads:[~2019-03-13 19:17 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13 19:16 [PATCH AUTOSEL 4.9 01/24] clk: sunxi: A31: Fix wrong AHB gate number Sasha Levin
2019-03-13 19:16 ` [PATCH AUTOSEL 4.9 02/24] ARM: 8824/1: fix a migrating irq bug when hotplug cpu Sasha Levin
2019-03-13 19:16 ` [PATCH AUTOSEL 4.9 03/24] assoc_array: Fix shortcut creation Sasha Levin
2019-03-13 19:16 ` [PATCH AUTOSEL 4.9 04/24] scsi: libiscsi: Fix race between iscsi_xmit_task and iscsi_complete_task Sasha Levin
2019-03-13 19:16 ` [PATCH AUTOSEL 4.9 05/24] net: systemport: Fix reception of BPDUs Sasha Levin
2019-03-13 19:16 ` [PATCH AUTOSEL 4.9 06/24] pinctrl: meson: meson8b: fix the sdxc_a data 1..3 pins Sasha Levin
2019-03-13 19:16 ` [PATCH AUTOSEL 4.9 07/24] qmi_wwan: apply SET_DTR quirk to Sierra WP7607 Sasha Levin
2019-03-13 19:16 ` [PATCH AUTOSEL 4.9 08/24] net: mv643xx_eth: disable clk on error path in mv643xx_eth_shared_probe() Sasha Levin
2019-03-13 19:16 ` [PATCH AUTOSEL 4.9 09/24] ASoC: topology: free created components in tplg load error Sasha Levin
2019-03-13 19:16 ` [PATCH AUTOSEL 4.9 10/24] arm64: Relax GIC version check during early boot Sasha Levin
2019-03-13 19:16 ` [PATCH AUTOSEL 4.9 11/24] net: marvell: mvneta: fix DMA debug warning Sasha Levin
2019-03-13 19:16 ` [PATCH AUTOSEL 4.9 12/24] kasan, slub: move kasan_poison_slab hook before page_address Sasha Levin
2019-03-13 19:16 ` [PATCH AUTOSEL 4.9 13/24] tmpfs: fix link accounting when a tmpfile is linked in Sasha Levin
2019-03-13 19:16 ` Sasha Levin [this message]
2019-03-13 19:16 ` [PATCH AUTOSEL 4.9 15/24] kasan, slab: make freelist stored without tags Sasha Levin
2019-03-13 19:16 ` [PATCH AUTOSEL 4.9 16/24] ARCv2: lib: memcpy: fix doing prefetchw outside of buffer Sasha Levin
2019-03-13 19:16 ` [PATCH AUTOSEL 4.9 17/24] ARC: uacces: remove lp_start, lp_end from clobber list Sasha Levin
2019-03-13 19:16 ` [PATCH AUTOSEL 4.9 18/24] phonet: fix building with clang Sasha Levin
2019-03-13 19:16 ` [PATCH AUTOSEL 4.9 19/24] mac80211_hwsim: propagate genlmsg_reply return code Sasha Levin
2019-03-13 19:16 ` [PATCH AUTOSEL 4.9 20/24] net: thunderx: make CFG_DONE message to run through generic send-ack sequence Sasha Levin
2019-03-13 19:16 ` [PATCH AUTOSEL 4.9 21/24] nfp: bpf: fix code-gen bug on BPF_ALU | BPF_XOR | BPF_K Sasha Levin
2019-03-13 19:16 ` [PATCH AUTOSEL 4.9 22/24] nfp: bpf: fix ALU32 high bits clearance bug Sasha Levin
2019-03-13 19:16 ` [PATCH AUTOSEL 4.9 23/24] mdio_bus: Fix use-after-free on device_register fails Sasha Levin
2019-03-13 19:16 ` [PATCH AUTOSEL 4.9 24/24] net: set static variable an initial value in atl2_probe() 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=20190313191647.160171-14-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@google.com \
    --cc=aryabinin@virtuozzo.com \
    --cc=catalin.marinas@arm.com \
    --cc=dvyukov@google.com \
    --cc=eugenis@google.com \
    --cc=glider@google.com \
    --cc=kcc@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --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 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).