Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1142911pxb; Thu, 4 Mar 2021 04:35:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwCr8WmsAbPcB/GGXqgJJCx6ViLODQfAf0hbCBLzSCT2BJz9SfFP9+eTwnGP4ZIqHsuxOJ8 X-Received: by 2002:a17:906:23e9:: with SMTP id j9mr3907061ejg.78.1614861337386; Thu, 04 Mar 2021 04:35:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614861337; cv=none; d=google.com; s=arc-20160816; b=I8U11b+xV3+GcuaxgSqdtmaL2E58EPPFZQDn/AmjRmDVbbUfFqGg9+fSDGkbcfXN86 /KfyM4Rj5AdFWiQrUCzh2R2YFPZr2O12kCZSCvN1ZTKHc52vgh5kNvh+l72sjqqq/jg9 Q7RFOprSzDCO0g3IjcT/aBBA2XHNGM9lYF7AoQya3xbPWQNWUYZuL3AwkMDVpSVlq94p N1rXBR3z32bO5MZwxNGo26QbqlZf09JsH6QHSwkzonaHVjgRVK26gw07UMBjzhYlflzj N3SyCeCacH6Q1vB7Df0Pa5VczcdV+R+qFPDFeSvxiPtABRt5MIldVVBWFrD1SXA55OD8 U6cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature:dkim-filter; bh=/+Cqqku+yj2v49ObRIAAYZyDmnbTz9LGncxn1fI29Ps=; b=ljZGeiF4WBYv3b2iMV941LqPlKbOPbdJgIesz4zfrDwTmYWZJhn8+IfIc6lRlwXQ4W yBbUOZoqJg9K0aHCyX7OlCS/wj6JwZf/TpnpRDdJtsZozHWFoR0EhsppRNPP88E8rpvy 4q0wUWGtk9REtmsugwHxu3CQSgbiKvhZSMbTslAosz+vB5Fo8ItAuVvDQyjDHFddWOHy p9xQLsHXkmbTrt483UujWnTyJbLES/gexV+EbZPryF4vGXQvGPqwVaMi+hsVAFraKZbT YibiiaPmBt3WVNAldQ5Y3CCAzvhcLpOhkoj16+E8LedeyYl7bzdG59H2Q2F6DbkXxAkQ Zt0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=GbxlIVqm; 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=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t8si15879349edw.476.2021.03.04.04.35.14; Thu, 04 Mar 2021 04:35:37 -0800 (PST) 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; dkim=pass header.i=@efficios.com header.s=default header.b=GbxlIVqm; 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=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378723AbhCCTXo (ORCPT + 99 others); Wed, 3 Mar 2021 14:23:44 -0500 Received: from mail.efficios.com ([167.114.26.124]:41054 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349563AbhCCTE6 (ORCPT ); Wed, 3 Mar 2021 14:04:58 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 64221322273; Wed, 3 Mar 2021 13:55:39 -0500 (EST) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id nzmyisAEtpyn; Wed, 3 Mar 2021 13:55:39 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 21F7D3224BB; Wed, 3 Mar 2021 13:55:39 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 21F7D3224BB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1614797739; bh=/+Cqqku+yj2v49ObRIAAYZyDmnbTz9LGncxn1fI29Ps=; h=Date:From:To:Message-ID:MIME-Version; b=GbxlIVqm7efnQ45RtVCzOCfqdFevWnV4Wyzn7JHHpWE+0kW93ElqMjI6yq7dxzt8l 2WSXEedfphWhw6AYPFWyvpLK3G4CgbjsKgPvcbVMxE+hZr9w/SRnut1hmufF0EqRPn KEWcysdPcD3O3rqaWGuheyIyrdjF8s8WjULftPOz7JT9Ecerk/QvFsEbHCPrjxiLIX bQyl7wpB14EYEWRAGflHweOC9547veDzzjHeKTMYkR0LFbUn61awhCuCK5Jp2QtLZm vxWNO+i6I/PWSt/4u0hde3c1CSJsbgHjBvJzG/Zpaep3cex7+psgOkSGqQ7Da80P9G wDXxuw/fAZsLg== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id RSvuoPlpXd8c; Wed, 3 Mar 2021 13:55:39 -0500 (EST) Received: from mail03.efficios.com (mail03.efficios.com [167.114.26.124]) by mail.efficios.com (Postfix) with ESMTP id 11C6A3226AB; Wed, 3 Mar 2021 13:55:39 -0500 (EST) Date: Wed, 3 Mar 2021 13:55:39 -0500 (EST) From: Mathieu Desnoyers To: Piotr Figiel Cc: Andrew Morton , Peter Zijlstra , paulmck , Boqun Feng , Oleg Nesterov , "Dmitry V. Levin" , Florian Weimer , Alexey Dobriyan , Andrei Vagin , linux-kernel , Peter Oskolkov , Kamil Yurtsever , Chris Kennelly , Paul Turner , emmir , linux-man , linux-api Message-ID: <1647666880.9529.1614797739047.JavaMail.zimbra@efficios.com> In-Reply-To: References: <20210226135156.1081606-1-figiel@google.com> <192824546.8190.1614353555831.JavaMail.zimbra@efficios.com> Subject: Re: [PATCH v2] ptrace: add PTRACE_GET_RSEQ_CONFIGURATION request MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.26.124] X-Mailer: Zimbra 8.8.15_GA_3996 (ZimbraWebClient - FF86 (Linux)/8.8.15_GA_4007) Thread-Topic: ptrace: add PTRACE_GET_RSEQ_CONFIGURATION request Thread-Index: +gCa2M7/7eePF4mAiSVH9mBBgTSE+w== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Feb 26, 2021, at 11:06 AM, Piotr Figiel figiel@google.com wrote: > Hi, > > On Fri, Feb 26, 2021 at 10:32:35AM -0500, Mathieu Desnoyers wrote: >> > +static long ptrace_get_rseq_configuration(struct task_struct *task, >> > + unsigned long size, void __user *data) >> > +{ >> > + struct ptrace_rseq_configuration conf = { >> > + .rseq_abi_pointer = (u64)(uintptr_t)task->rseq, >> > + .rseq_abi_size = sizeof(*task->rseq), >> > + .signature = task->rseq_sig, >> > + .flags = 0, >> > + }; >> > + >> > + size = min_t(unsigned long, size, sizeof(conf)); >> > + if (copy_to_user(data, &conf, size)) >> > + return -EFAULT; >> > + return sizeof(conf); >> > +} >> >> I think what Florian was after would be: >> >> struct ptrace_rseq_configuration { >> __u32 size; /* size of struct ptrace_rseq_configuration */ >> __u32 flags; >> __u64 rseq_abi_pointer; >> __u32 signature; >> __u32 pad; >> }; >> >> where: >> >> .size = sizeof(struct ptrace_rseq_configuration), >> >> This way, the configuration structure can be expanded in the future. The >> rseq ABI structure is by definition fixed-size, so there is no point in >> having its size here. > > Still rseq syscall accepts the rseq ABI structure size as a paremeter. > I think this way the information returned from ptrace is consistent with > the userspace view of the rseq state and allows expansion in case the > ABI structure would have to be extended (in spite of it's current > definition). > > The configuration structure still can be expanded as its size is > reported to userspace as return value from the request (in line with > Dmitry's comments). Fair enough. And now with the reply from Florian I see that I misunderstood his point. Thanks, Mathieu > > Best regards, Piotr. -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com