f9micro / f9-kernel

An efficient and secure microkernel built for ARM Cortex-M cores, inspired by L4
Other
683 stars 145 forks source link

kprobes: Make kprobe register via symbol name #135

Open louisom opened 8 years ago

louisom commented 8 years ago

In Linux kernel, kprobe can choose to register by address or symbol name, but currently F9 microkernel can only register by address.

In F9 microkernel, it can include ksymbols when compiling kernel with CONFIG_SYMMAP, which means F9 microkernel can support regiser kprobe via symbol name, too.

This commit change two parts in F9 microkernel, ksym and kprobes.

Example usage:

static struct kprobe kp = {
    .symbol_name = "ktimer_handler"
};

or

extern void ktimer_handler(void);
static struct kprobe kp = {
    .addr = ktimer_handler
};
jserv commented 8 years ago

CI fails because of incorrect linkage.

louisom commented 7 years ago

@jserv How could I prevent kernel / user function multiple define?

l4test and kernel all define the name strcmp

build/discoveryf4/user/apps/l4test/string.o: In function `strcmp':
/home/travis/build/f9micro/f9-kernel/user/apps/l4test/string.c:21: multiple definition of `strcmp'
build/discoveryf4/kernel/lib/strcmp.o:/home/travis/build/f9micro/f9-kernel/kernel/lib/strcmp.c:12: first defined here
make: *** [build/discoveryf4/f9_nosym.elf] Error 1
jserv commented 7 years ago

@grapherd, there should be only one implementation providing strcmp: kernel/lib/strcmp.c. You would need appropriate declarations where user applications include include/lib/string.h