From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johannes Berg Subject: Re: [PATCH] socket: fix struct ifreq size in compat ioctl Date: Thu, 13 Sep 2018 14:16:45 +0200 Message-ID: <1536841005.4160.7.camel@sipsolutions.net> References: <20180913114909.8331-1-johannes@sipsolutions.net> <20180913121353.GR19965@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, Robert O'Callahan To: Al Viro Return-path: Received: from s3.sipsolutions.net ([144.76.43.62]:44156 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727577AbeIMR0J (ORCPT ); Thu, 13 Sep 2018 13:26:09 -0400 In-Reply-To: <20180913121353.GR19965@ZenIV.linux.org.uk> Sender: netdev-owner@vger.kernel.org List-ID: On Thu, 2018-09-13 at 13:13 +0100, Al Viro wrote: > On Thu, Sep 13, 2018 at 01:49:09PM +0200, Johannes Berg wrote: > > From: Johannes Berg > > > > As reported by Reobert O'Callahan, since Viro's commit to kill > > dev_ifsioc() we attempt to copy too much data in compat mode, > > which may lead to EFAULT when the 32-bit version of struct ifreq > > sits at/near the end of a page boundary, and the next page isn't > > mapped. > > > > Fix this by passing whether or not we're doing a compat call and > > copying the appropriate size in/out, as we did before. This works > > because only the embedded "struct ifmap" has different size, and > > this is only used in SIOCGIFMAP/SIOCSIFMAP which has a different > > handler. All other parts of the union are naturally compatible. > > Might be better to pass explicit size instead of this bool compat... Yeah, that's a bit better perhaps, I should resend to have the bugzilla link anyway. johannes