Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6787835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:24:48+00:00 2026-05-26T17:24:48+00:00

On an x86 system, I have a Linux kernel module (watcher module) that gets

  • 0

On an x86 system, I have a Linux kernel module (“watcher module”) that gets notified by the kernel each time a particular kernel module (“target”) is loaded. Almost any kernel module can be a target. I use this in an instrumentation system I am working on.

When the watcher module handles such notification, it could be convenient for some reason, if the watcher knew the addresses of ELF sections of the loaded target module. Any ideas how this information could be obtained in kernel space?

Of course I could probably get the contents of the appropriate files in /sys/module/<target_name>/sections/ in user space as soon as the target is loaded and then somehow pass this data to the watcher module but this is too clumsy. I would like to find a way to obtain this information directly in the kernel space.

As far as I have seen in the sources of the module loader, it does not store section addresses in struct module, just creates sysfs files for the sections. May be it is possible to somehow find the kernel objects corresponding to those files and read the needed data from these objects? Or probably use some other approach?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:24:49+00:00Added an answer on May 26, 2026 at 5:24 pm

    After digging into how the information about the sections of a module gets into sysfs, I found no way to retrieve it without using the structure definitions internal to the kernel. Using such stuff is not an option in my project, so I have finally implemented another approach, which is, hopefully, more reliable.

    In short, the idea is as follows. My kernel module uses the user-mode helper API to start a user-space process (a shell executing my script, actually). That process gets the name of the “target” kernel module as a parameter and collects the information about its sections from sysfs (/sys/module/<target_name>/sections/). From the user space, this information can be obtained easily. After that, it passes the collected data to my kernel module as a string via a file in debugfs. The module parses the string and validates its contents. If everything is OK, the names and start addresses of ELF sections will be available.

    I admit, the trick with the user-mode helper is quite clumsy but it gets the job done.

    I have prepared a sample implementation of the approach described above – see “Sections” example.

    For details on the user-mode helper API, see the code in <linux/kmod.c> and <linux/kmod.h> in the kernel sources, namely the definition of call_usermodehelper(). The examples as well as the explanation of typical usage of the API are available in this article.

    Note that the examples from that article are a bit inaccurate: the init function of the module returns the result of call_usermodehelper() there. The latter, however, returns 2-byte status code (at least when called with UMH_WAIT_PROC) rather than 0 or negative error code that init function is expected to return. This may result in runtime warnings. What call_usermodehelper() actually returns, is explained here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are certain conditions that can cause stack overflows on an x86 Linux system:
Assume that you're working a x86 32-bits system. Your task is to implement the
We have a Mono application under Linux that does image processing on a bunch
Apache version 2.2.11 (Unix) Architecture x86_64 Operating system Linux Kernel version 2.6.18-164.el5 Ok, here
I have downloaded kernel 2.6.38-5 and want to add a system call. I did
Compiler: clang++ x86-64 on linux. It has been a while since I have written
I am writing code for a real-time program running in an embedded Linux system.
Once upon a time, to write x86 assembler, for example, you would have instructions
I have a redmine instance deployed on a Linux x86_64 system and I am
I do not have pthreads in my system. Linux vps-sohoportal.hspheredns.com 2.6.18-294.26.1.el5.lve0.8.18xen #1 SMP Thu

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.