LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 01-29-2014, 12:37 PM   #1
anup.estuff
LQ Newbie
 
Registered: Jan 2012
Posts: 15

Rep: Reputation: Disabled
Common issues in Linux Device Driver debugging


I was recently asked this question as to what are the common issues while debugging linux device drivers in an interview. I came up with the following list.
  1. Use of Uninitialized variables.
  2. Accessing array out of bounds.
  3. Improper locking.
  4. Using sleep functions in spinlocks.
  5. Referring to unauthorized memory(Normal segmentation fault).
  6. stack overflow
  7. No permission for accessing some ports/devices through its data structures.
  8. Inappropriate use of synchronization primitives.
  9. Inappropriate sizes of structures due to padding for alignment by compilers.
  10. DMA device given virtual address instead of physical address.
I am just a beginner in device driver field. I am curious to learn and request expert/experienced people here to add/delete/modify my list items with some explanation if possible.
 
Old 01-29-2014, 01:04 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Many of the problems you mention can at least generate a warning at compile time if you put the right compiler options (1, partially 2, partially 9). Some others can be catched with the kernel debugging options (3, 4, 7, 8, 10). I mostly agree with your list, would just add some details. For example, there are more types of addresses than virtual and physical (you have the bus address, user address too). I'd merge also your points 3, 4 and 8.

My list is:
* Mistakes between user, kernel, physical and bus addresses
* Not adapted locking methods: spinlocks instead of mutexes for example
* Race conditions on multicore systems
* Problems in locking user accesses to the driver (locking special file operations for example)
* Use after (k/v)free
* Reference counter problems
* Errors in manual offset calculations
* Different problems when freeing the resources at module unload
* Not checking error codes from called functions
* Not taking into account the errors that may be signalled by the hardware
* Asuming that the hardware will always work correctly
* Not checking data passed by the user application
 
2 members found this post helpful.
Old 01-30-2014, 09:51 PM   #3
anup.estuff
LQ Newbie
 
Registered: Jan 2012
Posts: 15

Original Poster
Rep: Reputation: Disabled
Thanks a lot [Mara]!. It definitely Help!!. Thanks for your time.

Last edited by anup.estuff; 01-30-2014 at 09:52 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] USB device is not claimed by any active driver for every device in Linux 2.4 jacquesdirac Linux - Hardware 3 11-12-2010 08:35 AM
Linux USB Host Controller Driver Writing/debugging rvckumar Linux - Newbie 0 05-05-2009 02:48 AM
LXer: Some common beginner Linux installation issues LXer Syndicated Linux News 0 03-01-2007 05:46 AM
Hard drive issues: common problem with Linux on laptops ? JamesD99 Linux - Laptop and Netbook 4 01-12-2006 03:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 09:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration