From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DD52C49ED7 for ; Fri, 13 Sep 2019 11:34:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0B2FC20693 for ; Fri, 13 Sep 2019 11:34:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728899AbfIMLeD (ORCPT ); Fri, 13 Sep 2019 07:34:03 -0400 Received: from foss.arm.com ([217.140.110.172]:41964 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727997AbfIMLeC (ORCPT ); Fri, 13 Sep 2019 07:34:02 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5AFF028; Fri, 13 Sep 2019 04:34:02 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 71BE93F59C; Fri, 13 Sep 2019 04:34:01 -0700 (PDT) Date: Fri, 13 Sep 2019 12:33:55 +0100 From: Mark Rutland To: Will Deacon Cc: Sami Tolvanen , Catalin Marinas , Kees Cook , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64: fix function types in COND_SYSCALL Message-ID: <20190913113355.GA32453@lakrids.cambridge.arm.com> References: <20190910224044.100388-1-samitolvanen@google.com> <20190911151545.GD3360@blommer> <20190912131143.u3rncvqdgx4z3ckz@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190912131143.u3rncvqdgx4z3ckz@willie-the-truck> User-Agent: Mutt/1.11.1+11 (2f07cb52) (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 12, 2019 at 02:11:44PM +0100, Will Deacon wrote: > On Wed, Sep 11, 2019 at 04:15:46PM +0100, Mark Rutland wrote: > > On Tue, Sep 10, 2019 at 03:40:44PM -0700, Sami Tolvanen wrote: > > > Define a weak function in COND_SYSCALL instead of a weak alias to > > > sys_ni_syscall, which has an incompatible type. This fixes indirect > > > call mismatches with Control-Flow Integrity (CFI) checking. > > > > > > Signed-off-by: Sami Tolvanen > > > > This looks correct to me, builds fine, and I asume has been tested, so FWIW: > > > > Acked-by: Mark Rutland > > > > In looking at this, I came to the conclusion that we can drop the ifdeffery > > around our SYSCALL_DEFINE0(), COND_SYSCALL(), and SYS_NI(), which I evidently > > cargo-culted from x86 (where the ifdeffery is actually necessary). > > Curious: why is it required on x86? Due to the way they share some native calls with (IA32) compat, but need slightly different wrappers to marshall registers, they have ifdeffery like: #ifdef CONFIG_IA32_EMULATION #define COND_SYSCALL(name) \ cond_syscall(__x64_sys_##name); \ cond_syscall(__ia32_sys_##name) #endif #ifndef COND_SYSCALL #define COND_SYSCALL(name) cond_syscall(__x64_sys_##name) #endif ... so that they define the compat wrapper when necessary, but not otherwise. As we don't share the native syscall table with compat tasks, we don't need to do anything like that, and can unconditionally define the native case once. > > I can send a follow up for that. > > Yes, please. I'll cook that up now, atop of Sami's patch applied to arm64's for-next/core. Thanks, Mark. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD14CC49ED7 for ; Fri, 13 Sep 2019 11:34:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 914FF20693 for ; Fri, 13 Sep 2019 11:34:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="AkRAI+my" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 914FF20693 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YQBcXMiFNKJN7M4cfumY2Ah8oSZW+EiHmg/8eSf3/+E=; b=AkRAI+my7I0APj nTgJSEnKYcjYzzw8N91W2NDoftIwY0DxHcxBD3wxGaQkv0IbHo2yZuxUVm0AmtcLmvbrlgl/Z0NQ3 PTVMJooXaVLjyq71iTZn6kyP/jGUmXjaGEcSCMpeCoSGSCYpciTojxwozB1TquLS3bmjHTrjsDM3P 6xK21BtEPMD+LyKL9K/ufqh2jaQF7izPncNu6Mkeujvz0RwvHGV0S2bPDc0I5ufrFvdgA2ITmZcwY c8PiEE6T3tc68pUmjs6T5F9M0flC8gpo1x2SsL4sni+lngJPmkt/35zGZ49jfTdGOqFBJ1d3Km+J0 rY3eqKZf0e74UNqDBhnw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8jq7-00029O-S1; Fri, 13 Sep 2019 11:34:11 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8jq1-00028Z-Sa for linux-arm-kernel@lists.infradead.org; Fri, 13 Sep 2019 11:34:09 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5AFF028; Fri, 13 Sep 2019 04:34:02 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 71BE93F59C; Fri, 13 Sep 2019 04:34:01 -0700 (PDT) Date: Fri, 13 Sep 2019 12:33:55 +0100 From: Mark Rutland To: Will Deacon Subject: Re: [PATCH] arm64: fix function types in COND_SYSCALL Message-ID: <20190913113355.GA32453@lakrids.cambridge.arm.com> References: <20190910224044.100388-1-samitolvanen@google.com> <20190911151545.GD3360@blommer> <20190912131143.u3rncvqdgx4z3ckz@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190912131143.u3rncvqdgx4z3ckz@willie-the-truck> User-Agent: Mutt/1.11.1+11 (2f07cb52) (2018-12-01) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190913_043405_964251_B1735957 X-CRM114-Status: GOOD ( 16.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, Catalin Marinas , Kees Cook , Sami Tolvanen , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Sep 12, 2019 at 02:11:44PM +0100, Will Deacon wrote: > On Wed, Sep 11, 2019 at 04:15:46PM +0100, Mark Rutland wrote: > > On Tue, Sep 10, 2019 at 03:40:44PM -0700, Sami Tolvanen wrote: > > > Define a weak function in COND_SYSCALL instead of a weak alias to > > > sys_ni_syscall, which has an incompatible type. This fixes indirect > > > call mismatches with Control-Flow Integrity (CFI) checking. > > > > > > Signed-off-by: Sami Tolvanen > > > > This looks correct to me, builds fine, and I asume has been tested, so FWIW: > > > > Acked-by: Mark Rutland > > > > In looking at this, I came to the conclusion that we can drop the ifdeffery > > around our SYSCALL_DEFINE0(), COND_SYSCALL(), and SYS_NI(), which I evidently > > cargo-culted from x86 (where the ifdeffery is actually necessary). > > Curious: why is it required on x86? Due to the way they share some native calls with (IA32) compat, but need slightly different wrappers to marshall registers, they have ifdeffery like: #ifdef CONFIG_IA32_EMULATION #define COND_SYSCALL(name) \ cond_syscall(__x64_sys_##name); \ cond_syscall(__ia32_sys_##name) #endif #ifndef COND_SYSCALL #define COND_SYSCALL(name) cond_syscall(__x64_sys_##name) #endif ... so that they define the compat wrapper when necessary, but not otherwise. As we don't share the native syscall table with compat tasks, we don't need to do anything like that, and can unconditionally define the native case once. > > I can send a follow up for that. > > Yes, please. I'll cook that up now, atop of Sami's patch applied to arm64's for-next/core. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel