Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1607783pxb; Tue, 8 Feb 2022 23:57:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJxqsVhui4iodlGXmicR52gzjftkiq9PQOlFE49qSaq5d4ecU7FflMiNf9gPr3QRU5IGMzq1 X-Received: by 2002:a17:906:6a0f:: with SMTP id qw15mr849297ejc.66.1644393428719; Tue, 08 Feb 2022 23:57:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644393428; cv=none; d=google.com; s=arc-20160816; b=xub4sEAhZeeNLZll1w1a4qgxjtQzh1qixwlCPIXRAOS33270WrLgoYtoddjvKxlGMG 0hD5x/+XLFkRrf1bNNMy8gMeKb+Mm6rQiNDHQGK/e85yW3WV6a+ifPLIkdfCXo7REXKz 9jsAMMUl5m38ZfWajyndpzfGAXFTKhrY0+Wu5BoYMkwhIw0S5f5VqrF3O74Tk6FV0l6x vP2+ssiAcjuZtmFib1PVAKupzKmzfi5Q5cfUg0HQ+QaaUVvLL9vth6kJNdxQIMoRKLQ4 Tm0bewRfDyqAl3d+Hceu7esWrKIc3n/lBIUROZv7z12P8of3E9441oqrQFEldIdSAARZ Wflw== 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=2smJ/GlsLCD4bPAcOtXvALm5pEn5dU6rKnsOljI8KSo=; b=rD1dFyQMfWeUqlRCHW1lzdObcC929Ff1NV8GUbsrYIrKoMjXQsJ5nI7EqWIuDB+FjK Ta5WOKOI4PGW2G06YcIcQPmIe3DPJ0OvVEkNgUX8jSQdAnvOoo/7m4BtKI1UKG+sTBL/ dR7366JP1k6UE7oIufA3U6BWp3XAbN2QEOZfzCdIzjWc9XQU8yJgGo21WefNCp5guF/J TuYd/nr08iEitjk9eSb3T1t0W4iJAoPfgBrSD1mrZKe9kyx+fm76VwP7WgHcmZX7Vop3 dK6gE5pGc+qCAx9zvkHffcIeZMRDIcwD1KPfiMTCrIOEObIecVavno2Rk18A6e1GhzOi TOhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Xf7UbQqu; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a16si8959315edx.337.2022.02.08.23.56.43; Tue, 08 Feb 2022 23:57:08 -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=@redhat.com header.s=mimecast20190719 header.b=Xf7UbQqu; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240378AbiBGKY4 (ORCPT + 99 others); Mon, 7 Feb 2022 05:24:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352754AbiBGKWx (ORCPT ); Mon, 7 Feb 2022 05:22:53 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D84FBC043188 for ; Mon, 7 Feb 2022 02:22:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644229372; 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=2smJ/GlsLCD4bPAcOtXvALm5pEn5dU6rKnsOljI8KSo=; b=Xf7UbQquJIXbvEWSX6hyv9QGpoOj4YVDWVM0fONsNAyWJOrj+IiNGxqOpkQHhXSpy5S/hJ em3AZSU+b91fhfOT0mFA3X0y1SOWq68qXylB63fmskfYYUSJZjiATdt2Et6SFGK9NxAVPJ J5KvvYOclSAke6fP+7oPrsHch8wPkZs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-65-idtXnJI4OrGmulbvj6Mxvg-1; Mon, 07 Feb 2022 05:22:46 -0500 X-MC-Unique: idtXnJI4OrGmulbvj6Mxvg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3B34A1800D50; Mon, 7 Feb 2022 10:22:42 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.193.205]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 23E96607B6; Mon, 7 Feb 2022 10:22:21 +0000 (UTC) From: Florian Weimer To: David Laight Cc: "'Edgecombe, Rick P'" , "hjl.tools@gmail.com" , "bsingharora@gmail.com" , "hpa@zytor.com" , "Syromiatnikov, Eugene" , "peterz@infradead.org" , "rdunlap@infradead.org" , "keescook@chromium.org" , "Eranian, Stephane" , "kirill.shutemov@linux.intel.com" , "dave.hansen@linux.intel.com" , "linux-mm@kvack.org" , "nadav.amit@gmail.com" , "jannh@google.com" , "kcc@google.com" , "linux-arch@vger.kernel.org" , "pavel@ucw.cz" , "oleg@redhat.com" , "Yang, Weijiang" , "Lutomirski, Andy" , "bp@alien8.de" , "arnd@arndb.de" , "Moreira, Joao" , "tglx@linutronix.de" , "mike.kravetz@oracle.com" , "x86@kernel.org" , "linux-doc@vger.kernel.org" , "Dave.Martin@arm.com" , "john.allen@amd.com" , "mingo@redhat.com" , "Shankar, Ravi V" , "corbet@lwn.net" , "linux-kernel@vger.kernel.org" , "linux-api@vger.kernel.org" , "gorcunov@gmail.com" Subject: Re: [PATCH 00/35] Shadow stacks for userspace References: <87fsozek0j.ffs@tglx> <3421da7fc8474b6db0e265b20ffd28d0@AcuMS.aculab.com> <9f948745435c4c9273131146d50fe6f328b91a78.camel@intel.com> <782f27dbe6fc419a8946eeb426253e28@AcuMS.aculab.com> Date: Mon, 07 Feb 2022 11:22:20 +0100 In-Reply-To: <782f27dbe6fc419a8946eeb426253e28@AcuMS.aculab.com> (David Laight's message of "Sun, 6 Feb 2022 13:42:42 +0000") Message-ID: <8735kvm0wz.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 2.79 on 10.5.11.14 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 * David Laight: > Was there any 'spare' space in struct jmpbuf ? jmp_buf in glibc looks like this: (gdb) ptype/o jmp_buf type = struct __jmp_buf_tag { /* 0 | 64 */ __jmp_buf __jmpbuf; /* 64 | 4 */ int __mask_was_saved; /* XXX 4-byte hole */ /* 72 | 128 */ __sigset_t __saved_mask; /* total size (bytes): 200 */ } [1] (gdb) ptype/o __jmp_buf type = long [8] The glibc ABI reserves space for 1024 signals, something that Linux is never going to implement. We can use that space to store a few extra registers in __save_mask. There is a complication because the pthread_cancel unwinding allocates only space for the __jmpbuf member. Fortunately, we do not need to unwind the shadow stack for thread cancellation, so we don't need that extra space in that case. Thanks, Florian