linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Konovalov <andreyknvl@google.com>
To: Sasha Levin <sashal@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	stable <stable@vger.kernel.org>,
	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>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [PATCH AUTOSEL 4.14 22/33] kasan, slab: make freelist stored without tags
Date: Wed, 13 Mar 2019 20:18:24 +0100	[thread overview]
Message-ID: <CAAeHK+xMxX3Baou=W914tbbPhuPGCBd4wJdgS3O459JEwxw5OQ@mail.gmail.com> (raw)
In-Reply-To: <20190313191506.159677-22-sashal@kernel.org>

On Wed, Mar 13, 2019 at 8:16 PM Sasha Levin <sashal@kernel.org> wrote:
>
> From: Andrey Konovalov <andreyknvl@google.com>
>
> [ Upstream commit 51dedad06b5f6c3eea7ec1069631b1ef7796912a ]

Hi Sasha,

None of the 4.9, 4.14, 4.19 or 4.20 have tag-based KASAN, so
backporting these 3 KASAN related patches doesn't make much sense.

Thanks!


>
> Similarly to "kasan, slub: move kasan_poison_slab hook before
> page_address", move kasan_poison_slab() before alloc_slabmgmt(), which
> calls page_address(), to make page_address() return value to be
> non-tagged.  This, combined with calling kasan_reset_tag() for off-slab
> slab management object, leads to freelist being stored non-tagged.
>
> Link: http://lkml.kernel.org/r/dfb53b44a4d00de3879a05a9f04c1f55e584f7a1.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 | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/mm/slab.c b/mm/slab.c
> index 409631e49295..766043dd3f8e 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -2378,6 +2378,7 @@ static void *alloc_slabmgmt(struct kmem_cache *cachep,
>                 /* Slab management obj is off-slab. */
>                 freelist = kmem_cache_alloc_node(cachep->freelist_cache,
>                                               local_flags, nodeid);
> +               freelist = kasan_reset_tag(freelist);
>                 if (!freelist)
>                         return NULL;
>         } else {
> @@ -2690,6 +2691,13 @@ static struct page *cache_grow_begin(struct kmem_cache *cachep,
>
>         offset *= cachep->colour_off;
>
> +       /*
> +        * Call kasan_poison_slab() before calling alloc_slabmgmt(), so
> +        * page_address() in the latter returns a non-tagged pointer,
> +        * as it should be for slab pages.
> +        */
> +       kasan_poison_slab(page);
> +
>         /* Get slab management. */
>         freelist = alloc_slabmgmt(cachep, page, offset,
>                         local_flags & ~GFP_CONSTRAINT_MASK, page_node);
> @@ -2698,7 +2706,6 @@ static struct page *cache_grow_begin(struct kmem_cache *cachep,
>
>         slab_map_pages(cachep, page, freelist);
>
> -       kasan_poison_slab(page);
>         cache_init_objs(cachep, page);
>
>         if (gfpflags_allow_blocking(local_flags))
> --
> 2.19.1
>

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

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13 19:14 [PATCH AUTOSEL 4.14 01/33] clk: sunxi-ng: v3s: Fix TCON reset de-assert bit Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 02/33] clk: sunxi: A31: Fix wrong AHB gate number Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 03/33] esp: Skip TX bytes accounting when sending from a request socket Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 04/33] ARM: 8824/1: fix a migrating irq bug when hotplug cpu Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 05/33] af_key: unconditionally clone on broadcast Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 06/33] assoc_array: Fix shortcut creation Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 07/33] keys: Fix dependency loop between construction record and auth key Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 08/33] scsi: libiscsi: Fix race between iscsi_xmit_task and iscsi_complete_task Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 09/33] scsi: core: reset host byte in DID_NEXUS_FAILURE case Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 10/33] net: systemport: Fix reception of BPDUs Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 11/33] pinctrl: meson: meson8b: fix the sdxc_a data 1..3 pins Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 12/33] qmi_wwan: apply SET_DTR quirk to Sierra WP7607 Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 13/33] net: mv643xx_eth: disable clk on error path in mv643xx_eth_shared_probe() Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 14/33] mailbox: bcm-flexrm-mailbox: Fix FlexRM ring flush timeout issue Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 15/33] ASoC: topology: free created components in tplg load error Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 16/33] qed: Fix iWARP syn packet mac address validation Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 17/33] arm64: Relax GIC version check during early boot Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 18/33] net: marvell: mvneta: fix DMA debug warning Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 19/33] kasan, slub: move kasan_poison_slab hook before page_address Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 20/33] tmpfs: fix link accounting when a tmpfile is linked in Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 21/33] kasan, slab: fix conflicts with CONFIG_HARDENED_USERCOPY Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 22/33] kasan, slab: make freelist stored without tags Sasha Levin
2019-03-13 19:18   ` Andrey Konovalov [this message]
2019-03-19 19:54     ` Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 23/33] ixgbe: fix older devices that do not support IXGBE_MRQC_L3L4TXSWEN Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 24/33] ARCv2: lib: memcpy: fix doing prefetchw outside of buffer Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 25/33] ARC: uacces: remove lp_start, lp_end from clobber list Sasha Levin
2019-03-13 19:14 ` [PATCH AUTOSEL 4.14 26/33] ARCv2: support manual regfile save on interrupts Sasha Levin
2019-03-13 19:15 ` [PATCH AUTOSEL 4.14 27/33] phonet: fix building with clang Sasha Levin
2019-03-13 19:15 ` [PATCH AUTOSEL 4.14 28/33] mac80211_hwsim: propagate genlmsg_reply return code Sasha Levin
2019-03-13 19:15 ` [PATCH AUTOSEL 4.14 29/33] net: thunderx: make CFG_DONE message to run through generic send-ack sequence Sasha Levin
2019-03-13 19:15 ` [PATCH AUTOSEL 4.14 30/33] nfp: bpf: fix code-gen bug on BPF_ALU | BPF_XOR | BPF_K Sasha Levin
2019-03-13 19:15 ` [PATCH AUTOSEL 4.14 31/33] nfp: bpf: fix ALU32 high bits clearance bug Sasha Levin
2019-03-13 19:15 ` [PATCH AUTOSEL 4.14 32/33] mdio_bus: Fix use-after-free on device_register fails Sasha Levin
2019-03-13 19:15 ` [PATCH AUTOSEL 4.14 33/33] 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='CAAeHK+xMxX3Baou=W914tbbPhuPGCBd4wJdgS3O459JEwxw5OQ@mail.gmail.com' \
    --to=andreyknvl@google.com \
    --cc=akpm@linux-foundation.org \
    --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=sashal@kernel.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).