Re: [PATCH v2 1/3] stacktrace: move arch_within_stack_frames from thread_info.h

2018-04-09 Thread kbuild test robot
Hi Sahara,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.16 next-20180406]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/kpark3469-gmail-com/usercopy-reimplement-arch_within_stack_frames/20180409-144349
config: x86_64-randconfig-x013-201814 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

from include/linux/uaccess.h:5,
from arch/x86/include/asm/stacktrace.h:10,
from include/linux/stacktrace.h:6,
from include/linux/lockdep.h:29,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
   include/linux/spinlock.h:297:24: error: unknown type name 'raw_spinlock_t'
static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
   ^~
   include/linux/spinlock.h:297:55: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
  ^~
  clock_t
   include/linux/spinlock.h:308:39: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_lock(spinlock_t *lock)
  ^~
  clock_t
   include/linux/spinlock.h:313:42: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_lock_bh(spinlock_t *lock)
 ^~
 clock_t
   include/linux/spinlock.h:318:41: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline int spin_trylock(spinlock_t *lock)
^~
clock_t
   include/linux/spinlock.h:333:43: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_lock_irq(spinlock_t *lock)
  ^~
  clock_t
   include/linux/spinlock.h:348:41: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_unlock(spinlock_t *lock)
^~
clock_t
   include/linux/spinlock.h:353:44: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_unlock_bh(spinlock_t *lock)
   ^~
   clock_t
   include/linux/spinlock.h:358:45: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_unlock_irq(spinlock_t *lock)
^~
clock_t
   include/linux/spinlock.h:363:52: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_unlock_irqrestore(spinlock_t *lock, 
unsigned long flags)
   ^~
   clock_t
   include/linux/spinlock.h:368:44: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline int spin_trylock_bh(spinlock_t *lock)
   ^~
   clock_t
   include/linux/spinlock.h:373:45: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline int spin_trylock_irq(spinlock_t *lock)
^~
clock_t
   include/linux/spinlock.h:383:43: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline int spin_is_locked(spinlock_t *lock)
  ^~
  clock_t
   include/linux/spinlock.h:388:46: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline int spin_is_contended(spinlock_t *lock)
 ^~
 clock_t
   include/linux/spinlock.h:408:51: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock);
  

Re: [PATCH v2 1/3] stacktrace: move arch_within_stack_frames from thread_info.h

2018-04-09 Thread kbuild test robot
Hi Sahara,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.16 next-20180406]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/kpark3469-gmail-com/usercopy-reimplement-arch_within_stack_frames/20180409-144349
config: x86_64-randconfig-x013-201814 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

from include/linux/uaccess.h:5,
from arch/x86/include/asm/stacktrace.h:10,
from include/linux/stacktrace.h:6,
from include/linux/lockdep.h:29,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
   include/linux/spinlock.h:297:24: error: unknown type name 'raw_spinlock_t'
static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
   ^~
   include/linux/spinlock.h:297:55: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
  ^~
  clock_t
   include/linux/spinlock.h:308:39: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_lock(spinlock_t *lock)
  ^~
  clock_t
   include/linux/spinlock.h:313:42: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_lock_bh(spinlock_t *lock)
 ^~
 clock_t
   include/linux/spinlock.h:318:41: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline int spin_trylock(spinlock_t *lock)
^~
clock_t
   include/linux/spinlock.h:333:43: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_lock_irq(spinlock_t *lock)
  ^~
  clock_t
   include/linux/spinlock.h:348:41: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_unlock(spinlock_t *lock)
^~
clock_t
   include/linux/spinlock.h:353:44: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_unlock_bh(spinlock_t *lock)
   ^~
   clock_t
   include/linux/spinlock.h:358:45: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_unlock_irq(spinlock_t *lock)
^~
clock_t
   include/linux/spinlock.h:363:52: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_unlock_irqrestore(spinlock_t *lock, 
unsigned long flags)
   ^~
   clock_t
   include/linux/spinlock.h:368:44: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline int spin_trylock_bh(spinlock_t *lock)
   ^~
   clock_t
   include/linux/spinlock.h:373:45: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline int spin_trylock_irq(spinlock_t *lock)
^~
clock_t
   include/linux/spinlock.h:383:43: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline int spin_is_locked(spinlock_t *lock)
  ^~
  clock_t
   include/linux/spinlock.h:388:46: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline int spin_is_contended(spinlock_t *lock)
 ^~
 clock_t
   include/linux/spinlock.h:408:51: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock);
  

Re: [PATCH v2 1/3] stacktrace: move arch_within_stack_frames from thread_info.h

2018-04-09 Thread kbuild test robot
Hi Sahara,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.16 next-20180406]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/kpark3469-gmail-com/usercopy-reimplement-arch_within_stack_frames/20180409-144349
config: i386-randconfig-x071-201814 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

from include/linux/time.h:6,
from include/linux/ktime.h:24,
from include/linux/rcutiny.h:28,
from include/linux/rcupdate.h:211,
from include/linux/rculist.h:11,
from include/linux/pid.h:5,
from include/linux/sched.h:14,
from include/linux/uaccess.h:5,
from arch/x86/include/asm/stacktrace.h:10,
from include/linux/stacktrace.h:6,
from include/linux/lockdep.h:29,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
   include/linux/spinlock.h:297:24: error: unknown type name 'raw_spinlock_t'
static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
   ^~
   include/linux/spinlock.h:297:55: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
  ^~
  clock_t
   include/linux/spinlock.h:308:39: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_lock(spinlock_t *lock)
  ^~
  clock_t
   include/linux/spinlock.h:313:42: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_lock_bh(spinlock_t *lock)
 ^~
 clock_t
   include/linux/spinlock.h:318:41: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline int spin_trylock(spinlock_t *lock)
^~
clock_t
   include/linux/spinlock.h:333:43: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_lock_irq(spinlock_t *lock)
  ^~
  clock_t
   include/linux/spinlock.h:348:41: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_unlock(spinlock_t *lock)
^~
clock_t
   include/linux/spinlock.h:353:44: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_unlock_bh(spinlock_t *lock)
   ^~
   clock_t
   include/linux/spinlock.h:358:45: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_unlock_irq(spinlock_t *lock)
^~
clock_t
   include/linux/spinlock.h:363:52: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_unlock_irqrestore(spinlock_t *lock, 
unsigned long flags)
   ^~
   clock_t
   include/linux/spinlock.h:368:44: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline int spin_trylock_bh(spinlock_t *lock)
   ^~
   clock_t
   include/linux/spinlock.h:373:45: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline int spin_trylock_irq(spinlock_t *lock)
^~
clock_t
   include/linux/spinlock.h:383:43: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline int spin_is_locked(spinlock_t *lock)
  ^~
  clock_t
   include/linux/spinlock.h:388:46: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline 

Re: [PATCH v2 1/3] stacktrace: move arch_within_stack_frames from thread_info.h

2018-04-09 Thread kbuild test robot
Hi Sahara,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.16 next-20180406]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/kpark3469-gmail-com/usercopy-reimplement-arch_within_stack_frames/20180409-144349
config: i386-randconfig-x071-201814 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

from include/linux/time.h:6,
from include/linux/ktime.h:24,
from include/linux/rcutiny.h:28,
from include/linux/rcupdate.h:211,
from include/linux/rculist.h:11,
from include/linux/pid.h:5,
from include/linux/sched.h:14,
from include/linux/uaccess.h:5,
from arch/x86/include/asm/stacktrace.h:10,
from include/linux/stacktrace.h:6,
from include/linux/lockdep.h:29,
from include/linux/spinlock_types.h:18,
from kernel/bounds.c:14:
   include/linux/spinlock.h:297:24: error: unknown type name 'raw_spinlock_t'
static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
   ^~
   include/linux/spinlock.h:297:55: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
  ^~
  clock_t
   include/linux/spinlock.h:308:39: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_lock(spinlock_t *lock)
  ^~
  clock_t
   include/linux/spinlock.h:313:42: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_lock_bh(spinlock_t *lock)
 ^~
 clock_t
   include/linux/spinlock.h:318:41: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline int spin_trylock(spinlock_t *lock)
^~
clock_t
   include/linux/spinlock.h:333:43: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_lock_irq(spinlock_t *lock)
  ^~
  clock_t
   include/linux/spinlock.h:348:41: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_unlock(spinlock_t *lock)
^~
clock_t
   include/linux/spinlock.h:353:44: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_unlock_bh(spinlock_t *lock)
   ^~
   clock_t
   include/linux/spinlock.h:358:45: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_unlock_irq(spinlock_t *lock)
^~
clock_t
   include/linux/spinlock.h:363:52: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline void spin_unlock_irqrestore(spinlock_t *lock, 
unsigned long flags)
   ^~
   clock_t
   include/linux/spinlock.h:368:44: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline int spin_trylock_bh(spinlock_t *lock)
   ^~
   clock_t
   include/linux/spinlock.h:373:45: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline int spin_trylock_irq(spinlock_t *lock)
^~
clock_t
   include/linux/spinlock.h:383:43: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline int spin_is_locked(spinlock_t *lock)
  ^~
  clock_t
   include/linux/spinlock.h:388:46: error: unknown type name 'spinlock_t'; did 
you mean 'clock_t'?
static __always_inline 

[PATCH v2 1/3] stacktrace: move arch_within_stack_frames from thread_info.h

2018-04-09 Thread kpark3469
From: Sahara 

Since the inlined arch_within_stack_frames function was placed within
asm/thread_info.h, using stacktrace functions to unwind stack was
restricted. Now in order to have this function use more abundant apis,
it is moved to architecture's stacktrace.c. And, it is changed from
inline to noinline function to clearly have three depth calls like:

do_usercopy_stack()
  copy_[to|from]_user() : inline
check_copy_size() : inline
  __check_object_size()
check_stack_object()
  arch_within_stack_frames()

With this change, the x86's implementation was slightly changed also.
And, linux/stacktrace.h includes asm/stacktrace.h from now on.

Signed-off-by: Sahara 
Reviewed-by: Kees Cook 
---
 arch/arm/kernel/stacktrace.c   |  1 -
 arch/arm64/kernel/stacktrace.c |  1 -
 arch/mips/kernel/stacktrace.c  |  1 -
 arch/mips/oprofile/backtrace.c |  1 -
 arch/sh/kernel/stacktrace.c|  1 -
 arch/sparc/kernel/stacktrace.c |  1 -
 arch/um/kernel/stacktrace.c|  1 -
 arch/unicore32/kernel/process.c|  1 -
 arch/unicore32/kernel/stacktrace.c |  2 --
 arch/x86/include/asm/thread_info.h | 51 +-
 arch/x86/kernel/Makefile   |  2 +-
 arch/x86/kernel/stacktrace.c   | 50 -
 arch/xtensa/kernel/stacktrace.c|  1 -
 include/linux/page_ext.h   |  1 -
 include/linux/stacktrace.h | 25 +++
 include/linux/thread_info.h| 21 
 kernel/sysctl.c|  1 -
 mm/usercopy.c  |  2 +-
 18 files changed, 77 insertions(+), 87 deletions(-)

diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c
index a56e7c8..d7d629b 100644
--- a/arch/arm/kernel/stacktrace.c
+++ b/arch/arm/kernel/stacktrace.c
@@ -4,7 +4,6 @@
 #include 
 
 #include 
-#include 
 #include 
 
 #if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND)
diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c
index d5718a0..33c4028 100644
--- a/arch/arm64/kernel/stacktrace.c
+++ b/arch/arm64/kernel/stacktrace.c
@@ -25,7 +25,6 @@
 
 #include 
 #include 
-#include 
 
 /*
  * AArch64 PCS assigns the frame pointer to x29.
diff --git a/arch/mips/kernel/stacktrace.c b/arch/mips/kernel/stacktrace.c
index 7c7c902..0b44e10 100644
--- a/arch/mips/kernel/stacktrace.c
+++ b/arch/mips/kernel/stacktrace.c
@@ -8,7 +8,6 @@
 #include 
 #include 
 #include 
-#include 
 
 /*
  * Save stack-backtrace addresses into a stack_trace buffer:
diff --git a/arch/mips/oprofile/backtrace.c b/arch/mips/oprofile/backtrace.c
index 806fb79..845ff8c 100644
--- a/arch/mips/oprofile/backtrace.c
+++ b/arch/mips/oprofile/backtrace.c
@@ -4,7 +4,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/arch/sh/kernel/stacktrace.c b/arch/sh/kernel/stacktrace.c
index 7a73d27..7a7ac4c 100644
--- a/arch/sh/kernel/stacktrace.c
+++ b/arch/sh/kernel/stacktrace.c
@@ -16,7 +16,6 @@
 #include 
 #include 
 #include 
-#include 
 
 static int save_stack_stack(void *data, char *name)
 {
diff --git a/arch/sparc/kernel/stacktrace.c b/arch/sparc/kernel/stacktrace.c
index be4c14c..42cdf86 100644
--- a/arch/sparc/kernel/stacktrace.c
+++ b/arch/sparc/kernel/stacktrace.c
@@ -5,7 +5,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "kstack.h"
 
diff --git a/arch/um/kernel/stacktrace.c b/arch/um/kernel/stacktrace.c
index ebe7bcf..a0d556e 100644
--- a/arch/um/kernel/stacktrace.c
+++ b/arch/um/kernel/stacktrace.c
@@ -14,7 +14,6 @@
 #include 
 #include 
 #include 
-#include 
 
 void dump_trace(struct task_struct *tsk,
const struct stacktrace_ops *ops,
diff --git a/arch/unicore32/kernel/process.c b/arch/unicore32/kernel/process.c
index 2bc10b8..ffca651 100644
--- a/arch/unicore32/kernel/process.c
+++ b/arch/unicore32/kernel/process.c
@@ -36,7 +36,6 @@
 
 #include 
 #include 
-#include 
 
 #include "setup.h"
 
diff --git a/arch/unicore32/kernel/stacktrace.c 
b/arch/unicore32/kernel/stacktrace.c
index 9976e76..f9cd2a4 100644
--- a/arch/unicore32/kernel/stacktrace.c
+++ b/arch/unicore32/kernel/stacktrace.c
@@ -14,8 +14,6 @@
 #include 
 #include 
 
-#include 
-
 #if defined(CONFIG_FRAME_POINTER)
 /*
  * Unwind the current stack frame and store the new register values in the
diff --git a/arch/x86/include/asm/thread_info.h 
b/arch/x86/include/asm/thread_info.h
index a5d9521..e25d70a 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -156,59 +156,10 @@ struct thread_info {
  *
  * preempt_count needs to be 1 initially, until the scheduler is functional.
  */
-#ifndef __ASSEMBLY__
-
-/*
- * Walks up the stack frames to make sure that the specified object is
- * entirely contained by a single stack frame.
- *
- * Returns:
- * GOOD_FRAME  if within a frame
- * BAD_STACK   if placed across a 

[PATCH v2 1/3] stacktrace: move arch_within_stack_frames from thread_info.h

2018-04-09 Thread kpark3469
From: Sahara 

Since the inlined arch_within_stack_frames function was placed within
asm/thread_info.h, using stacktrace functions to unwind stack was
restricted. Now in order to have this function use more abundant apis,
it is moved to architecture's stacktrace.c. And, it is changed from
inline to noinline function to clearly have three depth calls like:

do_usercopy_stack()
  copy_[to|from]_user() : inline
check_copy_size() : inline
  __check_object_size()
check_stack_object()
  arch_within_stack_frames()

With this change, the x86's implementation was slightly changed also.
And, linux/stacktrace.h includes asm/stacktrace.h from now on.

Signed-off-by: Sahara 
Reviewed-by: Kees Cook 
---
 arch/arm/kernel/stacktrace.c   |  1 -
 arch/arm64/kernel/stacktrace.c |  1 -
 arch/mips/kernel/stacktrace.c  |  1 -
 arch/mips/oprofile/backtrace.c |  1 -
 arch/sh/kernel/stacktrace.c|  1 -
 arch/sparc/kernel/stacktrace.c |  1 -
 arch/um/kernel/stacktrace.c|  1 -
 arch/unicore32/kernel/process.c|  1 -
 arch/unicore32/kernel/stacktrace.c |  2 --
 arch/x86/include/asm/thread_info.h | 51 +-
 arch/x86/kernel/Makefile   |  2 +-
 arch/x86/kernel/stacktrace.c   | 50 -
 arch/xtensa/kernel/stacktrace.c|  1 -
 include/linux/page_ext.h   |  1 -
 include/linux/stacktrace.h | 25 +++
 include/linux/thread_info.h| 21 
 kernel/sysctl.c|  1 -
 mm/usercopy.c  |  2 +-
 18 files changed, 77 insertions(+), 87 deletions(-)

diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c
index a56e7c8..d7d629b 100644
--- a/arch/arm/kernel/stacktrace.c
+++ b/arch/arm/kernel/stacktrace.c
@@ -4,7 +4,6 @@
 #include 
 
 #include 
-#include 
 #include 
 
 #if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND)
diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c
index d5718a0..33c4028 100644
--- a/arch/arm64/kernel/stacktrace.c
+++ b/arch/arm64/kernel/stacktrace.c
@@ -25,7 +25,6 @@
 
 #include 
 #include 
-#include 
 
 /*
  * AArch64 PCS assigns the frame pointer to x29.
diff --git a/arch/mips/kernel/stacktrace.c b/arch/mips/kernel/stacktrace.c
index 7c7c902..0b44e10 100644
--- a/arch/mips/kernel/stacktrace.c
+++ b/arch/mips/kernel/stacktrace.c
@@ -8,7 +8,6 @@
 #include 
 #include 
 #include 
-#include 
 
 /*
  * Save stack-backtrace addresses into a stack_trace buffer:
diff --git a/arch/mips/oprofile/backtrace.c b/arch/mips/oprofile/backtrace.c
index 806fb79..845ff8c 100644
--- a/arch/mips/oprofile/backtrace.c
+++ b/arch/mips/oprofile/backtrace.c
@@ -4,7 +4,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/arch/sh/kernel/stacktrace.c b/arch/sh/kernel/stacktrace.c
index 7a73d27..7a7ac4c 100644
--- a/arch/sh/kernel/stacktrace.c
+++ b/arch/sh/kernel/stacktrace.c
@@ -16,7 +16,6 @@
 #include 
 #include 
 #include 
-#include 
 
 static int save_stack_stack(void *data, char *name)
 {
diff --git a/arch/sparc/kernel/stacktrace.c b/arch/sparc/kernel/stacktrace.c
index be4c14c..42cdf86 100644
--- a/arch/sparc/kernel/stacktrace.c
+++ b/arch/sparc/kernel/stacktrace.c
@@ -5,7 +5,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "kstack.h"
 
diff --git a/arch/um/kernel/stacktrace.c b/arch/um/kernel/stacktrace.c
index ebe7bcf..a0d556e 100644
--- a/arch/um/kernel/stacktrace.c
+++ b/arch/um/kernel/stacktrace.c
@@ -14,7 +14,6 @@
 #include 
 #include 
 #include 
-#include 
 
 void dump_trace(struct task_struct *tsk,
const struct stacktrace_ops *ops,
diff --git a/arch/unicore32/kernel/process.c b/arch/unicore32/kernel/process.c
index 2bc10b8..ffca651 100644
--- a/arch/unicore32/kernel/process.c
+++ b/arch/unicore32/kernel/process.c
@@ -36,7 +36,6 @@
 
 #include 
 #include 
-#include 
 
 #include "setup.h"
 
diff --git a/arch/unicore32/kernel/stacktrace.c 
b/arch/unicore32/kernel/stacktrace.c
index 9976e76..f9cd2a4 100644
--- a/arch/unicore32/kernel/stacktrace.c
+++ b/arch/unicore32/kernel/stacktrace.c
@@ -14,8 +14,6 @@
 #include 
 #include 
 
-#include 
-
 #if defined(CONFIG_FRAME_POINTER)
 /*
  * Unwind the current stack frame and store the new register values in the
diff --git a/arch/x86/include/asm/thread_info.h 
b/arch/x86/include/asm/thread_info.h
index a5d9521..e25d70a 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -156,59 +156,10 @@ struct thread_info {
  *
  * preempt_count needs to be 1 initially, until the scheduler is functional.
  */
-#ifndef __ASSEMBLY__
-
-/*
- * Walks up the stack frames to make sure that the specified object is
- * entirely contained by a single stack frame.
- *
- * Returns:
- * GOOD_FRAME  if within a frame
- * BAD_STACK   if placed across a frame boundary (or outside stack)
- * NOT_STACK   unable to determine