bugDazuko - Bugs: bug #18420, Syscall unhooking can cause kernel...

 
 

bug #18420: Syscall unhooking can cause kernel oopses for some processes in linux

Submitted by:  Timo Metsala <timo_metsala>
Submitted on:  Thu 30 Nov 2006 07:45:52 AM UTC  
 
Status: NoneAssigned to: None
Open/Closed: Open

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 30 Nov 2006 08:02:19 AM UTC, comment #1:

This is correctly implemented in the FreeBSD 4/5/6 port, which uses a syscall counter to determine when it is safe to exit.

John Ogness <ogman>
Project Administrator
Thu 30 Nov 2006 07:45:52 AM UTC, original submission:

With syscall hooking in use, dazuko unload causes occasional oopses for random processes.

I'm not exactly sure why, but my best guess is a restarted syscall: a process had an active syscall which was interrupted, and pointer to dazuko code area was stored as the restart point. During this time dazuko is unloaded, and on process' resume, the memory area is not anymore valid, causing an oops for that process.

As a workaround, I managed to get over this by forcing the rmmod (or whatever process doing the module unloading) to sleep for a while after unhooking. The idea being that during this sleep the interrupted syscalls in other processes resume to dazuko code that is still in kernel memory space.

Without the workaround, I was able to reproduce this with about once / 10 unloads. With the workaround, I couldn't repro with a 1000 unloads.

I did it with following code after all unhooking:

set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(2000);

where 2000 is an arbitrary, randomly selected number that in the system in question (SuSE Linux 10.0, 2.6.13-15-smp #1 running on a Intel(R) Xeon(TM) CPU 3.20GHz) seemed to be for approximately 4 seconds IIRC. Starting from kernel version 2.6.9 or so, there is also a function msecs_to_jiffies() which can be used to get more controlled delay.

Timo Metsala <timo_metsala>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by ogman (Posted a comment)
  • -unavailable- added by timo_metsala (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 19 Mar 2011 12:45:21 PM UTCogmanAssigned toogman=>None
    Thu 30 Nov 2006 08:02:19 AM UTCogmanAssigned toNone=>ogman
    Thu 30 Nov 2006 07:45:52 AM UTCtimo_metsalaCarbon-Copy-=>Added timo_metsala

    Back to the top


    Powered by Savane 3.1-cleanup1