Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp422142yba; Fri, 3 May 2019 04:33:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9lvfEVI7HSZicLYrrymtlVLAE3SsjPB0wGp69DV/jkBvYJCTNPkAK8srPdGXDyEnAVdY9 X-Received: by 2002:a17:902:56d:: with SMTP id 100mr5979109plf.246.1556883196574; Fri, 03 May 2019 04:33:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556883196; cv=none; d=google.com; s=arc-20160816; b=gazt3tSe/DcXSwC2YWqBChyZ7o4uAiRFAQLDgzJSOrwOMhKuVVYnWW8V5Zy4TwsqS8 hcX86NbGj1aI9fWcOfCakhzSQPyG85a02+OeHU0Oy92aWM74YDu5jf7n/T14Hydp6gwb ij4bfBGNJVPbts4kWNBDl3cv+tTBiNd3mSB1UwV22IslMZJ+m6xWarnPSCrQk9uVsgij TnBZkiqatv44O6JXTUXBAvE6vx7LLSGKvHUhP2abOTrRXoPAltjknJ7XFvG1CUYD9qZd q/ajQd9CJiqh8YlpGusfz3zz4o9IaG80YgtBJycif22onDWE4e6nKtWbMQAA3NMJBIwj w+Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=EEFTV8UcqGUELQLo9po0iMmlx4iuofiTzu9V7SCSm1k=; b=yMsTeuCsx4UEOEfFyzYecTkvVGhZkbyFlgomQFIoKtj+YT6khG+i3eVdD5mWXSC1le mvGMULCUS2xsCwVdD9MTooIPqJY2wsdmoWQDeFK9/JQ2REvuBLDNqTO4llSE9TPQttC7 pA94xnuUJ5kJHGav3snbueHjbbLCUAM887LOyQDSTXly03FGjzosfjRiRrgyoW1IEu9E S8gIulte49xK8UNWCPj75sPUucXyF8rgjEawgHSbXDiLJybMLMFszAeVbRwxftc3nXNW Ri5Otf/dUzwC4+PwRmHg9N6xQ8Kthf2wuP6P+mebZS2l4TkTH1BbJ+tFwulh19MXiscH mzYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t3si2035343plo.359.2019.05.03.04.33.00; Fri, 03 May 2019 04:33:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727620AbfECLbp convert rfc822-to-8bit (ORCPT + 99 others); Fri, 3 May 2019 07:31:45 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([146.101.78.151]:23808 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726372AbfECLbp (ORCPT ); Fri, 3 May 2019 07:31:45 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-119-bsrUedipMsKCwape80AdzQ-1; Fri, 03 May 2019 12:31:41 +0100 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 3 May 2019 12:31:40 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Fri, 3 May 2019 12:31:40 +0100 From: David Laight To: 'Cyrill Gorcunov' , Joel Savitz CC: "linux-kernel@vger.kernel.org" , "Thomas Gleixner" , Ingo Molnar , "Masami Hiramatsu" , Waiman Long , "Mauro Carvalho Chehab" , Kristina Martsenko , Andrew Morton , Kees Cook , "Gustavo A. R. Silva" , YueHaibing , Micah Morton , Yang Shi , Jann Horn , Alexey Dobriyan , Rafael Aquini , Michael Kerrisk , Yury Norov Subject: RE: [PATCH v2 1/2] kernel/sys: add PR_GET_TASK_SIZE option to prctl(2) Thread-Topic: [PATCH v2 1/2] kernel/sys: add PR_GET_TASK_SIZE option to prctl(2) Thread-Index: AQHVAYqqcxRhj7bMTkeIUrrm9JebiKZZRD3w Date: Fri, 3 May 2019 11:31:40 +0000 Message-ID: <6cf43408000149d98cc1683943c436cb@AcuMS.aculab.com> References: <1556830342-32307-1-git-send-email-jsavitz@redhat.com> <1556830342-32307-2-git-send-email-jsavitz@redhat.com> <20190502210922.GF2488@uranus.lan> <20190503083149.GH2488@uranus.lan> In-Reply-To: <20190503083149.GH2488@uranus.lan> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-MC-Unique: bsrUedipMsKCwape80AdzQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Cyrill Gorcunov > Sent: 03 May 2019 09:32 > On Thu, May 02, 2019 at 05:46:08PM -0400, Joel Savitz wrote: > > > Won't be possible to use put_user here? Something like > > > > > > static int prctl_get_tasksize(unsigned long __user *uaddr) > > > { > > > return put_user(TASK_SIZE, uaddr) ? -EFAULT : 0; > > > } > > > > What would be the benefit of using put_user() over copy_to_user() in > > this context? > > It is a common pattern to use put_user with native types, where > copy_to_user more biased for composed types transfer. It also removes all the crappy code that checks whether the kernel buffer is valid. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)