From: Rusty Russell <rusty@rustcorp.com.au>
To: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Cc: Ingo Molnar <mingo@elte.hu>, Mike Travis <travis@sgi.com>,
linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH -tip/cpus4096-v2] cpumask: fix cpumask of call_function_data
Date: Tue, 28 Oct 2008 11:46:26 +1100 [thread overview]
Message-ID: <200810281146.28491.rusty@rustcorp.com.au> (raw)
In-Reply-To: <490649AE.6050905@ct.jp.nec.com>
On Tuesday 28 October 2008 10:07:26 Hiroshi Shimamoto wrote:
> So, kmalloc(8, flags) for cpumask_var_t at alloc_cpumask_var().
> But the content is treated as cpumask_t, it causes slab corruption
> with overwritten when the mask data is copied.
Yes. This is another one.
Ingo, please fold.
Subject: Fix slab corruption when using CONFIG_CPUMASK_OFFSTACK
Found by Hiroshi Shimamoto; using assignment on a cpumask_t causes slab
corruption, as we do not allocate sizeof(struct cpumask).
It looks like we will have to stick with allocating all NR_CPUS bits until the
end of the patchset (in the future) where we have eliminated all the
cpumask_t assignments.
(Note: this ban will be enforced by compiler when we get rid of the 'struct
cpumask' definition, which is what we're slowly working towards).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index d1f22ee..004da56 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -182,7 +182,8 @@ int cpumask_any_but(const struct cpumask *mask, unsigned int cpu);
static inline size_t cpumask_size(void)
{
- return BITS_TO_LONGS(nr_cpumask_bits) * sizeof(long);
+ /* FIXME: Use nr_cpumask_bits once all cpumask_t assignments banished */
+ return BITS_TO_LONGS(NR_CPUS) * sizeof(long);
}
/* Deprecated. */
next prev parent reply other threads:[~2008-10-28 0:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-24 4:47 [PATCH -tip/cpus4096-v2] cpumask: fix cpumask of call_function_data Hiroshi Shimamoto
2008-10-24 11:05 ` Rusty Russell
2008-10-24 21:46 ` Hiroshi Shimamoto
2008-10-26 22:40 ` Rusty Russell
2008-10-30 17:44 ` Hiroshi Shimamoto
2008-10-24 11:15 ` Rusty Russell
2008-10-27 12:55 ` Ingo Molnar
2008-10-27 12:59 ` Ingo Molnar
2008-10-27 13:02 ` Ingo Molnar
2008-10-27 13:32 ` Ingo Molnar
2008-10-27 23:07 ` Hiroshi Shimamoto
2008-10-28 0:46 ` Rusty Russell [this message]
2008-10-27 22:21 ` Rusty Russell
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=200810281146.28491.rusty@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=akpm@linux-foundation.org \
--cc=h-shimamoto@ct.jp.nec.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=travis@sgi.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.