From ac4e32b9cbe30d22f37a0eb5d91bae5f9b68c0c3 Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Sun, 18 Jun 2017 13:00:49 +0100 Subject: [PATCH] KALLSYMS_ALL, IKCONFIG --- kernel_config_fragment | 17 ++++++++++++----- kernel_module/dep.c | 6 ++++++ kernel_module/ioctl.c | 3 +++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/kernel_config_fragment b/kernel_config_fragment index 3678a68..f71a22d 100644 --- a/kernel_config_fragment +++ b/kernel_config_fragment @@ -1,12 +1,19 @@ -# If you change this file, you need to run: -# rm -rf buildroot/output/build/linux-*.*.*/ -# before ./run -CONFIG_DEBUG_KERNEL=y +# Changes to this file are automatically used in the new kernel +# after ./run, no need to do anything different. + CONFIG_DEBUG_FS=y CONFIG_DEBUG_INFO=y +CONFIG_DEBUG_KERNEL=y CONFIG_GDB_SCRIPTS=y -# KGDB. +# grep lkmc_dep /proc/kallsyms +CONFIG_KALLSYMS_ALL=y + +# zcat /proc/config.gz +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y + +# KGDB CONFIG_CONSOLE_POLL=y CONFIG_KDB_CONTINUE_CATASTROPHIC=0 CONFIG_KDB_DEFAULT_ENABLE=0x1 diff --git a/kernel_module/dep.c b/kernel_module/dep.c index aacf905..8e4d070 100644 --- a/kernel_module/dep.c +++ b/kernel_module/dep.c @@ -25,6 +25,12 @@ sys visibility: cat refcnt # => 1 +proc visibility: + + grep lkmc_dep /proc/kallsyms + +Requires "CONFIG_KALLSYMS_ALL=y". + depmod: grep dep "/lib/module/"*"/depmod" diff --git a/kernel_module/ioctl.c b/kernel_module/ioctl.c index 378a385..fe68962 100644 --- a/kernel_module/ioctl.c +++ b/kernel_module/ioctl.c @@ -14,6 +14,9 @@ Documentation/ioctl/ioctl-number.txt has some info: _IOW an ioctl with write parameters (copy_from_user) _IOR an ioctl with read parameters (copy_to_user) _IOWR an ioctl with both write and read parameters. + +- https://stackoverflow.com/questions/2264384/how-do-i-use-ioctl-to-manipulate-my-kernel-module/44613896#44613896 +- https://askubuntu.com/questions/54239/problem-with-ioctl-in-a-simple-kernel-module/926675#926675 */ #include /* copy_from_user, copy_to_user */