Re: Unsized Arrays in Structures, and user space
- From: "Don Burn" <burn@xxxxxxxxxxxxxxxx>
- Date: Wed, 14 Dec 2005 07:34:07 -0500
First it is a security hole, second how do you know when it is time to
unmap? For instance what happens if the application crashes, you will not
get a notification yet you have a lot of memory reservered. Also, once you
have data you still need to tell the application, with the buffers passed in
by an IOCTL for instance this is part of the completion.
Basically, the Windows model assumes the application passes them in, yes you
can do it another way, but you are likely to be creating more problems than
you solve.
--
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:udA448IAGHA.356@xxxxxxxxxxxxxxxxxxxxxxx
> 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
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
>
.
- References:
- Unsized Arrays in Structures, and user space
- From: Hesham Desouky
- Re: Unsized Arrays in Structures, and user space
- From: Don Burn
- Re: Unsized Arrays in Structures, and user space
- From: Hesham Desouky
- Re: Unsized Arrays in Structures, and user space
- From: Don Burn
- Re: Unsized Arrays in Structures, and user space
- From: Hesham Desouky
- Unsized Arrays in Structures, and user space
- Prev by Date: Re: USB interrupttransfer algorithm proceeding ok?
- Next by Date: Re: Converting system time to local time in WDM driver
- Previous by thread: Re: Unsized Arrays in Structures, and user space
- Next by thread: Re: Unsized Arrays in Structures, and user space
- Index(es):
Relevant Pages
|
Loading