fs: introduce __getname_gfp()
Subsystems (3)
PATCH 1/4 fs: introduce __getname_gfp()
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.
--- include/linux/fs.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
include/linux/fs.h +3 -2
@@ -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
Signature · 1 line
1.6.0.6
PATCH 2/4 kmemcheck: add __GFP_NOTRACK_FALSE_POSITIVE flag
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).
--- include/linux/gfp.h | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
include/linux/gfp.h +6 -0
@@ -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))
Signature · 1 line
1.6.0.6
PATCH 3/4 kmemcheck: fix do_mount_root() false positive
Hide the false positive by using the new __getname_gfp() with the __GFP_NOTRACK_FALSE_POSITIVE flag.
--- init/do_mounts.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
init/do_mounts.c +2 -1
@@ -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 ];
Signature · 1 line
1.6.0.6
PATCH 4/4 kmemcheck: fix __send_signal() false positive
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.
--- kernel/signal.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-)
kernel/signal.c +8 -3
@@ -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) {
Signature · 1 line
1.6.0.6