Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1757358ybg; Thu, 30 Jul 2020 01:41:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6stoHjq1O2LJh39CapxYutKtJt2Lyltr+jsVzO4Vu+c2BX3v5ptN5k05qOtghbz/tgNU8 X-Received: by 2002:a17:906:1596:: with SMTP id k22mr1607218ejd.509.1596098493513; Thu, 30 Jul 2020 01:41:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596098493; cv=none; d=google.com; s=arc-20160816; b=wpBM5A9Sd9tf5vz8xnuJaxEOqpCL2Hn1OOeecZ5wlEFXVZTSIv0lxZpbE0Btj6Apf/ Kii+QsEfzxiOP4ZpnM51CWM4F4Pd3qzyNggFsdi4n/gbC2CYcejZ+kodebDINZcvUD7k TjIaiUY97Kd0blWFqsnicAROAsxinhRdOOXJMIoC12WiHetvdSNXorOmvc3nFnnd6wBd eUQAEbNtItV6kBrzaeokIClFKur3i1Co77E1QWgzc+3b7WeE59rAGFuYyAo0GS/FQ/cB 1pdr4SAUVw8TVF9h6ecwvYLBNg+nAci3Azs3lFUzx6R0rKEjgMovgXKDBuMQcBCAel14 B+4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=lTKxRksGWAGrFNwmNxUkZtNT+NfTQTHIpHCNc2s047o=; b=PWPxwM7kKJ87pwybvkAK6bcX8ZGyEKUzSBbKWXFp7HO7M5/QMGdiP/hReH+ffgO2iD 9+0taUXqtpl6qvuhHEyvh1n/1pxP1EHAGliowzE/QUxKBmhNl6poYaatYZNHtCSYRFE6 EYbUd7WJcYHaqIbjdg6i/d44JFkKAwSoNIdnWGD0ufwS7uGOJ6G/oEdSRsNHSkeHXefM iZQ60AHE3XHTlcAdWnCl1Qmti9YKj4qWrXfWYONk1EQnE0DCDpnQ8bRBkijMP5cNw+NM tXyLoTwPV6bxp/TqkNuokC2+9DsKGSwtDm4Z/q1HZt1pdfFP9uuaUhPzgI6CcKivM4zC +IHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k4si2993985eds.446.2020.07.30.01.41.11; Thu, 30 Jul 2020 01:41:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729207AbgG3Iik (ORCPT + 99 others); Thu, 30 Jul 2020 04:38:40 -0400 Received: from mga14.intel.com ([192.55.52.115]:13935 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729028AbgG3Iij (ORCPT ); Thu, 30 Jul 2020 04:38:39 -0400 IronPort-SDR: 0w0WlNf6bds/SW5iPJeYGglz8WkXO143hty/WQ8FygkpV4LmrQJHsuNjQAcpk4oA7WYHdYOIxa Sd+mi1qg/xaA== X-IronPort-AV: E=McAfee;i="6000,8403,9697"; a="150734124" X-IronPort-AV: E=Sophos;i="5.75,413,1589266800"; d="scan'208";a="150734124" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2020 01:38:38 -0700 IronPort-SDR: bu9+V7we/ln6rOtutU8VW/C7vRqStryaQhZ5FopFJpxPzgTrfnd9ppiLVy5XN+Il+YKNfCbadZ hmcqCWQkAPrA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,413,1589266800"; d="scan'208";a="394921540" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga001.fm.intel.com with ESMTP; 30 Jul 2020 01:38:35 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1k145B-004slM-Ry; Thu, 30 Jul 2020 11:38:33 +0300 Date: Thu, 30 Jul 2020 11:38:33 +0300 From: Andy Shevchenko To: Arnd Bergmann Cc: Bartosz Golaszewski , Dan Carpenter , Linus Walleij , Peilin Ye , Mauro Carvalho Chehab , Greg Kroah-Hartman , syzkaller-bugs , Hans Verkuil , Sakari Ailus , Laurent Pinchart , Vandana BN , Ezequiel Garcia , Niklas =?iso-8859-1?Q?S=F6derlund?= , linux-kernel-mentees@lists.linuxfoundation.org, Linux Media Mailing List , "linux-kernel@vger.kernel.org" Subject: Re: [Linux-kernel-mentees] [PATCH v3] media/v4l2-core: Fix kernel-infoleak in video_put_user() Message-ID: <20200730083833.GD3703480@smile.fi.intel.com> References: <20200726220557.102300-1-yepeilin.cs@gmail.com> <20200726222703.102701-1-yepeilin.cs@gmail.com> <20200727131608.GD1913@kadam> <20200728130632.GI1913@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 30, 2020 at 10:15:24AM +0200, Arnd Bergmann wrote: > On Thu, Jul 30, 2020 at 10:07 AM Bartosz Golaszewski wrote: > > > > On Tue, Jul 28, 2020 at 3:58 PM Arnd Bergmann wrote: > > > > > > On Tue, Jul 28, 2020 at 3:06 PM Dan Carpenter wrote: > > > Something like > > > > > > static int lineevent_put_data(void __user *uptr, struct gpioevent_data *ge) > > > { > > > #ifdef __x86_64__ > > > /* i386 has no padding after 'id' */ > > > if (in_ia32_syscall()) { > > > struct { > > > compat_u64 timestamp __packed; > > > u32 id; > > > } compat_ge = { ge->timestamp, ge->id }; > > > > > > if (copy_to_user(uptr, &compat_ge, sizeof(compat_ge))) > > > return -EFAULT; > > > > > > return sizeof(compat_ge); > > > } > > > #endif > > > > > > if (copy_to_user(uptr, ge, sizeof(*ge)) > > > return -EFAULT; > > > > > > return sizeof(*ge); > > > } > > > > > > Arnd > > > > Hi Arnd, > > > > Andy actually had a patch for that but since this isn't a regression > > (it never worked), we decided to leave it as it is and get it right in > > v2 API. > > I would argue that it needs to be fixed anyway, unless you also want > to remove the v1 interface for native mode. If this works on 32-bit > kernels, on 64-bit kernels with 64-bit user space and on compat > 32-bit user space on 64-bit non-x86 architectures, I see no reason > to leave it broken specifically on x86 compat user space. There are > still reasons to use 32-bit x86 user space for low-memory machines > even though native i386 kernels are getting increasingly silly. It was possible to "fix" (mitigate to some extent) before libgpiod got support for several events in a request. Now it seems to be impossible to fix. AFAIU we must discard any request to more than one event in it. However I'm not an expert in compat IOCTL code (you are :-) and perhaps you may provide ideas better than mine. -- With Best Regards, Andy Shevchenko