All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adam Borowski <kilobyte@angband.pl>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>,
	linux-kernel@vger.kernel.org
Cc: Adam Borowski <kilobyte@angband.pl>,
	stable@vger.kernel.org, #@umbar.angband.pl,
	v3.7-@umbar.angband.pl
Subject: [PATCH 2/5] vt: fix unchecked __put_user() in tioclinux ioctls
Date: Sat,  3 Jun 2017 09:35:06 +0200	[thread overview]
Message-ID: <20170603073509.4718-2-kilobyte@angband.pl> (raw)
In-Reply-To: <20170603073509.4718-1-kilobyte@angband.pl>

Only read access is checked before this call.

Actually, at the moment this is not an issue, as every in-tree arch does
the same manual checks for VERIFY_READ vs VERIFY_WRITE, relying on the MMU
to tell them apart, but this wasn't the case in the past and may happen
again on some odd arch in the future.

If anyone cares about 3.7 and earlier, this is a security hole (untested)
on real 80386 CPUs.

Signed-off-by: Adam Borowski <kilobyte@angband.pl>
CC: stable@vger.kernel.org # v3.7-
---
 drivers/tty/vt/vt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 9309c7da660a..2ebaba16f785 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -2709,13 +2709,13 @@ int tioclinux(struct tty_struct *tty, unsigned long arg)
 	 * related to the kernel should not use this.
 	 */
 			data = vt_get_shift_state();
-			ret = __put_user(data, p);
+			ret = put_user(data, p);
 			break;
 		case TIOCL_GETMOUSEREPORTING:
 			console_lock();	/* May be overkill */
 			data = mouse_reporting();
 			console_unlock();
-			ret = __put_user(data, p);
+			ret = put_user(data, p);
 			break;
 		case TIOCL_SETVESABLANK:
 			console_lock();
@@ -2724,7 +2724,7 @@ int tioclinux(struct tty_struct *tty, unsigned long arg)
 			break;
 		case TIOCL_GETKMSGREDIRECT:
 			data = vt_get_kmsg_redirect();
-			ret = __put_user(data, p);
+			ret = put_user(data, p);
 			break;
 		case TIOCL_SETKMSGREDIRECT:
 			if (!capable(CAP_SYS_ADMIN)) {
-- 
2.11.0

  reply	other threads:[~2017-06-03  7:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-03  7:32 [PATCH 0/5] vt: get rid of worst cases of __put_user/__get_user Adam Borowski
2017-06-03  7:35 ` [PATCH 1/5] vt: use copy_from/to_user instead of __get/put_user for scrnmap ioctls Adam Borowski
2017-06-03  7:35   ` Adam Borowski [this message]
2017-06-03  7:35   ` [PATCH 3/5] vt: use copy_to_user instead of __put_user in GIO_UNIMAP ioctl Adam Borowski
2017-06-05 16:34     ` Alan Cox
2017-06-05 23:05       ` Al Viro
2017-06-03  7:35   ` [PATCH 4/5] vt: use memdup_user in PIO_UNIMAP ioctl Adam Borowski
2017-06-03  7:35   ` [PATCH 5/5] vt: drop access_ok() calls in unimap ioctls Adam Borowski
2017-06-03 15:42 ` [PATCH 0/5] vt: get rid of worst cases of __put_user/__get_user Greg Kroah-Hartman
2017-06-05  6:13   ` Al Viro
2017-06-05  6:41     ` Greg Kroah-Hartman
2017-06-09  9:18     ` 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=20170603073509.4718-2-kilobyte@angband.pl \
    --to=kilobyte@angband.pl \
    --cc=#@umbar.angband.pl \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=v3.7-@umbar.angband.pl \
    /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.