Mapping kernel virtual address to user virtual address

From: vishal (vishpat_at_techie.com)
Date: 05/30/04

  • Next message: Kasper Dupont: "Re: Mapping kernel virtual address to user virtual address"
    Date: 29 May 2004 22:22:39 -0700
    
    

    Hi

    I am writing a kernel module for Linux kernel 2.6. I am currently
    dynamically allocating memory in the kernel module using the "kmalloc"
    function call. I am basically DYNAMICALLY creating an array of
    structures in the kernel module. I then plan to fill this array of
    structures with data and export it to the user space. I tried using
    the "do_mmap" function to map the kernel virtual address to the user
    virtual address. However it fails i.e when I try accessing this memory
    region in the userspace I get a segmentation fault. Can someone please
    enlighten me about how do I map the memory area dynamically allocated
    in the kernel space to the user space.

     - Vishal


  • Next message: Kasper Dupont: "Re: Mapping kernel virtual address to user virtual address"

    Relevant Pages

    • Re: Large array in KVM
      ... I'm working on a kernel module that needs to maintain a large ... Could using a memory-mapped file help? ... a process that maps a large file into memory, ... which means a dynamically-allocated syscall via ...
      (freebsd-hackers)
    • Re: shared memory?
      ... > so,we want to create a shared memory segment in a kernel module and we ... > can access the memory in a user space program later. ...
      (comp.os.linux.development.apps)
    • Re: Memory testing in a kernel thread
      ... > Here is my first attempt at a kernel module for testing memory: ... > offline for hours or even days running memtest86. ... I wrote `burnBX` and later `burnMMX` as userland pgms to very ...
      (comp.os.linux.development.system)
    • [PATCH 1/2] module.c: fix module loading failure of large modules (take 2)
      ... When creating the final layout of a kernel module in memory, ... module loader to reserve some additional memory in front of a given section. ... /* Allocator used for allocating struct module, ... return ret; ...
      (Linux-Kernel)
    • [PATCH 1/2] module.c: fix module loading failure of large modules
      ... When creating the final layout of a kernel module in memory, ... module loader to reserve some additional memory behind a given section. ... /* Allocator used for allocating struct module, ... return ret; ...
      (Linux-Kernel)