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

  • Home
  • SEARCH
  • 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 8816883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:43:22+00:00 2026-06-14T04:43:22+00:00

this is simple sys_call_table hooking code #include <asm/unistd.h> #include <linux/autoconf.h> #include <linux/in.h> #include <linux/init_task.h>

  • 0

this is simple sys_call_table hooking code

#include <asm/unistd.h>
#include <linux/autoconf.h>
#include <linux/in.h>
#include <linux/init_task.h>
#include <linux/ip.h>
#include <linux/kernel.h>
#include <linux/kmod.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/skbuff.h>
#include <linux/stddef.h>
#include <linux/string.h>
#include <linux/syscalls.h>
#include <linux/tcp.h>
#include <linux/types.h>
#include <linux/unistd.h>
#include <linux/version.h>
#include <linux/workqueue.h>

ssize_t *sys_call_table = (ssize_t *)0xc0026e04;

asmlinkage ssize_t (*orig_open)(const char *pathname, int flags);

asmlinkage ssize_t hacked_open(const char *pathname, int flags)
{
    printk(KERN_INFO "SYS_OPEN called : %s\n", pathname);
    return orig_open(pathname, flags);
}

int init_module(void)
{
    orig_open = sys_call_table[__NR_open];      /* line 33 */
    sys_call_table[__NR_open] = hacked_open;    /* line 34 */
    return 0;
}

void cleanup_module(void)
{
    sys_call_table[__NR_open] = orig_open;      /* line 40 */
}

MODULE_LICENSE("GPL");

i got an warning like below

this code works fine but i want to delete warnings. how can i do?

/home/tester/tools/lkm/a.c: In function ‘init_module’:
/home/tester/tools/lkm/a.c:33: warning: assignment makes integer from pointer without a cast
/home/tester/tools/lkm/a.c:34: warning: assignment makes integer from pointer without a cast
/home/tester/tools/lkm/a.c: In function ‘cleanup_module’:
/home/tester/tools/lkm/a.c:40: warning: assignment makes integer from pointer without a cast

  • 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-06-14T04:43:23+00:00Added an answer on June 14, 2026 at 4:43 am

    If you want to silence your compiler, you have to add typecasts (even if it is often a bad idea, this is how your compiler turns it).

    ssize_t *sys_call_table = (ssize_t *)0xc0026e04;
    
    typedef ssize_t (*ftype)(const char *, int);
    
    ftype orig_open;
    
    ssize_t hacked_open(const char *pathname, int flags)
    {
        printf("SYS_OPEN called : %s\n", pathname);
        return orig_open(pathname, flags);
    }
    
    int init_module(void)
    {
        orig_open = (ftype)sys_call_table[__NR_open];
        sys_call_table[__NR_open] = (ssize_t)hacked_open;
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write some simple test code as a demonstration of hooking the
I have a relatively simple pthread program on Linux. For this purpose, I've stripped
Okay, I have this simplified code to plot a simple contour map: try: header
I have some questions about the performance of this simple python script: import sys,
This simple query session = com.jthink.songlayer.hibernate.HibernateUtil.getSession(); Query q = session.createQuery(recNo from SongChanges); giving this
This simple script should theoretically check the form for errors and then print any
This simple example fails to compile in VS2K8: io_service io2; shared_ptr<asio::deadline_timer> dt(make_shared<asio::deadline_timer>(io2, posix_time::seconds(20))); As
This simple regex matching returns a string instead of an object on every browser
This simple Python method I put together just checks to see if Tomcat is
This simple problem is kiling me. I posted something earlier about trying to clean

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.