Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp767737ybb; Fri, 20 Mar 2020 07:47:52 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvDIZK3JN4BxSyQkvDTmolNf+icXcIioLResn1ZyIaxvJaaRTTslb0sS06UCuNmYenAtGCZ X-Received: by 2002:a9d:ed5:: with SMTP id 79mr6574670otj.249.1584715672071; Fri, 20 Mar 2020 07:47:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584715672; cv=none; d=google.com; s=arc-20160816; b=CnN5blcBv2CjOgLYDBQgEm8iWgy+5Isjvm27idUj4Ks4XXlPhfCEWd9QAiLvhaQcVU DYY/G8hiVSGqzuhAsew7EraJTqUZ8kUi+TfC0zaifwUIvSwgCNmBejeFBYk9o2FcooLI ULbPn4mgpF+QHpX+brivmA8bNdE/d9Z/T4vuBrOXUmOqoBrx2K0w4+AslldLZBFVrZVy eLmUFAug6KRvV3haPKFDQdYu3MB/ef1H3aSORCoNALIzWBihFDsJKqIu/YtGWXP7EkNz O4rLDN5yGI+4HJOHv7SiR7fcSApFOKoc/heVFZZI9VbMtJ4zeK4h1DeL4vDw5iuGMSx7 L73w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender: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=2iunU2dZUhpFG4YHr4G0tAZUqMAnPToZ4DCStcYLdFU=; b=H7UapQHJLODoA90i2R0CdtJZqk+Q3h5hUKmyHTIN9of1l/G/y16uWnWGK2jRa7R07W 4JG8Xrr4sphiEqooJ+T+PHvbnkoYZyi+cdKvpBf31pJcYXQqNXszSpXhgMXy+6/cf2Is 9F1s/aSIEB+1poRlUn5gYYbSDO3W/B5x+kLiJLXS/K/LNPU2ctLHCG49dVlvhzm4bhg+ QtgveNA7HxslUVh05VctojQJvLI9mbIG7j2g/1yCH54DvcYmdMBQ0cGuKEHlcosVI+f0 aLMZPjloeNdtgpWgfqyGeDVdDMV8STcph4/KfSAJSt5ZXb83Wn3CfT6vlIVlqZZeWdjK wojw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=Sl5t5NPs; 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=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s6si2976851oig.131.2020.03.20.07.47.36; Fri, 20 Mar 2020 07:47:52 -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; dkim=pass header.i=@efficios.com header.s=default header.b=Sl5t5NPs; 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=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727278AbgCTOrO (ORCPT + 99 others); Fri, 20 Mar 2020 10:47:14 -0400 Received: from mail.efficios.com ([167.114.26.124]:37078 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726913AbgCTOrO (ORCPT ); Fri, 20 Mar 2020 10:47:14 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 3AB6A280E48; Fri, 20 Mar 2020 10:47:12 -0400 (EDT) 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 suxPyYVnrqRF; Fri, 20 Mar 2020 10:47:11 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id BE47F281196; Fri, 20 Mar 2020 10:47:11 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com BE47F281196 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1584715631; bh=2iunU2dZUhpFG4YHr4G0tAZUqMAnPToZ4DCStcYLdFU=; h=Date:From:To:Message-ID:MIME-Version; b=Sl5t5NPse6vfN7D2uDFbVteRf/Ago9K9aloGWAR3RwMoiBmfOLQQg4aS4BNvvWALe KZhfiKaThD54AdXmOqq7jEHz6U/kZR0kVV1z/UXDBNQI5UeUJrTw7R/kR2MMw5OmZw aFKTX4FAKgecZ/k6HpW7sCzSbacaM6YD6q/Lu63odRCPWM+FIK29+OJ2KoxP4C/WuF i8UzfPhEmvdXxdAxWlB08B9Oh3vh+MQMQuAokBNDpCLP/AT2zRKj36oIB38yCQLN0c DmkgwJpNytyXwMmRL+80+26686lG+UuNfB3GOIjF8qqVyXcchnCTBErzhZ60OKNSvO RmCF4CA9CSwtQ== 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 LFY6lmoKTf5Y; Fri, 20 Mar 2020 10:47:11 -0400 (EDT) Received: from mail03.efficios.com (mail03.efficios.com [167.114.26.124]) by mail.efficios.com (Postfix) with ESMTP id AE29B28118D; Fri, 20 Mar 2020 10:47:11 -0400 (EDT) Date: Fri, 20 Mar 2020 10:47:11 -0400 (EDT) From: Mathieu Desnoyers To: Florian Weimer Cc: libc-alpha , carlos , Rich Felker , linux-api , Boqun Feng , Will Deacon , linux-kernel , Peter Zijlstra , Ben Maurer , Thomas Gleixner , Paul , Paul Turner , Joseph Myers Message-ID: <82259847.4696.1584715631625.JavaMail.zimbra@efficios.com> In-Reply-To: <1854222804.4643.1584711847409.JavaMail.zimbra@efficios.com> References: <20200319144110.3733-1-mathieu.desnoyers@efficios.com> <87sgi4gqhf.fsf@mid.deneb.enyo.de> <1103782439.4046.1584642531222.JavaMail.zimbra@efficios.com> <87k13ggpmf.fsf@mid.deneb.enyo.de> <900536577.4062.1584644126425.JavaMail.zimbra@efficios.com> <87fte4go6w.fsf@mid.deneb.enyo.de> <624584479.4115.1584647163775.JavaMail.zimbra@efficios.com> <1854222804.4643.1584711847409.JavaMail.zimbra@efficios.com> Subject: Re: [RFC PATCH glibc 4/8] glibc: Perform rseq(2) registration at C startup and thread creation (v15) 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_3918 (ZimbraWebClient - FF73 (Linux)/8.8.15_GA_3895) Thread-Topic: glibc: Perform rseq(2) registration at C startup and thread creation (v15) Thread-Index: poZ7JQ5/Qt1CQs9uPvdRib/AmVGsDnhrNsAXpMewnwU= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Mar 20, 2020, at 9:44 AM, Mathieu Desnoyers mathieu.desnoyers@efficios.com wrote: [...] > Actually, here is an important clarification: the Linux kernel validates > the struct rseq alignment on registration: > > if (!IS_ALIGNED((unsigned long)rseq, __alignof__(*rseq)) || > rseq_len != sizeof(*rseq)) > return -EINVAL; > > So removing the aligned attribute from struct rseq is actually an > ABI-breaking change, because it would be incompatible with older > kernels which perform the IS_ALIGNED check expecting at least at > 32 bytes alignment. So I plan to add the following to glibc's sys/rseq.h: #include [...] /* Ensure the compiler supports __attribute__ ((aligned)). */ _Static_assert (__alignof__ (struct rseq_cs) >= 4 * sizeof(uint64_t), "alignment"); _Static_assert (__alignof__ (struct rseq) >= 4 * sizeof(uint64_t), "alignment"); /* Allocations of struct rseq and struct rseq_cs on the heap need to be aligned on 32 bytes. Therefore, use of malloc is discouraged because it does not guarantee alignment. posix_memalign should be used instead. */ Does it help mitigating your concerns ? Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com