diff options
| author | James Morris <james.l.morris@oracle.com> | 2017-09-24 22:41:55 -0700 | 
|---|---|---|
| committer | James Morris <james.l.morris@oracle.com> | 2017-09-24 22:41:55 -0700 | 
| commit | 25eabb13c7d67ae32298015c5e28d00f604f412c (patch) | |
| tree | 5bd75c2c1e385c79425bb099f0d19db7fb9c391f /lib/test_debug_virtual.c | |
| parent | ab5348c9c23cd253f5902980d2d8fe067dc24c82 (diff) | |
| parent | e19b205be43d11bff638cad4487008c48d21c103 (diff) | |
Merge tag 'v4.14-rc2' into next-general
Linux 4.14-rc2
Sync to v4.14-rc2 for security subsystem developers to track.
Diffstat (limited to 'lib/test_debug_virtual.c')
| -rw-r--r-- | lib/test_debug_virtual.c | 49 | 
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/test_debug_virtual.c b/lib/test_debug_virtual.c new file mode 100644 index 000000000000..b9cdeecc19dc --- /dev/null +++ b/lib/test_debug_virtual.c @@ -0,0 +1,49 @@ +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/export.h> +#include <linux/mm.h> +#include <linux/vmalloc.h> +#include <linux/slab.h> +#include <linux/sizes.h> + +#include <asm/page.h> +#ifdef CONFIG_MIPS +#include <asm/bootinfo.h> +#endif + +struct foo { +	unsigned int bar; +}; + +struct foo *foo; + +static int __init test_debug_virtual_init(void) +{ +	phys_addr_t pa; +	void *va; + +	va = (void *)VMALLOC_START; +	pa = virt_to_phys(va); + +	pr_info("PA: %pa for VA: 0x%lx\n", &pa, (unsigned long)va); + +	foo = kzalloc(sizeof(*foo), GFP_KERNEL); +	if (!foo) +		return -ENOMEM; + +	pa = virt_to_phys(foo); +	va = foo; +	pr_info("PA: %pa for VA: 0x%lx\n", &pa, (unsigned long)va); + +	return 0; +} +module_init(test_debug_virtual_init); + +static void __exit test_debug_virtual_exit(void) +{ +	kfree(foo); +} +module_exit(test_debug_virtual_exit); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Test module for CONFIG_DEBUG_VIRTUAL");  | 
