mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/4] fs: introduce __getname_gfp()
@ 2009-05-16  9:51 Vegard Nossum
  2009-05-16  9:51 ` [PATCH 2/4] kmemcheck: add __GFP_NOTRACK_FALSE_POSITIVE flag Vegard Nossum
  0 siblings, 1 reply; 4+ messages in thread
From: Vegard Nossum @ 2009-05-16  9:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: Pekka Enberg, Ingo Molnar, Al Viro

The purpose of this change is to allow __getname() users to pass a
custom GFP mask to kmem_cache_alloc(). This is needed for annotating
a certain kmemcheck false positive.

Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
---
 include/linux/fs.h |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 5bed436..e45ad64 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1924,8 +1924,9 @@ extern void __init vfs_caches_init(unsigned long);
 
 extern struct kmem_cache *names_cachep;
 
-#define __getname()	kmem_cache_alloc(names_cachep, GFP_KERNEL)
-#define __putname(name) kmem_cache_free(names_cachep, (void *)(name))
+#define __getname_gfp(gfp)	kmem_cache_alloc(names_cachep, (gfp))
+#define __getname()		__getname_gfp(GFP_KERNEL)
+#define __putname(name)		kmem_cache_free(names_cachep, (void *)(name))
 #ifndef CONFIG_AUDITSYSCALL
 #define putname(name)   __putname(name)
 #else
-- 
1.6.0.6


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/4] kmemcheck: add __GFP_NOTRACK_FALSE_POSITIVE flag
  2009-05-16  9:51 [PATCH 1/4] fs: introduce __getname_gfp() Vegard Nossum
@ 2009-05-16  9:51 ` Vegard Nossum
  2009-05-16  9:51   ` [PATCH 3/4] kmemcheck: fix do_mount_root() false positive Vegard Nossum
  0 siblings, 1 reply; 4+ messages in thread
From: Vegard Nossum @ 2009-05-16  9:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: Pekka Enberg, Ingo Molnar

In contrast to __GFP_NOTRACK, this flag indicates that the allocation
should not be tracked _because_ it would produce a false positive.
Their values are identical, but need not be so in the future (for
example, we could now enable/disable false positives with a config
option).

Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
---
 include/linux/gfp.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 2700097..3885e7f 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -58,6 +58,12 @@ struct vm_area_struct;
 #define __GFP_NOTRACK	((__force gfp_t)0)
 #endif
 
+/*
+ * This may seem redundant, but it's a way of annotating false positives vs.
+ * allocations that simply cannot be supported (e.g. page tables).
+ */
+#define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK)
+
 #define __GFP_BITS_SHIFT 22	/* Room for 22 __GFP_FOO bits */
 #define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
 
-- 
1.6.0.6


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/4] kmemcheck: fix do_mount_root() false positive
  2009-05-16  9:51 ` [PATCH 2/4] kmemcheck: add __GFP_NOTRACK_FALSE_POSITIVE flag Vegard Nossum
@ 2009-05-16  9:51   ` Vegard Nossum
  2009-05-16  9:51     ` [PATCH 4/4] kmemcheck: fix __send_signal() " Vegard Nossum
  0 siblings, 1 reply; 4+ messages in thread
From: Vegard Nossum @ 2009-05-16  9:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: Pekka Enberg, Ingo Molnar, Al Viro

Hide the false positive by using the new __getname_gfp() with the
__GFP_NOTRACK_FALSE_POSITIVE flag.

Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
---
 init/do_mounts.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/init/do_mounts.c b/init/do_mounts.c
index dd7ee5f..093f659 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -231,7 +231,8 @@ static int __init do_mount_root(char *name, char *fs, int flags, void *data)
 
 void __init mount_block_root(char *name, int flags)
 {
-	char *fs_names = __getname();
+	char *fs_names = __getname_gfp(GFP_KERNEL
+		| __GFP_NOTRACK_FALSE_POSITIVE);
 	char *p;
 #ifdef CONFIG_BLOCK
 	char b[BDEVNAME_SIZE];
-- 
1.6.0.6


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 4/4] kmemcheck: fix __send_signal() false positive
  2009-05-16  9:51   ` [PATCH 3/4] kmemcheck: fix do_mount_root() false positive Vegard Nossum
@ 2009-05-16  9:51     ` Vegard Nossum
  0 siblings, 0 replies; 4+ messages in thread
From: Vegard Nossum @ 2009-05-16  9:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: Pekka Enberg, Ingo Molnar, Oleg Nesterov

Hide the false positive using the __GFP_NOTRACK_FALSE_POSITIVE flag.
Also made the rlimit override code a bit clearer by introducing a new
variable.

Cc: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
---
 kernel/signal.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index d803473..57c7440 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -829,6 +829,7 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
 {
 	struct sigpending *pending;
 	struct sigqueue *q;
+	int override_rlimit;
 
 	trace_sched_signal_send(sig, t);
 
@@ -860,9 +861,13 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
 	   make sure at least one signal gets delivered and don't
 	   pass on the info struct.  */
 
-	q = __sigqueue_alloc(t, GFP_ATOMIC, (sig < SIGRTMIN &&
-					     (is_si_special(info) ||
-					      info->si_code >= 0)));
+	if (sig < SIGRTMIN)
+		override_rlimit = (is_si_special(info) || info->si_code >= 0);
+	else
+		override_rlimit = 0;
+
+	q = __sigqueue_alloc(t, GFP_ATOMIC | __GFP_NOTRACK_FALSE_POSITIVE,
+		override_rlimit);
 	if (q) {
 		list_add_tail(&q->list, &pending->list);
 		switch ((unsigned long) info) {
-- 
1.6.0.6


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-05-16  9:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-16  9:51 [PATCH 1/4] fs: introduce __getname_gfp() Vegard Nossum
2009-05-16  9:51 ` [PATCH 2/4] kmemcheck: add __GFP_NOTRACK_FALSE_POSITIVE flag Vegard Nossum
2009-05-16  9:51   ` [PATCH 3/4] kmemcheck: fix do_mount_root() false positive Vegard Nossum
2009-05-16  9:51     ` [PATCH 4/4] kmemcheck: fix __send_signal() " Vegard Nossum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®