From: Don Raikes <don.raikes@oracle.com>
To: "Speakup is a screen review system for Linux."
<speakup@linux-speakup.org>
Subject: RE: ot memory allocation question
Date: Fri, 19 Jul 2013 09:00:18 -0700 (PDT) [thread overview]
Message-ID: <444275b3-63df-4577-835c-04ebc2830eb3@default> (raw)
In-Reply-To: <87fvvawwrj.fsf@mushroom.PK5001Z>
Chris,
I gave that code segmentthat I sent a try, and it gives me an error in the copy_to_user call. It looks like none of the bytes were copied to the userspace buffer.
I also get incompatible pointer types in the call to sys_write
-----Original Message-----
From: Chris Brannon [mailto:chris@the-brannons.com]
Sent: Friday, July 19, 2013 5:38 AM
To: Speakup is a screen review system for Linux.
Subject: Re: ot memory allocation question
Don Raikes <don.raikes@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@linux-speakup.org
http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup
next prev parent reply other threads:[~ UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
Don Raikes
` Chris Brannon
` covici
` Chris Brannon
` covici
` Brian Buhrow
` Don Raikes
` Don Raikes
` Don Raikes [this message]
` Chris Brannon
` Don Raikes
` Jason White
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=444275b3-63df-4577-835c-04ebc2830eb3@default \
--to=don.raikes@oracle.com \
--cc=speakup@linux-speakup.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).