Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp13379imm; Thu, 7 Jun 2018 12:56:37 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKwIFG5S/hi/2ME9mEZxaf1WGUm2IHRUPfJFWyHrthsp/QcW2RjsJChe/DZfovzaLb6nzPG X-Received: by 2002:a17:902:b40f:: with SMTP id x15-v6mr3467134plr.270.1528401397324; Thu, 07 Jun 2018 12:56:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528401397; cv=none; d=google.com; s=arc-20160816; b=NIElh48hIl47qXnSH+xxI/Ij05adJfZbV1naX8LADG30FnUxxsIAyFu/RzPkxmoHtH ttk8xwnwO56M2WIPy1J1B77A8BVtdzI71dOHZ3OwHG6gtbDJ36PBntU8heEcferb5yjB 0/qnT2zW8TfMXwuHwbzVk0CuhMO94jVKK1FsTb/0D772IXWX/rfip3XKJx6jK/dN8IfZ C/nlm+WLpdL/y/+WZWnIlAXfp4DM+97Mrfn6X6i3xhwnPpRgWgRi9t9d+k6T5O/my+OR uG7F8Np23G0GsEZGaylCJJIRtZewha2QxpPQjXPRF74eoAHFTIbon+b7jD2z2G46v9V6 uYTw== 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:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=ktSUbyr3bkQRE0AJ8hcxaBnNHcIhKuguPN06Id26rUA=; b=yAs7wWOaUs0yPb7wTt/IlsKVAE9nLS1q2mAOAqlXqDCjiWUOPgXfkxYXUZTK5ROapF QCVPLIioKf9zLiSMpYdVAgkEXgUv/aTBXiSF2+VWutTjjYx7wwPhLyULZsaRLeKaGjVX h5ebtmW/WJnKORi5lnZg240pPJv26tcLPzPfQTM9nceCr661Ng2EyHTRzk33bOhALjbx qgXjhZFaLBcjWyloniDgJ3LqsM8XQlDe2ZrAUFmbTXxIsZ/9/TqsQEnqSVKUMTHZ+8Qn WIJYZRyXg/ECY7smzzUKPuQAfV1GmdKVxApLwk7TdYC3HEqx8cbBf5LJXbtSP/YahbFS 2aig== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n3-v6si53424918plp.550.2018.06.07.12.56.22; Thu, 07 Jun 2018 12:56:37 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753659AbeFGTyO (ORCPT + 99 others); Thu, 7 Jun 2018 15:54:14 -0400 Received: from mga02.intel.com ([134.134.136.20]:13123 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753041AbeFGTyM (ORCPT ); Thu, 7 Jun 2018 15:54:12 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jun 2018 12:54:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,487,1520924400"; d="scan'208";a="62205140" Received: from 2b52.sc.intel.com (HELO [143.183.136.51]) ([143.183.136.51]) by fmsmga001.fm.intel.com with ESMTP; 07 Jun 2018 12:54:11 -0700 Message-ID: <1528401060.5265.4.camel@2b52.sc.intel.com> Subject: Re: [PATCH 03/10] x86/cet: Signal handling for shadow stack From: Yu-cheng Yu To: Florian Weimer Cc: Andy Lutomirski , Dmitry Safonov , Cyrill Gorcunov , 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 Date: Thu, 07 Jun 2018 12:51:00 -0700 In-Reply-To: <2b920019-cf03-334c-3b6a-b2c6b7f4dfa3@redhat.com> References: <20180607143807.3611-1-yu-cheng.yu@intel.com> <20180607143807.3611-4-yu-cheng.yu@intel.com> <2b920019-cf03-334c-3b6a-b2c6b7f4dfa3@redhat.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2018-06-07 at 20:58 +0200, Florian Weimer wrote: > 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 I will move 'ssp' to _xstate for now, and look for other ways.