I'm using the method dentry_path in my kernel module, compilation work fine but when loading the kernel module I go the error message:
Error: could not insert module my_mod.ko: Unknown symbol in module
And in /var/log/kern.log
May 8 19:45:10 zUbuntu kernel: [ 1173.105984] my_mod: Unknown symbol dentry_path (err 0)
This method is declared like the following:
extern char *dentry_path(struct dentry *, char *, int);
Could you please explain me why I can't link my module using this method ?
I think you need to use dentry_path_raw instead of dentry_path, cause dentry_path isn't exported. Also, dentry_path_raw is the safer version between these two, it's protected with a writelock.
Related
I have NAS Terramaster F4-210 based on arm64 Realtek RTD1296 CPU. It has custom OpenWrt 15.05.1 based firmware with 4.4.18 linux kernel. I want to create kernel module to use my zigbee stick (cdc-acm - USB Modem (CDC ACM) support) and run homeassistant on it.
# uname -a
Linux TNAS-BA68 4.4.18-g8bcbd8a-dirty #1327 SMP Mon Aug 31 11:55:52 CST 2020 aarch64 GNU/Linux
I downloaded appropriate kernel, created some config and after installing my newly compiled module I get the following errors in kernel log:
# modprobe cdc-acm
1 module could not be probed
- cdc-acm
# dmesg
...
cdc_acm: Unknown symbol __copy_to_user (err 0)
cdc_acm: Unknown symbol __copy_from_user (err 0)
cdc_acm: Unknown symbol _mcount (err 0)
As far as I understand that means module expects copy_to_user, copy_from_user, mcount to be part of the kernel (or other loaded module). But kernel doesn't export these symbols:
# cat /proc/kallsyms | grep copy_to_user
ffffff80082923f0 T copy_to_user_page
ffffff80087d2600 T __arch_copy_to_user
ffffff80087e67b0 t kfifo_copy_to_user
ffffff8008871854 T my_copy_to_user
File arch/arm64/include/asm/uaccess.h has definition of copy_to_user:
extern unsigned long __must_check __copy_to_user(void __user *to, const void *from, unsigned long n);
...
static inline unsigned long __must_check copy_to_user(void __user *to, const void *from, unsigned long n)
File arch/arm64/lib/copy_to_user.S contains source code of __copy_to_user:
ENTRY(__copy_to_user)
ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(0)), ARM64_HAS_PAN, CONFIG_ARM64_PAN)
...
ENDPROC(__copy_to_user)
My initial idea was I have bad kernel configuration or bad toolchain. So I used toolchain and OpenWrt+kernel configuration from banana pi W2 board which has the same CPU. Without any luck but compile warning had disappeared.
So can somebody please confirm that the problem can't be solved by applying some different kernel configuration or proper toolchain. Instead kernel source code must be modified. E.g. instead of __copy_to_user one of __arch_copy_to_user or my_copy_to_user must be used.
So my assumption is: Terramaster took kernel sources, modified (probably used __arch_copy_to_user instead of __copy_to_user) and then compiled sources.
BTW: I also checked kernel sources and didn't find __arch_copy_to_user. Does that mean it was introduced by kernel sources modifications or it still can be present thereby usage of some nasty defs.
In my project I use the libvirt library. These are node bindings to libvirt api. As the issue can relate to other cases of bindings I post my question here.
Upon installation with npm install it throws warnings (one below as an example)
../src/domain.cc: In static member function ‘static v8::Local<v8::Object> NLV::Domain::NewInstance(virDomainPtr)’:
../src/domain.cc:197:44: warning: ‘v8::Local<v8::Object> v8::Function::NewInstance() const’ is deprecated (declared at /home/mark/.node-gyp/6.3.1/include/node/v8.h:3243): Use maybe version [-Wdeprecated-declarations]
Local<Object> object = ctor->NewInstance();
^
In use with plain node apps, it later causes no problems. However, when nw.js is involved, it crashes it exactly due to this NewInstance use. For evidence see:
....nwjs/nw: symbol lookup error: ..../project/node_modules/libvirt/
build/Release/libvirt.node:
undefined symbol: _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEi
Aborted (core dumped)
This symbol in question refers the same method - NewInstance.
The code in question, in its pure form looks like this:
Domain::Domain(virDomainPtr handle) : NLVObject(handle) {}
Local<Object> Domain::NewInstance(virDomainPtr handle)
{
Nan::EscapableHandleScope scope;
Local<Function> ctor = Nan::New<Function>(constructor);
Local<Object> object = ctor->NewInstance();
...
As I'm far from being proficient in these V8 matters maybe someone can advise me what to alter and how to make it work.
I am porting some C++ code to Android. One of the source files includes a webrtc header file that causes error during compilation. I have reduced the problem to this simple code:
template <class T, int n>
struct DefaultDeleter<T[n]> {
// Never allow someone to declare something like scoped_ptr<int[10]>.
static_assert(sizeof(T) == -1, "do not use array with size as type");
};
The error I get is:
[armeabi-v7a] Compile++ thumb: dummyclient <= dummy.cpp
dummy.cpp:7:3: warning: identifier 'static_assert' will become a keyword in C++0x [-Wc++0x-compat]
dummy.cpp:5:8: error: 'DefaultDeleter' is not a template
dummy.cpp:7:17: error: expected identifier before 'sizeof'
dummy.cpp:7:17: error: expected ',' or '...' before 'sizeof'
dummy.cpp:7:70: error: ISO C++ forbids declaration of 'static_assert' with no type [-fpermissive]
The same code compiles fine on Windows and Linux. Is there some compiler settings that are required for Android? Regards.
You need to pass the CPPFLAG -std=c++11.
When installing mapcache in cygwin, make produced:
/opt/mapcache/mapcache-rel-1-2-1/lib/core.c: In function ‘mapcache_prefetch_tiles’:
/opt/mapcache/mapcache-rel-1-2-1/lib/core.c:81:3: error: unknown type name ‘apr_thread_t’
apr_thread_t **threads;
^
/opt/mapcache/mapcache-rel-1-2-1/lib/core.c:82:3: error: unknown type name ‘apr_threadattr_t’
apr_threadattr_t *thread_attrs;
^
/opt/mapcache/mapcache-rel-1-2-1/lib/core.c:83:7: warning: unused variable ‘nthreads’ [-Wunused-variable]
int nthreads;
^
/opt/mapcache/mapcache-rel-1-2-1/lib/core.c:82:21: warning: unused variable ‘thread_attrs’ [-Wunused-variable]
apr_threadattr_t *thread_attrs;
^
/opt/mapcache/mapcache-rel-1-2-1/lib/core.c:81:18: warning: unused variable ‘threads’ [-Wunused-variable]
apr_thread_t **threads;
^
I searched for some hints about this error but didn't find anything. Looking for apr_thread_t and cywgin, I found some pages pointing to an error with apache, but not really sure if apache has something to do here.
Any ideas about this please? what is the mapcache forum? is there any? thanks for any hints on this,
Updating the this answer based on post from the mapserver list by the developer of mapcache:
From http://mail-archives.apache.org/mod_mbox/apr-dev/201209.mbox/%3C4994179EC7ED6843AAB0A30A1639E7F825143612EF#DGEX2V.dg.deltagroup.com%3E it would seem that threads are not supported by Apr on cygwin. Currently mapcache does not support unthreaded environments so there's nothing you can do without hacking the mapcache codebase. I believe the change would not be very extensive as the source WMS fetches only need to be sequentialized instead of parralelized in core.c
I'm trying to compile libgpg-error on cygwin but don't seem to be able to get pass the following errors during the make
gen-posix-lock-obj.c:39:3: error: #error sizeof pthread_mutex_t is not known.
# error sizeof pthread_mutex_t is not known.
^
gen-posix-lock-obj.c: In function ‘main’:
gen-posix-lock-obj.c:55:21: error: ‘SIZEOF_PTHREAD_MUTEX_T’ undeclared (first use in this function)
if (sizeof mtx != SIZEOF_PTHREAD_MUTEX_T)
^
gen-posix-lock-obj.c:55:21: note: each undeclared identifier is reported only once for each function it appears in
gen-posix-lock-obj.c:84:11: error: ‘HOST_TRIPLET_STRING’ undeclared (first use in this function)
HOST_TRIPLET_STRING,
the errors are triggered because HAVE_CONFIG_H doesn't seem to be set. I would imagine this would happen during the configure process, but i guess not. Any idea where to look at? I'm not that familiar with the whole automake stuff and some pointers on where to get started or a solution would be great