Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6164029rwi; Tue, 18 Oct 2022 08:52:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4UioZqs3kR5bDGvWxOW0ST85azx1B7qg6w1Rv6O9p7v/4ygFnzBSmUY1SbNqGErbmmoiLr X-Received: by 2002:a50:a44c:0:b0:45c:6451:363d with SMTP id v12-20020a50a44c000000b0045c6451363dmr3224589edb.115.1666108336743; Tue, 18 Oct 2022 08:52:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666108336; cv=none; d=google.com; s=arc-20160816; b=RM0pKol2AV1cZQClBK44FzWJ2XZeKhqLV43dWNqGZLAQYwlUHoS/xnCtuMcdImj+tZ J5la/omVanFFJUprcJxUy7/ZqXOSyJyHc0fSmvVyT4gmxRk84jdbhOoD0lZ8DEIpBddH vVIkafMIYCy3u1NPCtz/Xuw4bQvikT/vMCFG8J9N9EZhhM2NQEg5xtJzHl8M4rdOI3Vk 6dweADp6s/YIRt+gqECuIPFV0PJzKgs2hZdknkqwG82aFPW3yr9eKRg6kBvLUS6Jzorv Aq8acrqBw6bDvDfoTbsDwLKqoQK91JyIJnGjmtbaFd6eY6QDVnYK+HWI5QupQBQ+Rdgq /kZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=949/Qi1pDpeDMTUI2Vsxrx0ghbk4aAqTjCByU1zx60Q=; b=0iddKtxqIyeXGFVv9zImlB9yQ/0W8i1nMYUa7OzVJFW1LCY/AFjgF5/Uk+qi4WBVUG GKo5MxVqb2j+yFJxYVEm384wUD1zqQpbOadK4wnSCmiOj0RNzXz0TBsghTQ5YzvMVqyp 7pQxvlfA30AjeicEjmcl0qwhwpPrsVX4VPh5/fgT+MfyQ3yH0WMRuucjk84w2+MpXPU4 9ofL1qLmnDb+HyaiJYB5OWwceSNUEhD7VpztOY/SSCESqOUctw9sejcT3rivkEnBIR/P K1Fv314EtDPmlidMtwEMyPtZEhdYYPefGXY2nGekp+y6YVgIkdqka/8vNhxok7DlMnl6 bf3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="XcOI/0lX"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji6-20020a170907980600b0073d6ad8251asi13129659ejc.812.2022.10.18.08.51.44; Tue, 18 Oct 2022 08:52:16 -0700 (PDT) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="XcOI/0lX"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230309AbiJRPfG (ORCPT + 99 others); Tue, 18 Oct 2022 11:35:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229949AbiJRPfD (ORCPT ); Tue, 18 Oct 2022 11:35:03 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0EA27695E for ; Tue, 18 Oct 2022 08:35:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666107301; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=949/Qi1pDpeDMTUI2Vsxrx0ghbk4aAqTjCByU1zx60Q=; b=XcOI/0lXGxMMs+9MGCtDoIkD5xYL/AJiAcjND9IQBxui0tL8nqwcHbMmx+aYHzN4iwMmg5 yd7i4ncW8In50GY+6S0/P9JeQj9t2f3qXxu/+R1y6ro+TzzOKFE9zFaxmsjddCxzBI5+Pu bW5MH+/kDMW3ns7RTNUo7yeimx5Aj1Y= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-257-WVrt5p-1PuaGMq31yPQtIQ-1; Tue, 18 Oct 2022 11:34:56 -0400 X-MC-Unique: WVrt5p-1PuaGMq31yPQtIQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7E64A811E81; Tue, 18 Oct 2022 15:34:55 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7BDF7C15BA4; Tue, 18 Oct 2022 15:34:52 +0000 (UTC) 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 Subject: Re: [PATCH v4 01/25] rseq: Introduce feature size and alignment ELF auxiliary vector entries References: <20220922105941.237830-1-mathieu.desnoyers@efficios.com> <20220922105941.237830-2-mathieu.desnoyers@efficios.com> <877d1726kd.fsf@oldenburg.str.redhat.com> <0a4a1a2c-964e-dcc6-948a-fd252962aaff@efficios.com> Date: Tue, 18 Oct 2022 17:34:50 +0200 In-Reply-To: <0a4a1a2c-964e-dcc6-948a-fd252962aaff@efficios.com> (Mathieu Desnoyers's message of "Mon, 17 Oct 2022 13:32:07 -0400") Message-ID: <87fsfli1r9.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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: > If we extend struct rseq to a size that makes the compiler use an > alignment larger than 32 bytes in the future, and if the compiler uses > that larger alignment knowledge to issue instructions that require the > larger alignment, then it would be incorrect for user-space to > allocate the struct rseq on an alignment lower than the required > alignment. > > Indeed, on rseq registration, we have the following check: > > if (!IS_ALIGNED((unsigned long)rseq, __alignof__(*rseq)) > [...] > return -EINVAL; > > Which would break if the size of struct rseq is large enough that the > alignment grows larger than 32 bytes. I never quite understood the reason for that check, it certainly made the glibc implementation more complicated. But to support variable sizes internally, we'll have to put in some extra effort anyway, so that it won't matter much in the end. As long as the required alignment isn't larger than the page size. 8-/ > You mentioned we could steal some high bits from AT_RSEQ_FEATURE_SIZE > to put the alignment. What is the issue with exposing an explicit > AT_RSEQ_ALIGN ? It's just a auxv entry, so I don't see it as a huge > performance concern to access 2 entries rather than one. I don't mind too much, we already have a large on-stack array in the loader so that we can decode the auxiliary vector without a humongous switch statement. But eventually that approach will stop working if the set of interesting AT_* values become too large and discontinuous. Thanks, Florian