I need help understanding why I get an error when I insert a module. I have tried this with no success.
$ sudo modprobe lpfc_scst
FATAL: Error inserting lpfc_scst (/lib/modules/2.6.32-33-generic/extra/lpfc_scst.ko): Unknown symbol in module, or unknown parameter (see dmesg)
$ dmesg | tail
[ 1201.262842] lpfc_scst: Unknown symbol scst_register_target
[ 1201.262949] lpfc_scst: Unknown symbol lpfc_tm_term
[ 1201.263161] lpfc_scst: no symbol version for scst_register_session
[ 1201.263164] lpfc_scst: Unknown symbol scst_register_session
[ 1201.263284] lpfc_scst: no symbol version for scst_rx_mgmt_fn
[ 1201.263286] lpfc_scst: Unknown symbol scst_rx_mgmt_fn
[ 1201.263395] lpfc_scst: no symbol version for scst_unregister_session
[ 1201.263398] lpfc_scst: Unknown symbol scst_unregister_session
[ 1201.263573] lpfc_scst: no symbol version for scst_rx_data
[ 1201.263575] lpfc_scst: Unknown symbol scst_rx_data
$ cat /proc/kallsyms | grep scst_register_target
dffd2a10 r __ksymtab_scst_register_target [scst]
dffd302e r __kstrtab_scst_register_target [scst]
dffd2b34 r __kcrctab_scst_register_target [scst]
dffd2a20 r __ksymtab___scst_register_target_template_non_gpl [scst]
dffd3063 r __kstrtab___scst_register_target_template_non_gpl [scst]
dffd2b3c r __kcrctab___scst_register_target_template_non_gpl [scst]
dffd2c10 r __ksymtab___scst_register_target_template [scst]
dffd308b r __kstrtab___scst_register_target_template [scst]
dffd2de8 r __kcrctab___scst_register_target_template [scst]
dff913a0 t __scst_register_target_template [scst]
dff90dd0 T scst_register_target [scst]
dff91840 T __scst_register_target_template_non_gpl [scst]
$
Many thanks.
I have solved this problem as suggested on this forum:
Compiled scst.
Appended the generated Module.symvers to existent /lib/modules/<version>/build/Module.symvers (Hack. Do not know why the kernel did not see the exported symbols).
Copied the scst to /lib/modules/<version>/extra.
depmod -a.
Compiled lpfc_scst.
Inserted module lpfc_scst with no problems.
Have a nice day.
If you are trying to insmod a module that was build against a kernel source tree/headers that are not the actual source of the running kernel, the most likely cause is that some kernel configuration is different between the running kernel and the one you built the module against.
The linker inside the Linux kernel actually looks at a bunch of things besides the symbol name for matching symbols, including possibly a hash of the function parameter and return value, various config option (preempt / non preempt) when trying to match symbol names. I guess that in your case it does not find the right match due to different config options
This means that the kernel isn't allowing modules to see that variable. It does look like you haven't added your variables to the list of symbols that the kernel exports:
EXPORT_SYMBOL_NOVERS(scst_register_target);
Related
I want to put a breakpoint in a Linux share library in specific offset ( in libTest.so in function 0x1234 ) while I debugging with GEF GDB. But I want to put it with gdb script.
If I run vmmap libTest.so I got
[ Legend: Code | Heap | Stack ]
Start End Offset Perm Path
0x00000012a1XXX 0x00000012a3XXX 0x00000000000000 r-x /lib/libTest.so
0x00000012a3XXX 0x00000012a5XXX 0x000000000XXXX --- /lib/libTest.so
0x00000012aXXXX 0x00000012aXXXX 0x000000000XXXX r-- /lib/libTest.so
0x00000012aXXXX 0x00000012aXXXX 0x000000000XXXX rw- /lib/libTest.so
So the first line is where the code located. So I want to put a breakpoint in 0x00000012a1XXX+0x1234
For now I put that code in GDB script
python
str = gdb.execute('vmmap libTest.so', False, True)
addr_base= (str.split('\n')[2].split(' ')[0])
gdb.execute('b '+addr_base+0x1234)
end
But that is bad code.
Is there any simple way?
I had asked a quesion at kernelnewbies email list and later I thought I found the answer (I thought I can put it in my defconfig). But then later found it was my mistake. So I still have the question and I ask it here to get answer.
This is what I see when I search “KERNEL_RWX” during “make menuconfig” for arm64 kernel(5-10.0-rc5).
The Kconfig file says CONFIG_STRICT_KERNEL_RWX is for setting text and rodata read-only.
Symbol: ARCH_OPTIONAL_KERNEL_RWX [=n]
Type : bool
Defined at arch/Kconfig:928
Symbol: ARCH_OPTIONAL_KERNEL_RWX_DEFAULT [=n]
Type : bool
Defined at arch/Kconfig:931
Symbol: STRICT_KERNEL_RWX [=y]
Type : bool
Defined at arch/Kconfig:937
Prompt: Make kernel text and rodata read-only
Depends on: ARCH_HAS_STRICT_KERNEL_RWX [=y]
Visible if: ARCH_HAS_STRICT_KERNEL_RWX [=y] && ARCH_OPTIONAL_KERNEL_RWX [=n]
Location:
(1) -> General architecture-dependent options
I wanted to try setting STRICT_KERNEL_RWX to =n. The 'Visible if' descriptionn says this option is visible when ARCH_OPTIONAL_KERNEL_RWX is =y which is now =n. (The STRICT_KERNEL_RWX menu didn't appear as a configurable menu in the menuconfig at this time). This is the lines in arch/Kconfig.
config ARCH_OPTIONAL_KERNEL_RWX
def_bool n
So I modified to ARCH_OPTIONAL_KERNEL_RWX=y in arch/Kconfig line 928. (BTW, This is question : is it correct to modify this Kconfig file directly? I’m not sure at the moment)
Then I could see the STRICT_KERNEL_RWX menu in the menuconfig and I set it to =n as I wanted.
But when I build the kernel, I see this errors.
ckim#ckim-ubuntu:~/ProjX/LinuxDevDrv/kernel-release-RD-INFRA-2020.11.30$ makeit
CALL scripts/atomic/check-atomics.sh
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CC arch/arm64/mm/mmu.o
arch/arm64/mm/mmu.c: In function 'parse_rodata':
arch/arm64/mm/mmu.c:595:28: error: 'rodata_enabled' undeclared (first use in this function)
595 | int ret = strtobool(arg, &rodata_enabled);
| ^~~~~~~~~~~~~~
arch/arm64/mm/mmu.c:595:28: note: each undeclared identifier is reported only once for each function it appears in
arch/arm64/mm/mmu.c: In function 'map_entry_trampoline':
arch/arm64/mm/mmu.c:614:18: error: 'rodata_enabled' undeclared (first use in this function)
614 | pgprot_t prot = rodata_enabled ? PAGE_KERNEL_ROX : PAGE_KERNEL_EXEC;
| ^~~~~~~~~~~~~~
arch/arm64/mm/mmu.c: In function 'map_kernel':
arch/arm64/mm/mmu.c:669:23: error: 'rodata_enabled' undeclared (first use in this function)
669 | pgprot_t text_prot = rodata_enabled ? PAGE_KERNEL_ROX : PAGE_KERNEL_EXEC;
| ^~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:283: arch/arm64/mm/mmu.o] Error 1
make[1]: *** [scripts/Makefile.build:500: arch/arm64/mm] Error 2
make: *** [Makefile:1799: arch/arm64] Error 2
variable “rodata_enabled” is defined in init/main.c as below.
#if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX)
bool rodata_enabled __ro_after_init = true;
static int __init set_debug_rodata(char *str)
{
return strtobool(str, &rodata_enabled);
}
__setup("rodata=", set_debug_rodata);
#endif
But now that CONFIG_STRICT_KERNEL_RWX=n, the above lines are not compiled here (CONFIG_STRICT_MODULE_RWX=n too). However, arch/arm64/mm/mmu.c code is still using rodata_enabled. Is this a bug of the code? Or am I missing something?
I can modify init/main.c and include/linux/init.h so that this rodata_enabled and related functions be defined regardless of these CONFIG values and make the errors go away, but I’m curious if this a kind of kernel bug raising compiler error.
So again my question is how should I change ARCH_OPTIONAL_KERNEL_RWX value? I tried setting it in my defconfig file but when I do make xxx_defonfig, the .config file shows still ARCH_OPTIONAL_KERNEL_RWX=n. Should I edit the arch/Kconfig file really?
I followed instrucions from: https://files.ettus.com/manual/page_build_guide.html
I can't build and install uhd and .cpp files for uhd on my Debian. I have error after make command.
cmake .. is ok. The problem is with something called NEON I think.
Processor info:
cat /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 2 (v7l)
BogoMIPS : 995.32
Features : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpd32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x3
CPU part : 0xc08
CPU revision : 2
Hardware : Generic AM33XX (Flattened Device Tree)
Revision : 0000
Serial : 4219BBBK05E9
Release:
lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
Installation:
root#beaglebone:/home/debian/uhd/host/build# make
[ 2%] Built target uhd_rpclib
[ 2%] Built target uhd-resources
[ 3%] Building CXX object lib/CMakeFiles/uhd.dir/convert/convert_with_neon.cpp.o
In file included from /home/debian/uhd/host/lib/convert/convert_with_neon.cpp:10:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h: In member function ‘virtual void __convert_fc32_1_sc16_item32_le_1_PRIORITY_SIMD::operator()(const input_type&, const output_type&, size_t)’:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:6740:1: error: inlining failed in call to always_inline ‘float32x4_t vdupq_n_f32(float32_t)’: target specific option mismatch
vdupq_n_f32 (float32_t __a)
^~~~~~~~~~~
/home/debian/uhd/host/lib/convert/convert_with_neon.cpp:27:33: note: called from here
float32x4_t Q0 = vdupq_n_f32(float(scale_factor));
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /home/debian/uhd/host/lib/convert/convert_with_neon.cpp:10:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:10844:1: error: inlining failed in call to always_inline ‘void vst1_s16(int16_t*, int16x4_t)’: target specific option mismatch
vst1_s16 (int16_t * __a, int16x4_t __b)
^~~~~~~~
/home/debian/uhd/host/lib/convert/convert_with_neon.cpp:50:17: note: called from here
vst1_s16((reinterpret_cast<int16_t*>(&output[i + 4])), D13);
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/debian/uhd/host/lib/convert/convert_with_neon.cpp:10:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:7440:1: error: inlining failed in call to always_inline ‘int32x4_t vcvtq_s32_f32(float32x4_t)’: target specific option mismatch
vcvtq_s32_f32 (float32x4_t __a)
^~~~~~~~~~~~~
/home/debian/uhd/host/lib/convert/convert_with_neon.cpp:47:39: note: called from here
int32x4_t Q9 = vcvtq_s32_f32(Q8);
~~~~~~~~~~~~~^~~~
In file included from /home/debian/uhd/host/lib/convert/convert_with_neon.cpp:10:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:1172:1: error: inlining failed in call to always_inline ‘float32x4_t vmulq_f32(float32x4_t, float32x4_t)’: target specific option mismatch
vmulq_f32 (float32x4_t __a, float32x4_t __b)
^~~~~~~~~
/home/debian/uhd/host/lib/convert/convert_with_neon.cpp:46:35: note: called from here
float32x4_t Q8 = vmulq_f32(Q7, Q0);
~~~~~~~~~^~~~~~~~
In file included from /home/debian/uhd/host/lib/convert/convert_with_neon.cpp:10:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:10392:1: error: inlining failed in call to always_inline ‘float32x4_t vld1q_f32(const float32_t*)’: target specific option mismatch
vld1q_f32 (const float32_t * __a)
^~~~~~~~~
/home/debian/uhd/host/lib/convert/convert_with_neon.cpp:29:36: note: called from here
float32x4_t Q1 = vld1q_f32(reinterpret_cast<const float*>(&input[i]));
~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [lib/CMakeFiles/uhd.dir/build.make:502: lib/CMakeFiles/uhd.dir/convert/convert_with_neon.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:129: lib/CMakeFiles/uhd.dir/all] Error 2
make: *** [Makefile:163: all] Error 2
What I can do now?
Edit file CMakeCache.txt located in uhd/host/build/.
//Use NEON SIMD instuctions, if applicable
NEON_SIMD_ENABLE:BOOL=OFF
Then use:
make
It solve the problem.
I want to add a new module to existing kernel on my machine.
After I compiled and added the module to kernel, modporbe gives me this error
[root#localhost linux-3.10.1]# modprobe -f tcm_qla2xxx
modprobe: ERROR: could not insert 'tcm_qla2xxx': Unknown symbol in module,
umknown parameter (see dmesg)
The dmesg output is:
dmesg | grep tcm_qla2xxx
[252616.940005] tcm_qla2xxx: Unknown symbol btree_last (err 0)
[252616.940027] tcm_qla2xxx: Unknown symbol btree_insert (err 0)
[252616.940080] tcm_qla2xxx: Unknown symbol btree_remove (err 0)
[252616.940119] tcm_qla2xxx: Unknown symbol btree_geo32 (err 0)
[252616.940179] tcm_qla2xxx: Unknown symbol btree_lookup (err 0)
[252616.940194] tcm_qla2xxx: Unknown symbol btree_init (err 0)
[252616.940287] tcm_qla2xxx: Unknown symbol btree_destroy (err 0)
[252616.940302] tcm_qla2xxx: Unknown symbol btree_update (err 0)
[252616.940329] tcm_qla2xxx: Unknown symbol btree_get_prev (err 0)
The tcm_qla2xxx file is not mine, so Makefile and actual code should be alright.
I understand, the most possible I am missing some btree file. In kernel source from where I took the tcm_qla2xxx module, there was a btree.c file in lib/ folder. I am not sure how to add the btree.c file to old kernel without rebuilding the whole kernel.
I do not want to build a new kernel
Thank you
I'm on windows 7 (64bit).
My nim version is:Nim Compiler Version 0.12.0 (2015-12-15) [Windows: i386]
I tried to build libsodium (https://github.com/jedisct1/libsodium) with this nim wrapper (https://github.com/judofyr/sodium.nim)
I've compiled libsodium with VS2013 -> Release Win32
I see the libsodium.lib
i've placed the nim wrapper next to it.
So it looks like this:
\libsodium-1.0.2\Build\Release\Win32\nimwrapper.nim
\libsodium-1.0.2\Build\Release\Win32\libsodium.lib
now i tried to compile the wrapper with
nim c nimwrapper.nim
now i see the following error message:
C:\Users\hello\Downloads\libsodium-1.0.2\Build\Release\Win32>nim c nimwrapper.nim
Hint: system [Processing]
Hint: nimwrapper [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
CC: nimwrapper
c:\users\hello\downloads\libsodium-1.0.2\build\release\win32\nimcache\nimwrapper.c: In function 'nimwrapperInit000':
c:\users\hello\downloads\libsodium-1.0.2\build\release\win32\nimcache\nimwrapper.c:449:2: error: incompatible type for argument 1 of 'HEX24_108328'
LOC2 = HEX24_108328(sig_108406);
^
In file included from c:\users\hello\downloads\libsodium-1.0.2\build\release\win32\nimcache\nimwrapper.c:9:0:
c:\users\hello\downloads\libsodium-1.0.2\build\release\win32\nimcache\nimwrapper.c:330:27: note: expected 'struct Signature108092 *' but argument is of type '
Signature108092'
N_NIMCALL(NimStringDesc*, HEX24_108328)(Signature108092* sig) {
^
C:\Nim\lib/nimbase.h:168:57: note: in definition of macro 'N_NIMCALL'
# define N_NIMCALL(rettype, name) rettype __fastcall name
^
Hint: [Link]
gcc.exe: error: c:\users\hello\downloads\libsodium-1.0.2\build\release\win32\nimcache\nimwrapper.o: No such file or directory
Error: execution of an external program failed: 'gcc.exe -o c:\users\hello\downloads\libsodium-1.0.2\build\release\win32\nimwrapper.exe c:\users\hello\do
wnloads\libsodium-1.0.2\build\release\win32\nimcache\stdlib_parseutils.o c:\users\hello\downloads\libsodium-1.0.2\build\release\win32\nimcache\stdlib_strutils
.o c:\users\hello\downloads\libsodium-1.0.2\build\release\win32\nimcache\stdlib_system.o c:\users\hello\downloads\libsodium-1.0.2\build\release\win32\nimcac
he\nimwrapper.o -lsodium '
C:\Users\hello\Downloads\libsodium-1.0.2\Build\Release\Win32>
Any idea?
I get the same error on Linux, submitted it as a bug: https://github.com/nim-lang/Nim/issues/3962