Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2530914imm; Thu, 7 Jun 2018 12:12:57 -0700 (PDT) X-Google-Smtp-Source: ADUXVKImZ+plPfFNK3iZ3Cbv2Tab3sTNDPmt4w0gD2iv5+n0AoWxMSmulzOHVxaeFbYWO+YnzZ0o X-Received: by 2002:a65:4c0e:: with SMTP id u14-v6mr2555466pgq.388.1528398776972; Thu, 07 Jun 2018 12:12:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528398776; cv=none; d=google.com; s=arc-20160816; b=Ph4DYSj9U2JXN8L6C3qe5izdZ6k9pGg2ygOjWysVDsCRfI/+Xqaasvv4WqO/0Hl5+Q 13eAzTWQcWnJjmwRs0vHqH+ZuOf+qE3j78WpV03fvjXC/F437jaM4YQ8hoj1Y5Bp/huE sI6ZhsB2l8NN7IQx1isxBOmu1fF1vlQv46kizuq0d0lzOl5ZuTa1Me/o518xrNxgW3n6 vX9lxckNdNA68YGKBFxJQC9DzmoZiyyknprjaEf9mqnVjQMx00QeduM4vY4t0uqYlChD /oF+HBBrCElVKWrEy5EwQ/HNBzhMQ2YX71eT9FuMWfMTrNx95vjRXzmLTdZiKcuFzn9H hdyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=8l24wuacqtye4M1g3ZOYtkZhj7b2tiDo6GIMpMEPxuM=; b=QbYVgHxSaOj5H5pucq/RmDQ9Jl5R6rWWyPIxaAd9qVf+AGNGyfkUNT1lxk2zBg0ITg jtN5MVCn3P7fS912ORNkdz0kSa4gV345G9l9ITPmuyIVwEeXH7WtSfFzpOhuvZtBmHj0 7mj+n+vs5CAzC2vpAY2WakywfJkfLcRXAYxy+18qbPAtN6PMchvIxYMM+JLM76lMl9mH TLpj7qRCapTQPeAv2jDHE3KKk1vIIrfxaWZElk9HgQgVZFFPyPkO8a2+6yk0fG2elCWh RPHUxQAvzCn2T6UpbcMPL4MFKRnz+oHUvjXH5gkCgFiv90gpt1gMxDLGHzBD1Egj97IR ifnw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 90-v6si20859865pla.38.2018.06.07.12.12.43; Thu, 07 Jun 2018 12:12:56 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753597AbeFGS7J (ORCPT + 99 others); Thu, 7 Jun 2018 14:59:09 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:39032 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751231AbeFGS7H (ORCPT ); Thu, 7 Jun 2018 14:59:07 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4386B40122A1; Thu, 7 Jun 2018 18:59:06 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-116-135.ams2.redhat.com [10.36.116.135]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C11081C65D; Thu, 7 Jun 2018 18:58:57 +0000 (UTC) Subject: Re: [PATCH 03/10] x86/cet: Signal handling for shadow stack To: Andy Lutomirski , Yu-cheng Yu , Dmitry Safonov , Cyrill Gorcunov Cc: LKML , linux-doc@vger.kernel.org, Linux-MM , linux-arch , X86 ML , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , "H. J. Lu" , "Shanbhogue, Vedvyas" , "Ravi V. Shankar" , Dave Hansen , Jonathan Corbet , Oleg Nesterov , Arnd Bergmann , mike.kravetz@oracle.com References: <20180607143807.3611-1-yu-cheng.yu@intel.com> <20180607143807.3611-4-yu-cheng.yu@intel.com> From: Florian Weimer Message-ID: <2b920019-cf03-334c-3b6a-b2c6b7f4dfa3@redhat.com> Date: Thu, 7 Jun 2018 20:58:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 07 Jun 2018 18:59:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 07 Jun 2018 18:59:06 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'fweimer@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/07/2018 08:30 PM, Andy Lutomirski wrote: > On Thu, Jun 7, 2018 at 7:41 AM Yu-cheng Yu wrote: >> >> Set and restore shadow stack pointer for signals. > > How does this interact with siglongjmp()? We plan to use some unused signal mask bits in the jump buffer (we have a lot of those in glibc for some reason) to store the shadow stack pointer. > This patch makes me extremely nervous due to the possibility of ABI > issues and CRIU breakage. > >> diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h >> index 844d60eb1882..6c8997a0156a 100644 >> --- a/arch/x86/include/uapi/asm/sigcontext.h >> +++ b/arch/x86/include/uapi/asm/sigcontext.h >> @@ -230,6 +230,7 @@ struct sigcontext_32 { >> __u32 fpstate; /* Zero when no FPU/extended context */ >> __u32 oldmask; >> __u32 cr2; >> + __u32 ssp; >> }; >> >> /* >> @@ -262,6 +263,7 @@ struct sigcontext_64 { >> __u64 trapno; >> __u64 oldmask; >> __u64 cr2; >> + __u64 ssp; >> >> /* >> * fpstate is really (struct _fpstate *) or (struct _xstate *) >> @@ -320,6 +322,7 @@ struct sigcontext { >> struct _fpstate __user *fpstate; >> __u32 oldmask; >> __u32 cr2; >> + __u32 ssp; > > Is it actually okay to modify these structures like this? They're > part of the user ABI, and I don't know whether any user code relies on > the size being constant. Probably not. Historically, these things have been tacked at the end of the floating point state, see struct _xstate: /* New processor state extensions go here: */ However, I'm not sure if this is really ideal because I doubt that everyone who needs the shadow stack pointer also wants to sacrifice space for the AVX-512 save area (which is already a backwards compatibility hazard). Other architectures have variable offsets and some TLV-style setup here. Thanks, Florian