ot memory allocation question
covici at ccs.covici.com
covici at ccs.covici.com
Fri Jul 19 11:01:59 EDT 2013
So could we use this inspeakup to write and read from a serial device --
thus circumventing most of our serial problems?
Chris Brannon <chris at the-brannons.com> wrote:
> Don Raikes <don.raikes at oracle.com> writes:
> > My solution:
> >
> > Allocate a new larger buffer inside of the userspace and copy_to_user
> > into the new buffer and then when I pass control to the "real"
> > sys_write function point it to the new buffer.
> > But the problem is how do I allocate this new buffer?
>
> There's no easy way to do this. You can't just pass your kernel
> buffer to the system call you are intercepting, since the intercepted
> call expects a user-space buffer.
> Have a look at this link for some inspiration:
> http://web.cs.wpi.edu/~cs4513/b05/proj1note2.txt
>
> Also be careful about the return value of the real sys_write system
> call. If you're passing it a buffer larger than the n bytes passed in
> from userspace, its return value can be greater than n. Don't just use
> it unmodified as the return value for your function.
>
> -- Chris
> _______________________________________________
> Speakup mailing list
> Speakup at linux-speakup.org
> http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup
--
Your life is like a penny. You're going to lose it. The question is:
How do
you spend it?
John Covici
covici at ccs.covici.com
More information about the Speakup
mailing list