Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp35728yba; Thu, 2 May 2019 19:08:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqw7obgp1cVlUVB2Dn6qTmngUIXXT5gHg6yzhBRrcZUWa79h28RvN96/eB2ISR95G2Kv4XNq X-Received: by 2002:a17:902:263:: with SMTP id 90mr7328328plc.257.1556849284687; Thu, 02 May 2019 19:08:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556849284; cv=none; d=google.com; s=arc-20160816; b=Nrt9yC0aVapY/R7uSzyjhX2hVdjqbT1mtR+x4u351r1u+gsa3BkHeMsK94cYlHDU2/ QEb8CdGZdDU6O3a4JD0kj1zbYKdoluuzqLVOuvulbWd8+ehGfklXCWC+Hzx9vKsdiVrW H3fHtWaFOnqSYzamENKlPXJxQBrZoTrSlsm760Z/+LlCgj1XKVdaUhPbieUMtjme9I3O +/8McDMU8XRHK8dKF0k2X/XFcryXB8gme4HDyatJU4W7kInLu8dSStxvZnSlJcmLdodc dEAXnsGcLUO3yMnNhIUTNQnDWOVriqYtzbJcyM6HKC4n5eC4Tez/iRy562HeOwQBA9vE 52XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=2oSJQS6uIb5ywUfDMSSc+DgT1YHuIDtXWpIdieQKYC0=; b=fIf72QgS6IaprMk1PuSDTA6k65NDCGNMvW0Kby2s6zVWCuZavBQHdDpDYEZDME4CqS GtdlENurOHoqjJInxuF79u4y0/nv5fzZgOkmIVaYeJ5jyrNre9xULZvfyFzMkUA3Bffs vBiUqLkeL1si38DzsEnlpNCQARr9PHI5nRXu1tS2rigLkHTFy9307HkuMdhoXPZO0EPf u3EkoD2yL213WBl2Ci535meA7paFhueR8VfCgZBC5rlW6obu+PwX7aHCXJUrtmoBRb1l DcREitPBKuGh2A8xHLAq06zZtq3XjrTPzXtZsudHwYu95ni5bhRv8JiEtBP3eqpPbTS2 2rdA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j19si684325pfe.124.2019.05.02.19.07.49; Thu, 02 May 2019 19:08:04 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726561AbfECBuE (ORCPT + 99 others); Thu, 2 May 2019 21:50:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60832 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726053AbfECBuE (ORCPT ); Thu, 2 May 2019 21:50:04 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EE5FB59450; Fri, 3 May 2019 01:50:02 +0000 (UTC) Received: from x230.aquini.net (ovpn-120-12.rdu2.redhat.com [10.10.120.12]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CFBF32B9D0; Fri, 3 May 2019 01:49:57 +0000 (UTC) Date: Thu, 2 May 2019 21:49:56 -0400 From: Rafael Aquini To: Yury Norov Cc: Joel Savitz , linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Masami Hiramatsu , Waiman Long , Mauro Carvalho Chehab , Kristina Martsenko , Andrew Morton , Cyrill Gorcunov , Kees Cook , "Gustavo A. R. Silva" , YueHaibing , Micah Morton , Yang Shi , Jann Horn , Alexey Dobriyan , Michael Kerrisk , yury.norov@gmail.com Subject: Re: [PATCH v2 2/2] prctl.2: Document the new PR_GET_TASK_SIZE option Message-ID: <20190503014955.GB15494@x230.aquini.net> References: <1556830342-32307-1-git-send-email-jsavitz@redhat.com> <1556830342-32307-3-git-send-email-jsavitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 03 May 2019 01:50:03 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 02, 2019 at 03:23:12PM -0700, Yury Norov wrote: > чт, 2 мая 2019 г. в 13:52, Joel Savitz : > > > > Add a short explanation of the new PR_GET_TASK_SIZE option for the benefit > > of future generations. > > > > Signed-off-by: Joel Savitz > > --- > > man2/prctl.2 | 9 +++++++++ > > 1 file changed, 9 insertions(+) > > > > diff --git a/man2/prctl.2 b/man2/prctl.2 > > index 06d8e13c7..35a6a3919 100644 > > --- a/man2/prctl.2 > > +++ b/man2/prctl.2 > > @@ -49,6 +49,7 @@ > > .\" 2013-01-10 Kees Cook, document PR_SET_PTRACER > > .\" 2012-02-04 Michael Kerrisk, document PR_{SET,GET}_CHILD_SUBREAPER > > .\" 2014-11-10 Dave Hansen, document PR_MPX_{EN,DIS}ABLE_MANAGEMENT > > +.\" 2019-05-02 Joel Savitz, document PR_GET_TASK_SIZE > > .\" > > .\" > > .TH PRCTL 2 2019-03-06 "Linux" "Linux Programmer's Manual" > > @@ -1375,6 +1376,14 @@ system call on Tru64). > > for information on versions and architectures) > > Return unaligned access control bits, in the location pointed to by > > .IR "(unsigned int\ *) arg2" . > > +.TP > > +.B PR_GET_TASK_SIZE > > +Copy the value of TASK_SIZE to the userspace address in > > +.IR "(unsigned long\ *) arg2" . > > This is a bad idea to use pointers to size-undefined types in interface because > that way you have to introduce compat versions of interface functions. > I'd recommend you to use u64 or unsigned long long here. > unsigned long long seems to make little sense too as prctl(2) extra arguments are of unsigned long type (good for passing the pointer address, in this case). a pointer to an unsigned long var is OK for native builds, and for the compat mode issue you correctly pointed out, the storage size needs to be dealt with at the kernel side, by checking test_thread_flag(TIF_ADDR32), before proceeding with copy_to_user(). > The comment not clear for reader not familiar with kernel internals. > Can you rephrase > TASK_SIZE like 'the (next after) highest possible userspace address', > or similar? > > For the updated version could you please CC to yury.norov@gmail.com? > > > +Return > > +.B EFAULT > > +if this operation fails. > > + > > .SH RETURN VALUE > > On success, > > .BR PR_GET_DUMPABLE , > > -- > > 2.18.1 > >