Re: Unsized Arrays in Structures, and user space



just for knowledge,
why mapping to user space is a bad idea?
"Don Burn" <burn@xxxxxxxxxxxxxxxx> wrote in message
news:ODXqGg$$FHA.272@xxxxxxxxxxxxxxxxxxxxxxx
> Well if you possibly can have the application pass the buffers in and have
> the driver lock them down.
>
>
> --
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> Remove StopSpam from the email to reply
>
>
>
> "Hesham Desouky" <hesham> wrote in message
> news:uP60oa$$FHA.292@xxxxxxxxxxxxxxxxxxxxxxx
> > Thanks for reply
> >
> > I am using Compuware Driverworks for driver development and it is c++.
> >
> > Anyhow, what are you suggesting for sharing memory between the driver
and
> > the application?
> >
> > The driver needs to allocate large amount of locked memory to stream
high
> > rate data from hardware device. So what mechanism you sugges?
> >
> > Sorry for double post
> >
> > Thanks
> >
> > "Don Burn" <burn@xxxxxxxxxxxxxxxx> wrote in message
> > news:uT994W$$FHA.3872@xxxxxxxxxxxxxxxxxxxxxxx
> >> Well first mapping anything to user space that was allocated in the
> >> kernel
> >> is a bad idea. Second, mapping ps does not map memory it points to.
> > Third,
> >> asking the level of questions you are, I would not recomend C++ in the
> >> kernel.
> >>
> >>
> >> --
> >> Don Burn (MVP, Windows DDK)
> >> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> >> Remove StopSpam from the email to reply
> >>
> >>
> >>
> >>
> >> "Hesham Desouky" <hesham> wrote in message
> >> news:uuNWSS$$FHA.3392@xxxxxxxxxxxxxxxxxxxxxxx
> >> > Hello all
> >> > I have the following:
> >> >
> >> > struct mystruct
> >> > {
> >> > int a;
> >> > UCHAR d[];
> >> > };
> >> >
> >> > this structure is allocated in the driver from the heap with the
> > following
> >> > code:
> >> >
> >> > PUCHAR p = new(NonPagedPool)UCHAR[sizeof(s) + 512];
> >> >
> >> > mystruct* ps = (mystruct*)ps;
> >> > so now ps->d points to 512 bytes;
> >> >
> >> > If I mapped the ps structure to the user space, is d will have the
> > coorect
> >> > mapped use space address to point to the allocated memory?
> >> >
> >> > Thanks for support
> >> >
> >> >
> >>
> >>
> >
> >
>
>


.



Relevant Pages

  • Re: PCI device driver question
    ... program to find the physical address of the pci device's memory. ... device read and write functions in the pci device driver. ... user space into kernel space (possibly to a small temporary holding ...
    (comp.os.linux.development.system)
  • Re: user_to_phys() without mmap?
    ... |> ram, not some PCI or AGP video card), but mmap'ing from kernel space ... |> into user space is causing large latencies and unsightly artifacts. ... | virtual memory locations from user space, ... Directly mapping physical memory to a process _can_, of course, be very ...
    (comp.os.linux.development.system)
  • Re: sleeping and waiting and tasklets
    ... care must be used when accessing user space from kernel code. ... being addressed might not be currently present in memory, ... The net result for the driver writer is that any ... they also check whether the user space pointer is valid. ...
    (comp.os.linux.development.system)
  • Re: [PATCH] drivers/base: export gpl (un)register_memory_notifier
    ... If a driver doesn't know anything else about the mapping structure, ... the normal solution in kernel for this type of problem is a multi ... This doesn't sound right to be implemented in a device driver. ... When the memory is in a particular configuration (range of memory ...
    (Linux-Kernel)
  • Re: [patch 5/6] mmu_notifier: Support for drivers with revers maps (f.e. for XPmem)
    ... for these communication buffers? ... allowing any memory region be accessible, but I am not sure of that. ... Then you should create a driver that the user program can register ... some kind of mapping so that userspace can unmap pages / won't leak ...
    (Linux-Kernel)