Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753201AbeAQNt1 (ORCPT + 1 other); Wed, 17 Jan 2018 08:49:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46614 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752276AbeAQNtZ (ORCPT ); Wed, 17 Jan 2018 08:49:25 -0500 From: Jeff Moyer To: Christoph Hellwig Cc: Al Viro , Avi Kivity , linux-aio@kvack.org, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 32/32] aio: implement io_pgetevents References: <20180110155853.32348-1-hch@lst.de> <20180110155853.32348-33-hch@lst.de> <20180115085310.GB32532@lst.de> <20180116120433.GA14579@lst.de> <20180117042721.GT13338@ZenIV.linux.org.uk> <20180117070827.GA26868@lst.de> X-PGP-KeyID: 1F78E1B4 X-PGP-CertKey: F6FE 280D 8293 F72C 65FD 5A58 1FF8 A7CA 1F78 E1B4 X-PCLoadLetter: What the f**k does that mean? Date: Wed, 17 Jan 2018 08:49:22 -0500 In-Reply-To: <20180117070827.GA26868@lst.de> (Christoph Hellwig's message of "Wed, 17 Jan 2018 08:08:27 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 17 Jan 2018 13:49:25 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Christoph Hellwig writes: > On Wed, Jan 17, 2018 at 04:27:21AM +0000, Al Viro wrote: >> On Tue, Jan 16, 2018 at 07:41:24PM -0500, Jeff Moyer wrote: >> > if (sigmask) { >> > - if (copy_from_user(&ksigmask, sigmask, sizeof(ksigmask))) >> > + if (!access_ok(VERIFY_READ, sigmask, >> > + sizeof(void *) + sizeof(size_t)) || >> > + __get_user(up, (sigset_t __user * __user *)sigmask) || >> > + __get_user(sigsetsize, >> > + (size_t __user *)(sigmask + sizeof(void *)))) >> > return -EFAULT; >> >> How about copy_from_user() on a struct? Making eyes bleed is fun, but >> people tend to get annoyed when you do it to them... > > Above is the copy & paste version from pselect. I've got both copy_from_user > and that horrible version in my tree, and if we really need this awfull > calling convention copy_from_user certainly is much better. pselect > also should be switched to explicit struct + copy_from_user while > we're at it. In fact glibc defines a struct for the userland version > to start with. Yeah, I did both, but stuck with this variant as that's what pselect did. I'm fine with switching to the struct variant. -Jeff