Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5127219yba; Wed, 10 Apr 2019 11:58:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqyvqKVm6QMs9jINqeuSpuhLkBGXl4prA/pKfC3a9Kh+FxkTB4VRkHxptfAwM/FM4Po9wIpR X-Received: by 2002:a62:1c07:: with SMTP id c7mr45070250pfc.159.1554922693546; Wed, 10 Apr 2019 11:58:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554922693; cv=none; d=google.com; s=arc-20160816; b=BA9PLl+eMuAEHwW9j+9DdwF2l5vjpobGlqjtDgwZ27cb/ckMsTuHFjzkNOzaF6A/Qf Z6gaPd8DDhGz5oz97Cc88ORO0GDkbf//GP3SeWM4P+lfnWqDkYF1xpUttKZfxjo48sVS 25/hEKCf3TDLfZullVWgxNRXWWr4EruGQiZSZrLd/qIoRPk9bBqJpHAAzhqUjpROf4we G4Wor26cj4kCbl6MB9TYyiyIl+PhDuKFmwAvZcmU8BmbXFQylqozbQKHakLPiK6VH+8o 0fCVyWlS+H9F85KUu5oJk90UduNjrWfJohjjhNpHm8NcQOKxhC8khxLxDc/PJbxDI6D9 tieQ== 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=eooEd2YFV4Ree6ttbXZrfHoa9UtzyyCgsvCi6MYBR4Y=; b=t8sKfGlDt4xseBRttZth+PgwXV87KIFqpSgFyGBNwyBweOJZk1fpP0kwGtloeZqbRB f+Ep2x/XZWca13xeRnLlv/J82T7tjsPiiBJt/t4c4gwaYgO27BaphDnhnWv+SGeUD1oj BtanHXKmdpTZrV59VqJbOqZB3WQqkMRAwPVY+jY23bN5sn/ElDLJ2vkjsingG9achx4q Oqa3T92CmFpVOZ3o/wET0fLvqjHfCkcw2hWW2g7GZ3T12Go5puvn8vhnWmoBmIpsFQ4A ceCdQcbNmi60iwBrXSoNfTTi93f9r6nS3eSqgt3MQ94EhfBB8r7n7YBdLOr6BKYs23iM NBTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=pYDrscMF; 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 68si3567726plc.356.2019.04.10.11.57.57; Wed, 10 Apr 2019 11:58:13 -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=pYDrscMF; 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 S1731201AbfDJP5j (ORCPT + 99 others); Wed, 10 Apr 2019 11:57:39 -0400 Received: from mail.efficios.com ([167.114.142.138]:34642 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727561AbfDJP5i (ORCPT ); Wed, 10 Apr 2019 11:57:38 -0400 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id C765D1D6AB0; Wed, 10 Apr 2019 11:57:36 -0400 (EDT) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id Q3U9ymiH4emo; Wed, 10 Apr 2019 11:57:36 -0400 (EDT) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 68CDC1D6AA6; Wed, 10 Apr 2019 11:57:36 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 68CDC1D6AA6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1554911856; bh=eooEd2YFV4Ree6ttbXZrfHoa9UtzyyCgsvCi6MYBR4Y=; h=Date:From:To:Message-ID:MIME-Version; b=pYDrscMF9zTX82nng4VARD6zngPz1a4yA7+qRgRwKul4cb/JVNCqfnuw6zQg9AqoW 7Fmcao/+clUbLCtp70F94INlmdBn60dvGQ0J0jWFn/4uQjJa/M9ORylyJOjOxB6Vzj m+grbww5SCc2T7q48zTs7L8Nub+QqGnptb4b3pdIG8IoIooKnNXvCqyEvBffZ0drXf zS0yAleG5Gx3OPe2/ikZYK1fCK+LKWJ4pg3W4pLON7oTaTFek+gnFzzlxzprrFu/Qc A2pZ+RdK3vxjbcGA4AfEtU/nAcpTNigeTiw49eLL36O90um4Ek9gXec0p48wZmNE2R y7dpjKHHO7/pQ== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id 7tN82RfdZUQH; Wed, 10 Apr 2019 11:57:36 -0400 (EDT) Received: from mail02.efficios.com (mail02.efficios.com [167.114.142.138]) by mail.efficios.com (Postfix) with ESMTP id 487FC1D6A9F; Wed, 10 Apr 2019 11:57:36 -0400 (EDT) Date: Wed, 10 Apr 2019 11:57:36 -0400 (EDT) From: Mathieu Desnoyers To: schwidefsky Cc: heiko carstens , gor , libc-alpha , linux-kernel , carlos Message-ID: <2074744632.3167.1554911856144.JavaMail.zimbra@efficios.com> In-Reply-To: <20190410175243.6fc3d16a@mschwideX1> References: <1779981820.2626.1554838342731.JavaMail.zimbra@efficios.com> <20190410123258.37f182cf@mschwideX1> <514609006.3159.1554911439933.JavaMail.zimbra@efficios.com> <20190410175243.6fc3d16a@mschwideX1> Subject: Re: rseq/s390: choosing code signature MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.142.138] X-Mailer: Zimbra 8.8.12_GA_3794 (ZimbraWebClient - FF66 (Linux)/8.8.12_GA_3794) Thread-Topic: rseq/s390: choosing code signature Thread-Index: FchZvN71t7Ya0jaB9dCfvqo7rusmCg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Apr 10, 2019, at 11:52 AM, schwidefsky schwidefsky@de.ibm.com wrote: > On Wed, 10 Apr 2019 11:50:39 -0400 (EDT) > Mathieu Desnoyers wrote: > >> ----- On Apr 10, 2019, at 6:32 AM, schwidefsky schwidefsky@de.ibm.com wrote: >> >> > On Tue, 9 Apr 2019 15:32:22 -0400 (EDT) >> > Mathieu Desnoyers wrote: >> > >> >> Hi, >> >> >> >> We are about to include the code signature required prior to restartable >> >> sequences abort handlers into glibc, which will make this ABI choice final. >> >> We need architecture maintainer input on that signature value. >> >> >> >> That code signature is placed before each abort handler, so the kernel can >> >> validate that it is indeed jumping to an abort handler (and not some >> >> arbitrary attacker-chosen code). The signature is never executed. >> >> >> >> The current discussion thread on the glibc mailing list leads us towards >> >> using a trap with uncommon immediate operand, which simplifies integration >> >> with disassemblers, emulators, makes it easier to debug if the control >> >> flow gets redirected there by mistake, and is nicer for some architecture's >> >> speculative execution. >> >> >> >> We can have different signatures for each sub-architecture, as long as they >> >> don't have to co-exist within the same process. We can special-case with >> >> #ifdef for each sub-architecture and endianness if need be. If the architecture >> >> has instruction set extensions that can co-exist with the architecture >> >> instruction set within the same process, we need to take into account to which >> >> instruction the chosen signature value would map (and possibly decide if we >> >> need to extend rseq to support many signatures). >> >> >> >> Here is an example of rseq signature definition template: >> >> >> >> /* >> >> * TODO: document trap instruction objdump output on each sub-architecture >> >> * instruction sets, as well as instruction set extensions. >> >> */ >> >> #define RSEQ_SIG 0x######## >> >> >> >> Ideally we'd need a patch on top of the Linux kernel >> >> tools/testing/selftests/rseq/rseq-s390.h file that updates >> >> the signature value, so I can then pick it up for the glibc >> >> patchset. >> > >> > The trap4 instruction is a suitable one. The patch would look like this >> >> Great! I'm picking it up into my rseq tree if that's OK with you. > > Just added the patch to s390/linux:features for the next merge window as well. Sounds good! I'll carry it in my tree to have a comprehensive up-to-date list of rseq signatures for all architectures in a single tree. Worse-case the exact same change will be pulled from both architecture and rseq trees, which I don't think should be an issue, right ? Thanks, Mathieu > > -- > blue skies, > Martin. > > "Reality continues to ruin my life." - Calvin. -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com