System Call Interception

System Call Interception - System Call Interception It is...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
System Call Interception It is important also to install new system calls or intercept existing system calls to add extra functionality. The table of system calls in Linux is defined as: extern void *sys_call_table[]; This is an array of pointer to functions that point to the implementation of the system calls. The indexes of the system calls are defined in /usr/include/syscall.h
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
System Call Interception In init_module save the original call to open or the system call to intercept asmlinkage int (*original_call) (const char *, int, int); init_module(. .) { original_call = sys_call_table[__NR_open]; sys_call_table[__NR_open] = our_sys_open; In your open implementation call the real call at the end. asmlinkage int our_sys_open(const char *filename, int flags, int mode) { // Other stuff return original_call(filename, flags, mode); }
Background image of page 2
/* * syscall.c * * System call "stealing" sample. */ /* * Copyright (C) 2001 by Peter Jay Salzman
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/30/2012 for the course CS 354 taught by Professor Staff during the Fall '08 term at Purdue University-West Lafayette.

Page1 / 8

System Call Interception - System Call Interception It is...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online