From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Petr Tesarik <ptesarik@suse.cz>
Cc: Arnd Bergmann <arnd@arndb.de>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] /dev/mem: handle out-of-bounds read/write
Date: Thu, 30 Jan 2014 05:28:27 -0800 [thread overview]
Message-ID: <20140130132827.GA22557@kroah.com> (raw)
In-Reply-To: <20140130094802.4ee29435@hananiah.suse.cz>
On Thu, Jan 30, 2014 at 09:48:02AM +0100, Petr Tesarik wrote:
> The loff_t type may be wider than phys_addr_t (e.g. on 32-bit systems).
> Consequently, the file offset may be truncated in the assignment.
> Currently, /dev/mem wraps around, which may cause applications to read
> or write incorrect regions of memory by accident.
Does that really happen? If so, that's a userspace bug, right?
> Let's follow POSIX file semantics here and return 0 when reading from
> and -EFBIG when writing to an offset that cannot be represented by a
> phys_addr_t.
>
> Note that the conditional is optimized out by the compiler if loff_t
> has the same size as phys_addr_t.
>
> Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
> ---
> drivers/char/mem.c | 6 ++++++
> 1 file changed, 6 insertions(+)
What is going to break if we apply this patch? :)
thanks,
greg k-h
next prev parent reply other threads:[~2014-01-30 13:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-30 8:48 [PATCH] /dev/mem: handle out-of-bounds read/write Petr Tesarik
2014-01-30 13:28 ` Greg Kroah-Hartman [this message]
2014-01-30 14:03 ` Petr Tesarik
2014-01-30 15:04 ` Greg Kroah-Hartman
2014-04-01 9:29 ` Petr Tesarik
2014-04-01 15:44 ` Greg Kroah-Hartman
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=20140130132827.GA22557@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=ptesarik@suse.cz \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.