summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
2b271cb)
When building under W=1, the lack of lkdtm.h in lkdtm_usercopy.c and
lkdtm_rodata.c was discovered. This fixes the issue and consolidates
the common header and the pr_fmt macro for simplicity and regularity
across each test source file.
Signed-off-by: Kees Cook <keescook@chromium.org>
#ifndef __LKDTM_H
#define __LKDTM_H
#ifndef __LKDTM_H
#define __LKDTM_H
+#define pr_fmt(fmt) "lkdtm: " fmt
+
+#include <linux/kernel.h>
+
/* lkdtm_bugs.c */
void __init lkdtm_bugs_init(int *recur_param);
void lkdtm_PANIC(void);
/* lkdtm_bugs.c */
void __init lkdtm_bugs_init(int *recur_param);
void lkdtm_PANIC(void);
void lkdtm_USERCOPY_STACK_BEYOND(void);
void lkdtm_USERCOPY_KERNEL(void);
void lkdtm_USERCOPY_STACK_BEYOND(void);
void lkdtm_USERCOPY_KERNEL(void);
* lockups) along with other things that don't fit well into existing LKDTM
* test source files.
*/
* lockups) along with other things that don't fit well into existing LKDTM
* test source files.
*/
-#define pr_fmt(fmt) "lkdtm: " fmt
-
-#include <linux/kernel.h>
-#include <linux/sched.h>
-
+#include <linux/sched.h>
/*
* Make sure our attempts to over run the kernel stack doesn't trigger
/*
* Make sure our attempts to over run the kernel stack doesn't trigger
*
* See Documentation/fault-injection/provoke-crashes.txt for instructions
*/
*
* See Documentation/fault-injection/provoke-crashes.txt for instructions
*/
-#define pr_fmt(fmt) "lkdtm: " fmt
-
-#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/module.h>
#include <linux/buffer_head.h>
#include <linux/fs.h>
#include <linux/module.h>
#include <linux/buffer_head.h>
#include <linux/ide.h>
#endif
#include <linux/ide.h>
#endif
#define DEFAULT_COUNT 10
static int lkdtm_debugfs_open(struct inode *inode, struct file *file);
#define DEFAULT_COUNT 10
static int lkdtm_debugfs_open(struct inode *inode, struct file *file);
* This is for all the tests relating directly to heap memory, including
* page allocation and slab allocations.
*/
* This is for all the tests relating directly to heap memory, including
* page allocation and slab allocations.
*/
-#define pr_fmt(fmt) "lkdtm: " fmt
-
-#include <linux/kernel.h>
-#include <linux/slab.h>
-
/*
* This tries to stay within the next largest power-of-2 kmalloc cache
/*
* This tries to stay within the next largest power-of-2 kmalloc cache
* permissions: non-executable regions, non-writable regions, and
* even non-readable regions.
*/
* permissions: non-executable regions, non-writable regions, and
* even non-readable regions.
*/
-#define pr_fmt(fmt) "lkdtm: " fmt
-
-#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/mman.h>
#include <linux/uaccess.h>
#include <asm/cacheflush.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/mman.h>
#include <linux/uaccess.h>
#include <asm/cacheflush.h>
/* Whether or not to fill the target memory area with do_nothing(). */
#define CODE_WRITE true
#define CODE_AS_IS false
/* Whether or not to fill the target memory area with do_nothing(). */
#define CODE_WRITE true
#define CODE_AS_IS false
* This includes functions that are meant to live entirely in .rodata
* (via objcopy tricks), to validate the non-executability of .rodata.
*/
* This includes functions that are meant to live entirely in .rodata
* (via objcopy tricks), to validate the non-executability of .rodata.
*/
-#include <linux/kernel.h>
void lkdtm_rodata_do_nothing(void)
{
void lkdtm_rodata_do_nothing(void)
{
* This is for all the tests related to copy_to_user() and copy_from_user()
* hardening.
*/
* This is for all the tests related to copy_to_user() and copy_from_user()
* hardening.
*/
-#define pr_fmt(fmt) "lkdtm: " fmt
-
-#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/mman.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/mman.h>