Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp1155327rwl; Thu, 5 Jan 2023 09:22:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXvmwFnqm0EFmFHsLNITV3bJwm4GotCaYrsFDtrC9TF9V2FnmQ4PTfhHHj6aAEKOVNoPL3dP X-Received: by 2002:a17:902:d544:b0:192:757c:b111 with SMTP id z4-20020a170902d54400b00192757cb111mr40927995plf.21.1672939339332; Thu, 05 Jan 2023 09:22:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672939339; cv=none; d=google.com; s=arc-20160816; b=OnEZIvxYN1d7YKxDCWyQZWxiGHO/t7YCLh+aVE8Y8uxVZpynkPOnYSvJaeLmNsbZOp 30RoGEQfFb5XPbR5YX+ne92MS7X+jzVEVI0+5I56A6P0zFYlqNgh295f/ojIVPAGEJAw eiTVmWrfmr9LMf9W1F5N/qSIVwfbzVw2lM5f41J5R7UkuMSB8Tlfzc7JkaqmI53lCyF4 Op61adTmMBclcxd7r/L7mgbEJofYOe6galRc1eduCGvEttUDRonbNhGBSPIXFYRZSgzm 7K5K+dhdjCfgz8N8Oz/TsQqLkhe9x4i7y7JjwTbF8xj0n1UOuBy8SYOUBMS06dM0CPyq 5eyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:in-reply-to:date :references:subject:cc:to:from; bh=xojR5xQQ1D60pkJzV+e7TGq3HobvUvDzOJx2dtla8wk=; b=mlmjjZ9+Hi9EMwGKn6OCzwIS0ZTLNgBrWd8osTPp3Qb7Ej91Ls0Y4urG5uY23M2p1E m+q4KT7YNBQ+Yh+HfPS2RG/RmInpBuYFTFSfv/QHxS+UKRDAsQmLni3L4lX4EJshP95r stXBg41wLElruAQ5cJ1nuTjTsIkFSmTMJgMmSa5/DkzB4Yqlc6tlUvlnsitAeV1SGsvz YMxmYx/WuWxjzwgujzhuMMaVhjFtBrkQag3YiRkK0IlinOmJL+XJswtHmrzJVK3+S0F9 /IIeY2A+E+QptYDdwoic0WdPR9tTINP+oNOcH2ezUCXQQuEE5IBD8dotH1pIO5KBQwPa b/2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i11-20020a170902eb4b00b00186b3cb9b80si1347169pli.354.2023.01.05.09.22.11; Thu, 05 Jan 2023 09:22:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234934AbjAEQTs (ORCPT + 55 others); Thu, 5 Jan 2023 11:19:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234918AbjAEQTq (ORCPT ); Thu, 5 Jan 2023 11:19:46 -0500 Received: from albireo.enyo.de (albireo.enyo.de [37.24.231.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5825652756; Thu, 5 Jan 2023 08:19:43 -0800 (PST) Received: from [172.17.203.2] (port=58125 helo=deneb.enyo.de) by albireo.enyo.de ([172.17.140.2]) with esmtps (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) id 1pDSxr-009StN-7D; Thu, 05 Jan 2023 16:19:35 +0000 Received: from fw by deneb.enyo.de with local (Exim 4.94.2) (envelope-from ) id 1pDSxq-000GBT-P4; Thu, 05 Jan 2023 17:19:34 +0100 From: Florian Weimer To: Mathieu Desnoyers Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, Thomas Gleixner , "Paul E . McKenney" , Boqun Feng , "H . Peter Anvin" , Paul Turner , linux-api@vger.kernel.org, Christian Brauner , David.Laight@ACULAB.COM, carlos@redhat.com, Peter Oskolkov , Alexander Mikhalitsyn , Chris Kennelly Subject: Re: [PATCH 05/30] selftests/rseq: Use ELF auxiliary vector for extensible rseq References: <20221122203932.231377-1-mathieu.desnoyers@efficios.com> <20221122203932.231377-6-mathieu.desnoyers@efficios.com> <87a62yun6l.fsf@mid.deneb.enyo.de> Date: Thu, 05 Jan 2023 17:19:34 +0100 In-Reply-To: (Mathieu Desnoyers's message of "Wed, 4 Jan 2023 14:51:22 -0500") Message-ID: <87tu15rm21.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Mathieu Desnoyers: > 2- Now about applications (and libc) use of rseq fields: > > Using both __rseq_size (from libc) and the result of > getauxval(AT_RSEQ_FEATURE_SIZE), a rseq user can figure which rseq > fields can indeed be used. The important part is how > get_rseq_feature_size() is called in the rseq selftests: > > > rseq_feature_size = get_rseq_feature_size(); > if (rseq_feature_size > rseq_size) > rseq_feature_size = rseq_size; > > which basically sets rseq_feature_size to the feature size exposed > by the kernel, except if libc's __rseq_size is smaller than the > feature size exposed by the kernel, in which case it will truncate > the rseq_feature_size to __rseq_size. Ahh, this happens to work because we pass 32 today from glibc, and there is nothing left to do in glibc to enable these new fields. If true, that really argues in favor of this approach. >> Maybe we should just skip the existing padding and use it only for >> some vaguely kernel-internal purpose (say through a vDSO helper), so >> that it is less of an issue how to communicate the presence of these >> fields to userspace. > > The fact that libc's __rseq_size is included the original struct > rseq padding is unfortunate, but I really see this as a purely > userspace ABI concern, which should not dictate the layout of the > kernel ABI exposed to user-space, especially given that all the > information required to allow rseq users to know which fields can be > used is readily available by combining the value loaded from > __rseq_size and the result of getauxval(AT_RSEQ_FEATURE_SIZE). But we must pass size 32 to the kernel today, otherwise rseq registration fails. It's a kernel-mandated value, not something that's purely a userspace concern.