Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751188AbdFCHdA (ORCPT ); Sat, 3 Jun 2017 03:33:00 -0400 Received: from tartarus.angband.pl ([89.206.35.136]:58238 "EHLO tartarus.angband.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751149AbdFCHc6 (ORCPT ); Sat, 3 Jun 2017 03:32:58 -0400 Date: Sat, 3 Jun 2017 09:32:55 +0200 From: Adam Borowski To: Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org Subject: [PATCH 0/5] vt: get rid of worst cases of __put_user/__get_user Message-ID: <20170603073255.zgpfmdp2pqusz4qw@angband.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Junkbait: aaron@angband.pl, zzyx@angband.pl User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: kilobyte@angband.pl X-SA-Exim-Scanned: No (on tartarus.angband.pl); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1300 Lines: 30 Hi! In a recent discussion, Linus and Al Viro said quite a bit of expletives about __put_user() and __get_user(), that it's a bad interface that's almost always the wrong thing to use: https://marc.info/?l=linux-kernel&m=149463725626316&w=2 https://marc.info/?l=linux-kernel&m=149465866929092&w=2 Here's a few patches applying the lessons from that discussion to vt. None of the uses is performance-critical, but at least we get a nice bit of code simplification. And, it's a start of manual review + conversion that Al Viro wants. Adam Borowski (5): vt: use copy_from/to_user instead of __get/put_user for scrnmap ioctls vt: fix unchecked __put_user() in tioclinux ioctls vt: use copy_to_user instead of __put_user in GIO_UNIMAP ioctl vt: use memdup_user in PIO_UNIMAP ioctl vt: drop access_ok() calls in unimap ioctls drivers/tty/vt/consolemap.c | 56 ++++++++++++++++---------------------------------------- drivers/tty/vt/vt.c | 6 +++--- drivers/tty/vt/vt_ioctl.c | 8 -------- 3 files changed, 19 insertions(+), 51 deletions(-) -- ⢀⣴⠾⠻⢶⣦⠀ A tit a day keeps the vet away. ⣾⠁⢰⠒⠀⣿⡁ ⢿⡄⠘⠷⠚⠋⠀ (Rejoice as my small-animal-murder-machine got unbroken after ⠈⠳⣄⠀⠀⠀⠀ nearly two years of no catch!)