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 8460563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:38:34+00:00 2026-06-10T13:38:34+00:00

What can a driver do defensively to protect against a user-space app that issues

  • 0

What can a driver do defensively to protect against a user-space app that issues an ioctl call with a pointer whose pointee is of a type/size different from what the driver expects/specified as part of its interface.

For e.g. say IOCTL x expects a (struct foo *) but caller issues it with (unsigned long) ((struct bar *)&bar). Will copy_from_user blow up/compromise the system stability?

Maybe one way is to expect caller to have CAP_SYS_ADMIN and have the implicit trust but is there another/better way?

Thanks.

  • 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-10T13:38:35+00:00Added an answer on June 10, 2026 at 1:38 pm

    copy_to/from_user use void pointers, meaning they are ignorant of any data types you pass. And given your example, even if they were aware of the data type, you still cannot trust your user: He could simply cast to the type you want:

    struct bar *x;
    copy_to_kernel_aware_of_foo((struct foo*)x);
    

    Expecting the caller to have any kinds of root privileges or capabilities also does not solve your problem – root can also make mistakes or be evil.

    Things that can help a bit:

    • Only use copy_to/from_user to copy around untyped byte buffers. Don’t rely on kernel and user space having the same notion of complex data structures.
    • If you only worry about data types being wrong by mistake, you might consider tagging your data structure so that it contains some magic values in between the ‘real’ data. This will not help you against the caller deliberately faking data, though.
    • In terms of an attack surface, the attacker will probably not attack you by passing a wrong data type, but instead provide wrong values. There’s nothing to help you instead of proper validation of all data that is passed to you from user space. Never trust anything without checking!
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a Linux character driver which can print system logs in user space.
Can a driver call a C# web service or any other language?
Using the c# driver for MongoDB I can easily construct a query against which
I have a C# project (let's call it Driver) that uses an unmanaged DLL
i'm trying to communicate with my filesystem driver. I can start the driver with
Can you install a hardware driver, built using WinUSB, along with a C# application
I can't get SQLite Driver working in my sessionfactory. I downloaded SQLite 1.0.48 from
How can I connect to video capture driver without creating a capture window. Is
something driver me crazy here i have a big HTML template which i can't
Possible Duplicate: Can not connect to Oracle via VBA - Driver's SQLSetConnectAttr Failed I

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.