how to access Function and variables of module? - linux-kernel

I am currently working on linux modules. We inserted module to the linux kernel. How can we access or manipulate the data that are received by the module?
Is that any possible way to read that values and call that functions in linux?

Related

How to perform Wasm host call from a Go guest?

How can one call custom Wasm host functions from a Go guest?
I've looked at a few examples that show loading a self-contained witx/wat/wasm defined function, but haven't found an example for performing a host-defined call. Some examples I've looked at are for wazero and wasmtime-go here:
wazero example
wasmtime-go example
It would be ideal to be able to make these WebAssembly host calls using pure Go if possible.
Specifically, I'm trying to implement the host calls from the Fastly Compute#Edge ABI defined by compute-at-edge.witx and typenames.witx, but this should be generally applicable to any host defined call / function.

Dynamically loadable Linux security modules

I have seen many articles on LWN about allowing for dynamically loadable Linux security modules (LSM), but it is impossible to find concrete information on how it can be done. The LSM hooks (I don't know if this is the right term) aren't exported in the kernel anymore, but their addresses can be retrieved with kallsyms_lookup_name and then assigned to function declarations.
There are some mentions of LSM hooks not being unloadable, but is this true? What does it even mean? If a Linux loadable kernel module registers some hooks, is it unable to unregister them later? Why is this case? Is there a workaround or a way to force them to unload?
Do dynamically loadable LSMs have to be written differently than built-in LSMs? Or do both use the same conventions and interfaces?
It's technically possible to hotpatch the kernel to add hooks to anything. https://stackoverflow.com/a/6742086/2079814
Another possibility is to leverage kpatch to inject an LSM.
Neither of these options would be considered best practice, but should work in theory. I haven't seen the latter method (kpatch) done before.

Custom builtin functions in jsonnet

Is there a way how I can call golang functions from jsonnet?
Now that there is a go port of jsonnet and for example ksonnet is adding custom native functions I am wondering if there is a way how to extend jsonnet with more native functions?
I have many packages written in golang (with unit-testing, etc) and now it seems like I will need to rewrite some of them into jsonnet.
As discussed in the go-jsonnet's issue Custom builtin functions #223, you can introduce your custom golang functions but a pluggable support is not available - you cannot directly use the functions in a jsonnet binary.
You need to compile your own binary/library that creates an instance of vm.NativeFunction jsonnet VM and then add your native functions there.

Is it possible to use RDMA Mellanox libraries from within a kernel module?

I want to develop a kernel module that is able to send/receive RDMA messages. I am wondering if the Mellanox libraries can be called from kernel space.
Can I call Mellanox RDMA functions from a kernel module?
Answer: I have some working code here: https://github.com/jcarreira/disag-firebox
Most of the RDMA functionality provided by Mellanox devices and other HCAs can be accessed in the kernel through the API provided by the ib_core module, which is very similar to what libibverbs provides in user-space.

Read ARP cache from machine

I'm working on a program that read arp cache from machine. I'm using Cocoa. There's a library called libdnet (libdnet.sourceforge.net) which has arp reading function. But I don't know how to write a code to use that function. Please help.
You'll need to know C and apply that knowledge to call the library's functions. See this question for links to C-learning resources.
Objective-C is a superset of C, so you'll be able to integrate the C code to call those functions into your Objective-C methods just fine once you know both languages.

Resources