cregit-Linux how code gets into the kernel

Release 4.12 include/linux/thread_info.h

Directory: include/linux
/* thread_info.h: common low-level thread information accessors
 *
 * Copyright (C) 2002  David Howells (dhowells@redhat.com)
 * - Incorporating suggestions made by Linus Torvalds
 */

#ifndef _LINUX_THREAD_INFO_H

#define _LINUX_THREAD_INFO_H

#include <linux/types.h>
#include <linux/bug.h>
#include <linux/restart_block.h>

#ifdef CONFIG_THREAD_INFO_IN_TASK
/*
 * For CONFIG_THREAD_INFO_IN_TASK kernels we need <asm/current.h> for the
 * definition of current, but for !CONFIG_THREAD_INFO_IN_TASK kernels,
 * including <asm/current.h> can cause a circular dependency on some platforms.
 */
#include <asm/current.h>

#define current_thread_info() ((struct thread_info *)current)
#endif

#include <linux/bitops.h>

/*
 * For per-arch arch_within_stack_frames() implementations, defined in
 * asm/thread_info.h.
 */
enum {
	
BAD_STACK = -1,
	
NOT_STACK = 0,
	
GOOD_FRAME,
	
GOOD_STACK,
};

#include <asm/thread_info.h>

#ifdef __KERNEL__

#ifdef CONFIG_DEBUG_STACK_USAGE

# define THREADINFO_GFP		(GFP_KERNEL_ACCOUNT | __GFP_NOTRACK | \
                                 __GFP_ZERO)
#else

# define THREADINFO_GFP		(GFP_KERNEL_ACCOUNT | __GFP_NOTRACK)
#endif

/*
 * flag set/clear/test wrappers
 * - pass TIF_xxxx constants to these functions
 */


static inline void set_ti_thread_flag(struct thread_info *ti, int flag) { set_bit(flag, (unsigned long *)&ti->flags); }

Contributors

PersonTokensPropCommitsCommitProp
David Howells2583.33%150.00%
Jeremy Fitzhardinge516.67%150.00%
Total30100.00%2100.00%


static inline void clear_ti_thread_flag(struct thread_info *ti, int flag) { clear_bit(flag, (unsigned long *)&ti->flags); }

Contributors

PersonTokensPropCommitsCommitProp
David Howells2583.33%150.00%
Jeremy Fitzhardinge516.67%150.00%
Total30100.00%2100.00%


static inline int test_and_set_ti_thread_flag(struct thread_info *ti, int flag) { return test_and_set_bit(flag, (unsigned long *)&ti->flags); }

Contributors

PersonTokensPropCommitsCommitProp
David Howells2683.87%150.00%
Jeremy Fitzhardinge516.13%150.00%
Total31100.00%2100.00%


static inline int test_and_clear_ti_thread_flag(struct thread_info *ti, int flag) { return test_and_clear_bit(flag, (unsigned long *)&ti->flags); }

Contributors

PersonTokensPropCommitsCommitProp
David Howells2683.87%150.00%
Jeremy Fitzhardinge516.13%150.00%
Total31100.00%2100.00%


static inline int test_ti_thread_flag(struct thread_info *ti, int flag) { return test_bit(flag, (unsigned long *)&ti->flags); }

Contributors

PersonTokensPropCommitsCommitProp
David Howells2683.87%150.00%
Jeremy Fitzhardinge516.13%150.00%
Total31100.00%2100.00%

#define set_thread_flag(flag) \ set_ti_thread_flag(current_thread_info(), flag) #define clear_thread_flag(flag) \ clear_ti_thread_flag(current_thread_info(), flag) #define test_and_set_thread_flag(flag) \ test_and_set_ti_thread_flag(current_thread_info(), flag) #define test_and_clear_thread_flag(flag) \ test_and_clear_ti_thread_flag(current_thread_info(), flag) #define test_thread_flag(flag) \ test_ti_thread_flag(current_thread_info(), flag) #define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED) #ifndef CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES
static inline int arch_within_stack_frames(const void * const stack, const void * const stackend, const void *obj, unsigned long len) { return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Kees Cook31100.00%1100.00%
Total31100.00%1100.00%

#endif #ifdef CONFIG_HARDENED_USERCOPY extern void __check_object_size(const void *ptr, unsigned long n, bool to_user);
static __always_inline void check_object_size(const void *ptr, unsigned long n, bool to_user) { if (!__builtin_constant_p(n)) __check_object_size(ptr, n, to_user); }

Contributors

PersonTokensPropCommitsCommitProp
Kees Cook36100.00%3100.00%
Total36100.00%3100.00%

#else
static inline void check_object_size(const void *ptr, unsigned long n, bool to_user) { }

Contributors

PersonTokensPropCommitsCommitProp
Kees Cook18100.00%1100.00%
Total18100.00%1100.00%

#endif /* CONFIG_HARDENED_USERCOPY */ #ifndef arch_setup_new_exec
static inline void arch_setup_new_exec(void) { }

Contributors

PersonTokensPropCommitsCommitProp
Kyle Huey8100.00%1100.00%
Total8100.00%1100.00%

#endif #endif /* __KERNEL__ */ #endif /* _LINUX_THREAD_INFO_H */

Overall Contributors

PersonTokensPropCommitsCommitProp
David Howells15037.13%15.26%
Kees Cook11528.47%421.05%
Roman Zippel368.91%15.26%
Jeremy Fitzhardinge256.19%15.26%
Keun-o Park174.21%15.26%
Kyle Huey133.22%15.26%
Thomas Gleixner133.22%15.26%
Andrew Lutomirski102.48%15.26%
Mark Rutland71.73%210.53%
Peter Zijlstra51.24%15.26%
Steven Rostedt30.74%15.26%
Al Viro30.74%15.26%
Roland McGrath30.74%15.26%
Vladimir Davydov20.50%15.26%
Hirofumi Ogawa20.50%15.26%
Total404100.00%19100.00%
Directory: include/linux
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.