Skip to contentSkip to conversation

rcutorture: avoid format string leak to thead name

PATCH Applied Kees Cook 3 participants 3 messages May 22, 2014 Torture-test modules

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 rcutorture: avoid format string leak to thead name

Since the rcutorture thread creation interface does not include format string arguments, make sure the name can never be accidentally processed as a format string.

---
 kernel/torture.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/torture.c +1 -1
index acc9afc2f26e..9dad2ffaf995 100644
@@ -694,7 +694,7 @@ int _torture_create_kthread(int (*fn)(void *arg), void *arg, char *s, char *m,
 	int ret = 0;
 
 	VERBOSE_TOROUT_STRING(m);
-	*tp = kthread_run(fn, arg, s);
+	*tp = kthread_run(fn, arg, "%s", s);
 	if (IS_ERR(*tp)) {
 		ret = PTR_ERR(*tp);
 		VERBOSE_TOROUT_ERRSTRING(f);
Signature · 6 lines
1.7.9.5


-- 
Kees Cook
Chrome OS Security
#1 lore raw
Quoted 5 lines · Kees Cook

Since the rcutorture thread creation interface does not include format string arguments, make sure the name can never be accidentally processed as a format string.

Queued for 3.17, thank you, Kees!

Thanx, Paul

Quoted 25 lines
---
 kernel/torture.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/torture.c +1 -1
index acc9afc2f26e..9dad2ffaf995 100644
@@ -694,7 +694,7 @@ int _torture_create_kthread(int (*fn)(void *arg), void *arg, char *s, char *m,
 	int ret = 0;
 
 	VERBOSE_TOROUT_STRING(m);
-	*tp = kthread_run(fn, arg, s);
+	*tp = kthread_run(fn, arg, "%s", s);
 	if (IS_ERR(*tp)) {
 		ret = PTR_ERR(*tp);
 		VERBOSE_TOROUT_ERRSTRING(f);
Signature · 6 lines
1.7.9.5


-- 
Kees Cook
Chrome OS Security
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Kees Cook
Quoted 5 lines · Kees Cook

Since the rcutorture thread creation interface does not include format string arguments, make sure the name can never be accidentally processed as a format string.

Quoted 23 lines
 kernel/torture.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/torture.c +1 -1
index acc9afc2f26e..9dad2ffaf995 100644
@@ -694,7 +694,7 @@ int _torture_create_kthread(int (*fn)(void *arg), void *arg, char *s, char *m,
 	int ret = 0;
 
 	VERBOSE_TOROUT_STRING(m);
-	*tp = kthread_run(fn, arg, s);
+	*tp = kthread_run(fn, arg, "%s", s);
 	if (IS_ERR(*tp)) {
 		ret = PTR_ERR(*tp);
 		VERBOSE_TOROUT_ERRSTRING(f);
Signature · 6 lines
1.7.9.5


-- 
Kees Cook
Chrome OS Security