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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:00:10+00:00 2026-06-01T11:00:10+00:00

I am mapping some io memory to vmalloced area of in the driver. I

  • 0

I am mapping some io memory to vmalloced area of in the driver. I am also sharing this area with user processes using flag (PAGE_SHARED in ioremap_page_range).

Now I am able to access this shared memory into user space. I can write and read to this memory. However, if I pass this memory as a buffer to the system calls like recv or send then the calls fails with bad memory (Memory not mapped into user process).

However, I am sure my buffer does not have any issues. So, there seems to be some conflict in the way I am sharing memory and error check for system calls.

driver code:

shared_buf = __get_vm_area(size, VM_IOREMAP, VMALLOCS_START, VMALLOC_END); 
ioremap_page_range(shared_buf->addr, size, phy_addr_of_io, PAGE_SHARED);      

After that I do an ioctl call and pass this shared_buf->addr to the user space application.
I write and read by using this addr. Then I do

ret = recv(sockfd, shared_buf->area, 0) and I get an error "bad addr".   

Instead of that if I try

ret = recv(sockfd, local_buf, size, 0);  
memcpy(shared_buf->addr, local_buf, size); Then it goes without issues.   

(Disclaimer: I do use shared_buf->area in the threads which has not done IOCTL. However it is the same process.)

Can anyone see a mistake?

  • 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-01T11:00:12+00:00Added an answer on June 1, 2026 at 11:00 am

    System calls all validate that the pointer passed in is in the user portion of address space. vmalloc space is not in this user portion; hence, you cannot use it for system calls. More importantly, don’t give user processes direct access to memory in the vmalloc address space. That’s just asking for trouble. And probably horribly insecure – can other processes access that too? Write an mmapable file instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some huge binary files which I'm currently reading using memory mapping on
I'm mapping some legacy views using SchemaAction.None() on the ClassMap, however there are also
I'm learning Fluent NHibernate (and by extension, NHibernate generally). I'm using auto-mapping with some
I've got some c# code that is mapping processes to ip addresses, I'm basically
I'm using Hibernate's JPA impl to model some tables. I'm having trouble mapping a
I am mapping a file("sample.txt") to memory using FileChannel.map() and then closing the channel
I am mapping some pre-existing Business Objects to our database using Entity Framework. These
When I create a copy-on-write mapping (a MAP_PRIVATE) using mmap, then some pages of
I've seen a project where communication between processes was made using shared memory (e.g.
I want to temporary store some mapping data. The mapping is one to one.

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.