Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1327637pxb; Fri, 26 Feb 2021 08:06:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJzRyCeun232YT/+uhYqqDsB9icEXndw6Ur+EY8tWoySBHlyg436E9k+mZ5LU8DzgStWjrK4 X-Received: by 2002:a17:906:8904:: with SMTP id fr4mr4267900ejc.136.1614355606466; Fri, 26 Feb 2021 08:06:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614355606; cv=none; d=google.com; s=arc-20160816; b=wVxC4q0xYaBvVas41nGyaAmrh5kucQqlSkxnShUmKDWm5/6NffwX5tPI6AhABVTx7D Qwf6LDZAPBvU/QCSEZCAXAID4nVOaWznrXv9Sxl4ceVwnhJ866NqPAqKZ6HwRl8poHvN xpV1/mLCNMlsjwpyharvkKha4IPiIAE3uhXcB1ph7W6dWoNvzfy0WPPcsFLoqZuBSD6y on9ostXtC1SImEY8Kog8vLW+YcMlIy/1UNbzuu+Rm4mB6biGcQRPvIqXje66PXgTyJYM o7N/xLCu8Y8ad/aK9jHt7MZecLNfjUXajdPyiCQJhYd2geXTKNsqVSTx14aJ79iGscbY DCNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=y4vuk5gk8VYy+TeoS2K1DIgXIADU2xMHdtcWrqlVRR4=; b=IPBEPMKO4wNRy1LL0eYjsTYlFuwMvdT8uH1oTkppdsjEnYe4b2OoN9RB71QfTpbUBc T3tmBVn1Va5zfU2B4vcMjhiqzHc0nG12Lw+QmAyGTc6Wav6z7Rhhic1VsFkO3bBKmAHd 7OcOj0J7aZ32gz3NZqRbbGlIkZY3TNEGeCELVylq/i1Ouan6686jHKunr8/1Trv2B/Mb 9Q2B2ZEMX4awiDoHrj7tOM0uAoMhWXo3mROHpu1t2vOa0OZMZyknmOhgjHGVsp/fsgkj JzVkYT+wPOl0GqFae0cw1d4q4S/5vaOFW1CKJJSKn0Saor7ak6qB/xSIHHVTUI5Trlp/ uLTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=KSe8qTDe; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l24si6048128ejk.270.2021.02.26.08.06.21; Fri, 26 Feb 2021 08:06:46 -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=@google.com header.s=20161025 header.b=KSe8qTDe; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229886AbhBZQF0 (ORCPT + 99 others); Fri, 26 Feb 2021 11:05:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229586AbhBZQFY (ORCPT ); Fri, 26 Feb 2021 11:05:24 -0500 Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE805C061756 for ; Fri, 26 Feb 2021 08:04:36 -0800 (PST) Received: by mail-oi1-x22d.google.com with SMTP id j1so10217804oiw.3 for ; Fri, 26 Feb 2021 08:04:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=y4vuk5gk8VYy+TeoS2K1DIgXIADU2xMHdtcWrqlVRR4=; b=KSe8qTDeRpFYN1HUJs2d8SEpaHEKul8wK+ZEUsnOVTPmNejECnL3w4O5GtWglVlTDr 8KkimECkDOmDseogluJ5qMGyYBFTdfqBoOmuy7MYzhA0cP3IPynlKQLzu491fYiNdLWB D0zZysCs3AsT4rgQ+l1u1gqDNXDpjCnG6dKaRRA4Ut0rN2qzOxlx6LrFQ0E4UODu1cHO ZKDXrRP/jsu1fj81lYNGyAhF0m8l6LLVhckBYIfM4IEHSkyI+TcghTula+Xpff1n/KLI aMYSSnyzOPljJT9jHQlbKWbBcP0NhYdWhJB5HnmeqWsFv2PbUWkXRxXJtNSdUi7wHf1f nEqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=y4vuk5gk8VYy+TeoS2K1DIgXIADU2xMHdtcWrqlVRR4=; b=a7Smow51SUvJdpHrfvtMxp5aTu+NfMmGO0qQzl6MJ5c9VGH0cOavetr+N8F2QUaWCJ VMEpXhts+z/5+wURTPKzYZtAKzifziBwPtXksCdqsroB5ijcNCOWSRowzXStMRjzdg0U bTMF/XbRcwudRiUsMmgC410jr7MuKHNEx4OdNoYP89OH5ilfvH7n7PDj1G0rnxwW2UMi DNGk9g0mCNrg7u+ZYGKQIsA4obwxTezujwrVzOZr5Sem5KtKJ2Bslr/DLzTZwVsNF8Cu XsTvobRlNI7c2lC88WY+tBZp4KohWa7cyJz8ncSOKAdspvXacQ6PJNb1JQwRd3FoyKs1 eKXQ== X-Gm-Message-State: AOAM53154Lb/u62jxJk2TPO8BuBkuNlOHkaPCx9CdE6USl24JB9szE1w HojgpI3sZHS/hKO7GHcsvGUt6Hk2pq/VZ2cLX6IqBA== X-Received: by 2002:aca:3408:: with SMTP id b8mr2467679oia.102.1614355475958; Fri, 26 Feb 2021 08:04:35 -0800 (PST) MIME-Version: 1.0 References: <20210226135156.1081606-1-figiel@google.com> <192824546.8190.1614353555831.JavaMail.zimbra@efficios.com> In-Reply-To: <192824546.8190.1614353555831.JavaMail.zimbra@efficios.com> From: =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= Date: Fri, 26 Feb 2021 17:04:25 +0100 Message-ID: Subject: Re: [PATCH v2] ptrace: add PTRACE_GET_RSEQ_CONFIGURATION request To: Mathieu Desnoyers Cc: Piotr Figiel , 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 , linux-man , linux-api Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 26 Feb 2021 at 16:32, Mathieu Desnoyers wrote: > > ----- On Feb 26, 2021, at 8:51 AM, Piotr Figiel figiel@google.com wrote: > [...] > > --- > > v2: > > Applied review comments: > > - changed return value from the ptrace request to the size of the > > configuration structure > > - expanded configuration structure with the flags field and > > the rseq abi structure size > > > [...] > > +#define PTRACE_GET_RSEQ_CONFIGURATION 0x420f > > + > > +struct ptrace_rseq_configuration { > > + __u64 rseq_abi_pointer; > > + __u32 rseq_abi_size; > > + __u32 signature; > > + __u32 flags; > > + __u32 pad; > > +}; > > + > [...] > > +#ifdef CONFIG_RSEQ > > +static long ptrace_get_rseq_configuration(struct task_struct *task, > > + unsigned long size, void __user= *data) > > +{ > > + struct ptrace_rseq_configuration conf =3D { > > + .rseq_abi_pointer =3D (u64)(uintptr_t)task->rseq, > > + .rseq_abi_size =3D sizeof(*task->rseq), > > + .signature =3D task->rseq_sig, > > + .flags =3D 0, > > + }; > > + > > + size =3D 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 =3D 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. > > Florian, did I understand your request correctly, or am I missing your po= int ? In this case returning sizeof(conf) would serve the same purpose, wouldn't = it? Best Regards Micha=C5=82 Miros=C5=82aw [Resent because of HTML mail misfeature...]