From: Andrew Morton <akpm@linux-foundation.org>
To: Balasubramani Vivekanandan <balasubramani_vivekanandan@mentor.com>
Cc: linux-mm@kvack.org
Subject: Re: [PATCH] mm/slub.c: Fix wrong address during slab padding restoration
Date: Tue, 23 Jan 2018 14:50:26 -0800 [thread overview]
Message-ID: <20180123145026.b7ca0a338cd0f2de2787b9c1@linux-foundation.org> (raw)
In-Reply-To: <1516604578-4577-1-git-send-email-balasubramani_vivekanandan@mentor.com>
On Mon, 22 Jan 2018 12:32:58 +0530 Balasubramani Vivekanandan <balasubramani_vivekanandan@mentor.com> wrote:
> From: Balasubramani Vivekanandan <balasubramani_vivekanandan@mentor.com>
>
> Start address calculated for slab padding restoration was wrong.
> Wrong address would point to some section before padding and
> could cause corruption
>
> ...
>
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -838,6 +838,7 @@ static int slab_pad_check(struct kmem_cache *s, struct page *page)
> u8 *start;
> u8 *fault;
> u8 *end;
> + u8 *pad;
> int length;
> int remainder;
>
> @@ -851,8 +852,9 @@ static int slab_pad_check(struct kmem_cache *s, struct page *page)
> if (!remainder)
> return 1;
>
> + pad = end - remainder;
> metadata_access_enable();
> - fault = memchr_inv(end - remainder, POISON_INUSE, remainder);
> + fault = memchr_inv(pad, POISON_INUSE, remainder);
> metadata_access_disable();
> if (!fault)
> return 1;
> @@ -860,9 +862,9 @@ static int slab_pad_check(struct kmem_cache *s, struct page *page)
> end--;
>
> slab_err(s, page, "Padding overwritten. 0x%p-0x%p", fault, end - 1);
> - print_section(KERN_ERR, "Padding ", end - remainder, remainder);
> + print_section(KERN_ERR, "Padding ", pad, remainder);
>
> - restore_bytes(s, "slab padding", POISON_INUSE, end - remainder, end);
> + restore_bytes(s, "slab padding", POISON_INUSE, fault, end);
> return 0;
> }
I don't see why it matters? The current code will overwrite
POISON_INUSE bytes with POISON_INUSE, won't it?
That's a bit strange but not incorrect?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2018-01-23 22:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-22 7:02 Balasubramani Vivekanandan
2018-01-23 22:50 ` Andrew Morton [this message]
2018-01-24 17:52 ` Balasubramani Vivekanandan
-- strict thread matches above, loose matches on Subject: below --
2018-01-22 6:55 Balasubramani Vivekanandan
2018-01-22 6:55 ` [PATCH] mm/slub.c: Fix wrong address during slab padding restoration Balasubramani Vivekanandan
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=20180123145026.b7ca0a338cd0f2de2787b9c1@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=balasubramani_vivekanandan@mentor.com \
--cc=linux-mm@kvack.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