From patchwork Fri May 3 19:12:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 10929145 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 04C451390 for ; Fri, 3 May 2019 19:12:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA3A41FF62 for ; Fri, 3 May 2019 19:12:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE39E2874A; Fri, 3 May 2019 19:12:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 912D91FF62 for ; Fri, 3 May 2019 19:12:44 +0000 (UTC) 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:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BArevg0s/c5KCfMTl+Jd8LiXST54GAF7mka8vqJtO3I=; b=sOb9oJNXfn4/3y jslZ1RlDFm1VVjFkoWMjpBY0euU+T7sFSgf3K/JO5vZ5HlbAu/VBNPQrebXlopecA/A1e6hAcLgV5 QEuScpF/RPRrXGrsl86gQX+KedMSKbT163yDH00lI1QieBNwDxQgQnerwqCDcT9IBC6eYQGJ7uQ08 4NuRRe4HQ9NeaMLd1COZFoIuAufc8GcMRyaR2weKpp0DSSCYY+MI2K52P5rRavBGVt6CktmjSGBy/ /p2D8o7J9jNDyfRuwMaoIzA/77RoblDHOZJSL6XHPs0/B6mrHfrcr8T+TxTi57Uu7UmZ0u0msxMKj awOJUf68lKSx3C+WLIqw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hMdbp-0006hQ-Sc; Fri, 03 May 2019 19:12:37 +0000 Received: from mail-pf1-x44a.google.com ([2607:f8b0:4864:20::44a]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hMdbk-0006at-Pz for linux-arm-kernel@lists.infradead.org; Fri, 03 May 2019 19:12:34 +0000 Received: by mail-pf1-x44a.google.com with SMTP id a17so3630016pff.6 for ; Fri, 03 May 2019 12:12:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=OzS8VIItIe7gOmrqJiPkmma/CofpEbEo7MDgNzxP7EU=; b=vXvz8tMV6K7ewdBjEgreqwG3r4srSHPabxZ+NglYP1hxf44UZwW/kSCKdYQv9AFeWv nxg16dVtjVyvFPzy2XSDPqL8pjdgBk/aUwM+GMNO5LLWfBhKKFDCvwV90oDe5Ul+fs5k WcRngQQwJtgRHdUdUk9Skv0kf9IhZ80LYgg2akYzT+8ZLxJl3hLXbfFc02ceWHkHJoiZ vmYjsVvz14B2DAAO6Cpy3+IZfR+Myqwk/5UWD3T1w7zYngP6WRRFr9NE3T9SnzXMFsSZ 3hkddRRZcZj0L4fE5BDmRLiDriKu8Umv4fXufsGJEOswkIk5fI5CljAsgkJpG5zOmz6z /rlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=OzS8VIItIe7gOmrqJiPkmma/CofpEbEo7MDgNzxP7EU=; b=IhGMFwyoy8GJz1Q7YcjM7QOTggHIVBi6AWtf8A4d2ke/jraPT/t9ZoLtXNaxieDOKJ iIeICwiZc01auXmbITEWJBskklRdRgF4ovQYFgVNXZLSnydzpuzD3kzt+PJstisuRqbn 1t/Sta1xXK6LD8Qy1l0Ol43DxXNpDLDDu7up5WNzwcCEGQVFyet2usjc/5xdZ6s7AVei LoptehckDRb8nrODCA3eucWRzHSusRV+3j3x20f/JHBLiwgSwfBFZdyw7lY6MJSvRz2r IW1mQLoxxL2WzEfpm1RT0W+10NzVARb2tYAO20sMRH5ykbyoh3VYYSBj7cAS5fif8HZH HiXw== X-Gm-Message-State: APjAAAWFJ2XVq+qtyd+Jy4s/2xpcaduM3bcVaOfNMABDs7Lq4zPhiPH1 YibQDvZWzTwE/DA39h899QWd49zlLpr0CoNpznY= X-Google-Smtp-Source: APXvYqxQx7thUnTUgZM+XBCR4KVnQE9clWl9Q6r+UsURp2RX6n5rRRQc1xX2h68jKqk6eL23yArIwNASAHgXHhzbcHc= X-Received: by 2002:a63:2ac5:: with SMTP id q188mr3683977pgq.388.1556910750760; Fri, 03 May 2019 12:12:30 -0700 (PDT) Date: Fri, 3 May 2019 12:12:23 -0700 In-Reply-To: <20190503191225.6684-1-samitolvanen@google.com> Message-Id: <20190503191225.6684-2-samitolvanen@google.com> Mime-Version: 1.0 References: <20190503191225.6684-1-samitolvanen@google.com> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog Subject: [PATCH v2 1/3] arm64: fix syscall_fn_t type From: Sami Tolvanen To: Catalin Marinas , Will Deacon , Mark Rutland X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190503_121233_024416_AF79E59D X-CRM114-Status: GOOD ( 10.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sami Tolvanen , Nick Desaulniers , Kees Cook , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Syscall wrappers in use const struct pt_regs * as the argument type. Use const in syscall_fn_t as well to fix indirect call type mismatches with Control-Flow Integrity checking. Signed-off-by: Sami Tolvanen Reviewed-by: Mark Rutland --- arch/arm64/include/asm/syscall.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h index a179df3674a1a..6206ab9bfcfc5 100644 --- a/arch/arm64/include/asm/syscall.h +++ b/arch/arm64/include/asm/syscall.h @@ -20,7 +20,7 @@ #include #include -typedef long (*syscall_fn_t)(struct pt_regs *regs); +typedef long (*syscall_fn_t)(const struct pt_regs *regs); extern const syscall_fn_t sys_call_table[]; From patchwork Fri May 3 19:12:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 10929147 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8AE4714DB for ; Fri, 3 May 2019 19:12:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B5011FF62 for ; Fri, 3 May 2019 19:12:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F60E2874A; Fri, 3 May 2019 19:12:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EDDA31FF62 for ; Fri, 3 May 2019 19:12:52 +0000 (UTC) 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:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mw5WNzEzxqcVbLdFq92bVGk6KADxGHcue1dcqlqxVGc=; b=CAO2TgsL6+/Wf0 b5TqLbXcJsArJMFDy5BKoq7aTa9hNgIW5PG7QUnUj8MN9/oVaqpWuYCgJ8MQTWxqjhuKlDPNNiBLF UDSKmxqcMLvL8ooDAYuEUTkiygjBMPg+i2zDwd97WSS0HTWF/NrvSMx+v27m7dunwR0Tpb7DGK8mU /iiXIBGeiQMdmgYiUftfWyD1sG/bxHfnurYy4fcaKeS7b+rMBOZmP46kPCQ2CDPaOGv8FV7Rc4eH4 5AEnYdfpNFpBXdSq/V0C2JTOfrxgX1U6Gh3RKo8O4jMSafN43t96NL734p+jdsGK2LXr+iSel8eB/ +XLeZTUUM+kaxc7HdtEA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hMdc1-0006yY-15; Fri, 03 May 2019 19:12:49 +0000 Received: from mail-vs1-xe4a.google.com ([2607:f8b0:4864:20::e4a]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hMdbn-0006cZ-KA for linux-arm-kernel@lists.infradead.org; Fri, 03 May 2019 19:12:39 +0000 Received: by mail-vs1-xe4a.google.com with SMTP id e205so1590437vsc.5 for ; Fri, 03 May 2019 12:12:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=S1+7ldXbccx9VifBluJ2Hbus2PesdEq2ZegC+sTBE7I=; b=ffAhhKt9cAcHPTUZ2tGJclczIAUDihldPCkQoKdXxgGR3UrE3LICYC4UXQba7TvGmc kmcZnhB3oy14O3HORskZBIv11NSBkpe5sUztovk0ndFNBFIA+2oHDJ+S4IH7+avmk14t xLhkhmDCaBfu9ah8m6ILALz1hLD5VAmiwBneGEte606zKOp45YQ1zdcJfXQiQh0WGeLA SAqPxauT9XhooiLT6yN123ZoZ3icJ4J8e/Dolhkbjg13Kk0Ac7oFDHDGyfnNaaItM2Vw TOz+KcMX7/EJOIPPLg9BbEnlKO1DnTt8gN2xofCiCtAK3+S3Yn5enAQhZ/vhPa6STwAN SJ8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=S1+7ldXbccx9VifBluJ2Hbus2PesdEq2ZegC+sTBE7I=; b=l16H+7B5D9FxouYWVQdsLN1Y5NSpZ7SGbif1SilRFFToRpxITx6gKuOxBT0jRsAHQG X5eP4rp8MTek569jFrFUDq4+t1lG7ErORLONBd8D0opJVJFCSagSRjD02uDig5WToVQC I5UK4vMicWUFjF0UxxOFK81r7mDPjhhyR4ojHJg+i+nzCM2JZDkEFaB40cgu8u13dBVx TA4pWGtiPz8zHU06tdfuvoezVm5BqosFDhB9pV0zfaslmYmpWr1TPVARgki7XUM+XjYW d1BAR/omWCnNWhYsg3Eu9oVD3ZKDDUJeFOrJWBNGpybJGh38WTml/TGnzh/jIqL3XgaJ PNxA== X-Gm-Message-State: APjAAAWWHk/hYwm756+nAjlniOkgY4yn5Wuw16TPr/HYv6kWQpmhtP7W l1mmy62e8q8aWyYZSTHp+bv9VDaLEqYay9hDjbc= X-Google-Smtp-Source: APXvYqzHAR9S75uPGiVNfRF9u6bkFml00Eh2GFxe+AnwR7DC7UoFMW+sJcWWbXuIZA58HIVw2OK0c5VUpq1QVJoWnqk= X-Received: by 2002:a1f:96d3:: with SMTP id y202mr2514681vkd.6.1556910753220; Fri, 03 May 2019 12:12:33 -0700 (PDT) Date: Fri, 3 May 2019 12:12:24 -0700 In-Reply-To: <20190503191225.6684-1-samitolvanen@google.com> Message-Id: <20190503191225.6684-3-samitolvanen@google.com> Mime-Version: 1.0 References: <20190503191225.6684-1-samitolvanen@google.com> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog Subject: [PATCH v2 2/3] arm64: use the correct function type in SYSCALL_DEFINE0 From: Sami Tolvanen To: Catalin Marinas , Will Deacon , Mark Rutland X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190503_121236_142557_41DC58C3 X-CRM114-Status: GOOD ( 10.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sami Tolvanen , Nick Desaulniers , Kees Cook , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Although a syscall defined using SYSCALL_DEFINE0 doesn't accept parameters, use the correct function type to avoid indirect call type mismatches with Control-Flow Integrity checking. Signed-off-by: Sami Tolvanen --- arch/arm64/include/asm/syscall_wrapper.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/arm64/include/asm/syscall_wrapper.h b/arch/arm64/include/asm/syscall_wrapper.h index a4477e515b798..507d0ee6bc690 100644 --- a/arch/arm64/include/asm/syscall_wrapper.h +++ b/arch/arm64/include/asm/syscall_wrapper.h @@ -30,10 +30,10 @@ } \ static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) -#define COMPAT_SYSCALL_DEFINE0(sname) \ - asmlinkage long __arm64_compat_sys_##sname(void); \ - ALLOW_ERROR_INJECTION(__arm64_compat_sys_##sname, ERRNO); \ - asmlinkage long __arm64_compat_sys_##sname(void) +#define COMPAT_SYSCALL_DEFINE0(sname) \ + asmlinkage long __arm64_compat_sys_##sname(const struct pt_regs *__unused); \ + ALLOW_ERROR_INJECTION(__arm64_compat_sys_##sname, ERRNO); \ + asmlinkage long __arm64_compat_sys_##sname(const struct pt_regs *__unused) #define COND_SYSCALL_COMPAT(name) \ cond_syscall(__arm64_compat_sys_##name); @@ -62,11 +62,11 @@ static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) #ifndef SYSCALL_DEFINE0 -#define SYSCALL_DEFINE0(sname) \ - SYSCALL_METADATA(_##sname, 0); \ - asmlinkage long __arm64_sys_##sname(void); \ - ALLOW_ERROR_INJECTION(__arm64_sys_##sname, ERRNO); \ - asmlinkage long __arm64_sys_##sname(void) +#define SYSCALL_DEFINE0(sname) \ + SYSCALL_METADATA(_##sname, 0); \ + asmlinkage long __arm64_sys_##sname(const struct pt_regs *__unused); \ + ALLOW_ERROR_INJECTION(__arm64_sys_##sname, ERRNO); \ + asmlinkage long __arm64_sys_##sname(const struct pt_regs *__unused) #endif #ifndef COND_SYSCALL From patchwork Fri May 3 19:12:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 10929149 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0DEC71390 for ; Fri, 3 May 2019 19:13:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2D5C1FF62 for ; Fri, 3 May 2019 19:13:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E49472874A; Fri, 3 May 2019 19:13:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7E4011FF62 for ; Fri, 3 May 2019 19:13:07 +0000 (UTC) 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:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=I/aXvMbNXRTefqIhzcBeC4FbJOzPl1HaBYhqwlPg5sM=; b=eP1HW4i0JBu4Jc 62e/1bQCiNcGwm2Xg3TiZG5p9rYCnd/QvU3gLvgPv4x2HSVZmfGu7a/1oNo4UcPhR4rs/he9rJ/OH 9XpzrF4WgAap4q9gz2K4ZzwPVb3hvSrQ73SHBEZrQqP2VJNLjT5ZV9e+NUuON9E0TeJp7Pv0xmi+M IN0fIcc3g0WV7CPEpvHCkoBnTIPwa9+LWPxKQAxPwtdlzaTYFqJMT68f/yIYWV0Glr3qb0wdYzwmF QVSNTmQOqObhrh2sjEgY0PqcfqInCKtCIKojP223sAT4H5zqdtFfWpfZw1cNlR5q0vmrYItvP84Jv fw97duob1lh3UywEbpzA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hMdcC-0007E1-Ed; Fri, 03 May 2019 19:13:00 +0000 Received: from mail-vs1-xe4a.google.com ([2607:f8b0:4864:20::e4a]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hMdbq-0006h8-1i for linux-arm-kernel@lists.infradead.org; Fri, 03 May 2019 19:12:43 +0000 Received: by mail-vs1-xe4a.google.com with SMTP id l4so1587904vsq.3 for ; Fri, 03 May 2019 12:12:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=EcPHLwy0dCi679PF7uGrTMs+xhbUxRGLn32SYROJYvw=; b=YLFHAU8YrQv2L3qLUIRIUFaA//HQ2PTUT2tQAQ3bVB5YXHf3sPtdpPJ3AzmtBzMA20 pl7TJ+wPrFjZN+K0uBhTzkBD8Vqk6Qjh4SgIcmYfdq3zDUrO5lk6zxLHB4SXdw5EEZpL 3kI7Wh8e2tzg3/hkf5RzXYRjF5PJqtnwYSEvJYv66eYq8nJC4K9CbQp4wyPrsBEB8cxm NfNOmDgcFsb44qlE/L+7rGdc4ipvtVM/GabjMDgb8WAk/GJTauCtt4k2JZgka4TxcKJK QFD8EthWTMFSTJV4ZCZRDD2nuLtLeblnp5Q0wFfDFnw6mmrLJ+SkorKuCJwF6D5t2TOZ GH4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=EcPHLwy0dCi679PF7uGrTMs+xhbUxRGLn32SYROJYvw=; b=a4jAj+HWFhqSt+Y0QfAnkJQz1LRIXZF5u1lpkDjhIWM3NfLqwBmvHlHC1XLHm5J+mQ Oxm/wGI0sbM6/MKArqrGUQ8oG4DDvIZQN98RzVx35PTABawycGwJIt9lnzmHwWCOcfaF w55BbmBLYYRA77hFHJ37BPNJaU7/Mhw9gbWBFg4FFCXc1hNuc1YBg5Qw9jlJRXqDqwfr jn5dIRVYQh45cDnMXWJ9Tw4ohu3xcJLDoPZabxszl4uDHiGoZMswpIyd8QKhR8NImDrm SKyw6Fpi0i9H5inTnz0J0VnuSedIG6/K4OAsFn8fn7JI0QmMFp+oYbFifmkrKs0diopB LgSQ== X-Gm-Message-State: APjAAAUNgpM3kg8amZjjBRYqAR2V4Fl7PuLhO8cHvGWrOm0R35/jCE+F RkaSAyBW6KsIaDmHpchHQvKoN6F4YnG07YpCQcI= X-Google-Smtp-Source: APXvYqz3X6wLfh9y0/O31fmiME1JiH9Kqs2sD7BYj6u6wf2rTqpjbK4TN6PXWfzH04i2vRVD5JNXI7BgKdBh64F1RVA= X-Received: by 2002:a67:7b56:: with SMTP id w83mr6710305vsc.79.1556910756261; Fri, 03 May 2019 12:12:36 -0700 (PDT) Date: Fri, 3 May 2019 12:12:25 -0700 In-Reply-To: <20190503191225.6684-1-samitolvanen@google.com> Message-Id: <20190503191225.6684-4-samitolvanen@google.com> Mime-Version: 1.0 References: <20190503191225.6684-1-samitolvanen@google.com> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog Subject: [PATCH v2 3/3] arm64: use the correct function type for __arm64_sys_ni_syscall From: Sami Tolvanen To: Catalin Marinas , Will Deacon , Mark Rutland X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190503_121238_583406_956ADD6B X-CRM114-Status: GOOD ( 10.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sami Tolvanen , Nick Desaulniers , Kees Cook , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Calling sys_ni_syscall through a syscall_fn_t pointer trips indirect call Control-Flow Integrity checking due to a function type mismatch. Use SYSCALL_DEFINE0 for __arm64_sys_ni_syscall instead and remove the now unnecessary casts. Signed-off-by: Sami Tolvanen --- arch/arm64/kernel/sys.c | 14 +++++++++----- arch/arm64/kernel/sys32.c | 12 ++++++++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/arch/arm64/kernel/sys.c b/arch/arm64/kernel/sys.c index b44065fb16160..4f8e8a7237a85 100644 --- a/arch/arm64/kernel/sys.c +++ b/arch/arm64/kernel/sys.c @@ -47,22 +47,26 @@ SYSCALL_DEFINE1(arm64_personality, unsigned int, personality) return ksys_personality(personality); } +asmlinkage long sys_ni_syscall(void); + +SYSCALL_DEFINE0(ni_syscall) +{ + return sys_ni_syscall(); +} + /* * Wrappers to pass the pt_regs argument. */ #define sys_personality sys_arm64_personality -asmlinkage long sys_ni_syscall(const struct pt_regs *); -#define __arm64_sys_ni_syscall sys_ni_syscall - #undef __SYSCALL #define __SYSCALL(nr, sym) asmlinkage long __arm64_##sym(const struct pt_regs *); #include #undef __SYSCALL -#define __SYSCALL(nr, sym) [nr] = (syscall_fn_t)__arm64_##sym, +#define __SYSCALL(nr, sym) [nr] = __arm64_##sym, const syscall_fn_t sys_call_table[__NR_syscalls] = { - [0 ... __NR_syscalls - 1] = (syscall_fn_t)sys_ni_syscall, + [0 ... __NR_syscalls - 1] = __arm64_sys_ni_syscall, #include }; diff --git a/arch/arm64/kernel/sys32.c b/arch/arm64/kernel/sys32.c index 0f8bcb7de7008..f8f6c26cfd326 100644 --- a/arch/arm64/kernel/sys32.c +++ b/arch/arm64/kernel/sys32.c @@ -133,17 +133,21 @@ COMPAT_SYSCALL_DEFINE6(aarch32_fallocate, int, fd, int, mode, return ksys_fallocate(fd, mode, arg_u64(offset), arg_u64(len)); } -asmlinkage long sys_ni_syscall(const struct pt_regs *); -#define __arm64_sys_ni_syscall sys_ni_syscall +asmlinkage long sys_ni_syscall(void); + +COMPAT_SYSCALL_DEFINE0(ni_syscall) +{ + return sys_ni_syscall(); +} #undef __SYSCALL #define __SYSCALL(nr, sym) asmlinkage long __arm64_##sym(const struct pt_regs *); #include #undef __SYSCALL -#define __SYSCALL(nr, sym) [nr] = (syscall_fn_t)__arm64_##sym, +#define __SYSCALL(nr, sym) [nr] = __arm64_##sym, const syscall_fn_t compat_sys_call_table[__NR_compat_syscalls] = { - [0 ... __NR_compat_syscalls - 1] = (syscall_fn_t)sys_ni_syscall, + [0 ... __NR_compat_syscalls - 1] = __arm64_sys_ni_syscall, #include };