From patchwork Fri May 24 22:11:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 10960509 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 A569C933 for ; Fri, 24 May 2019 22:11:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94E9828A45 for ; Fri, 24 May 2019 22:11:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8941328A4A; Fri, 24 May 2019 22:11:48 +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 22D1228A45 for ; Fri, 24 May 2019 22:11:48 +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=u2zcTjhigUPajMqkXjzjHX7LNwTAqjc3lAcYAonSOtI=; b=l9gyKB8fLF48F8 irVECc0sdRwqFWfPcy8b//X4XtsXwzQUbxG55xwe66lzgjL5DT2UEThHZqPOs2yRW9TipUsAi4y9S Ql8Qx82Oq3Bia8nyImbO6/fX+WInusdBQ/7ezIey+tddaXNO1F5KH1RtYFo3zeIlaXP1yJUhZXVmZ M2DgRyc2bgylyxymMRz0+hOynapdG/cEdLpyEibYxkSR5Xq4OohMNIXlZcharJYs2d/OFtv1JS6cK /DgkJPS994Q7Kr6uRaHdyIdZfzTazsMEJNZ0S+Vjtav0rvAyfT6h8SB/zkbfZKLBvn4RXjoOBxjO1 fT/QvIsEe+8srCkBFxBA==; 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 1hUIPf-0002WP-Hf; Fri, 24 May 2019 22:11:43 +0000 Received: from mail-pg1-x549.google.com ([2607:f8b0:4864:20::549]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hUIPQ-0002Gb-GE for linux-arm-kernel@lists.infradead.org; Fri, 24 May 2019 22:11:29 +0000 Received: by mail-pg1-x549.google.com with SMTP id j26so5099495pgj.6 for ; Fri, 24 May 2019 15:11:25 -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=KIojoAmBE/BSnpEvXcodRJ0tgdeRBs6mJX1gQekfIhA=; b=Q5NF2enZHYLf+khWG7iyaIncDe+9M501ZKT4rE2UiUAeFpYGD7WgEK66eMZvTUH7Fm NFjo29hBJwD8aQ17sgD2jVdSTVQviNfFyuaYdeHxoTd9CLowxCNXxIz2cy+nwUQiEm3n uPGp3zdu44K5gxoq6OI2Ne54lRPHL/OQbkVi7SzpOfZpjg/G2s5DvIObUyPgQguVwN5w 4kirThYDoas6ku5+JgEDrJ9eG1xjIM48ovyNjRUSP+ql++kE6VXnH9k3lBvyvInJin6s 3t0d1YsZXzeFpMdHWgOQfeW8d9YqFB/slsOyowBXtIK0kbY1f55NODRjri7AT9XVl9Lc DA7A== 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=KIojoAmBE/BSnpEvXcodRJ0tgdeRBs6mJX1gQekfIhA=; b=JRbbq20Fv1261FJQ7K+hqrvKBwVSXWStNUaw+olrIAWhkWX87p7sabivLVfVbTPD8e kPV20nVfMnQQM5GFPxhljHWAv+vWwi3xNijFAGt3b1TrS4W2lG2NTusaLqDWyn03/Lng nYqPXuLEN5BINMvhojrO14cdutRTAdkCc0vkajzJPAYyKUzyN+6l5BdC4sCBmyJ0IRKS /z9mFrKaOGsPzdg1qwkSM6hBYhtZpq5JqpexZLb0XxQKJv2xzApeO/ARSr6kBw+7RYoK xsVwJGhUYjhdceC8CxiG7QY0egj6VoTAIeny2oAmoggwbnUCLETjeHpgVALtpz4TMHp6 smFA== X-Gm-Message-State: APjAAAWO/zEzjtU8hM3eGM0V0AsPWt01mmsyy6p0eHd/g0jP8zf9PXVP jsLZ05QoWWi2ubGSGMFwUhrPZdMpQolnpGPXsHA= X-Google-Smtp-Source: APXvYqyzCxYDZAxNhJ5uLrFZIu9zCTdanj30bKrE/Us1YXpWQ3S67zBs3LYPNicVI1QucfjHTqn4fWw8yWBsrcZD/ZE= X-Received: by 2002:a63:a1f:: with SMTP id 31mr91586268pgk.233.1558735885221; Fri, 24 May 2019 15:11:25 -0700 (PDT) Date: Fri, 24 May 2019 15:11:16 -0700 In-Reply-To: <20190524221118.177548-1-samitolvanen@google.com> Message-Id: <20190524221118.177548-2-samitolvanen@google.com> Mime-Version: 1.0 References: <20190524221118.177548-1-samitolvanen@google.com> X-Mailer: git-send-email 2.22.0.rc1.257.g3120a18244-goog Subject: [PATCH v3 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-20190524_151128_539955_CAF6ABF5 X-CRM114-Status: GOOD ( 10.33 ) 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 a65167f5cded8..e8bcb9ecede9b 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 24 22:11:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 10960511 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 4BF8514B6 for ; Fri, 24 May 2019 22:11:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 386B028A45 for ; Fri, 24 May 2019 22:11:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 299F228A4A; Fri, 24 May 2019 22:11:55 +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 CC0F728A45 for ; Fri, 24 May 2019 22:11:54 +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=PJIaAaLfxONdxn1KlKWmLHMQ3fpAIT7utgprf0q+/NI=; b=Aijbvkpw6KL8ag 5YplPIm6DRuQEPX9xqcDKwaG/qNR20Udz6zJpXL2ceT3ZqYvLYtrmCmg1FGaJ+qij41EzhmJGpBZg JiqJ6ck/Vno9elmuEwmoHUJai7CH1WtDLlSbmJSSiY5jj7KfpdMI4Wu1ioki7anUi0KaIXh/QOQ4K fgo4vPo1tinO83F7Tlxsb3WxlRyykHUhfNKCXie7N2Tw34akBfuYdYAJSpVrNz5owEYboZxzq6EfA 5HXbK111aQ6XAU28g2WY5p0tjhEFGeB3nA1Pv7alasyPObCXbjiiGE13jUByrYewBDg2OQ8gASObR gRwwfRcIuXWz6KZ96Z5Q==; 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 1hUIPm-0002fX-Jp; Fri, 24 May 2019 22:11:50 +0000 Received: from mail-ua1-x949.google.com ([2607:f8b0:4864:20::949]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hUIPS-0002HR-TX for linux-arm-kernel@lists.infradead.org; Fri, 24 May 2019 22:11:33 +0000 Received: by mail-ua1-x949.google.com with SMTP id j14so2595170ual.22 for ; Fri, 24 May 2019 15:11:29 -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=v92h8itBUYfDlklDlHFCcJBl3/YhqLnEEC7wTIuTHIM=; b=CUsAhV5X7IG2TWg3my4XjAd8N+cugOoAK2eNkVT5xhIUmLHS0BGK+qa4DRM4Z22cLx tIKhnYDefXMooVOqGJ9AXeNU1h5v1ryC8qLaZnMLaza9RURY7h11L2mzTjYrLav40CKr PoYW9InXbd01jGqMhxFZDs1kzy5+0ZInB9sshvcc6ohLa6l9WU7EO5bpDmDfw2+eQguf XOSuj2JDaQrbY1F01G9b2NXP/AxJEF8DKwMlFxfeaLRFwiwgelynwdfg5FT9Dxd1GOri M9J2A8C/rEIBYKbDjFaBoUiuUY8RBlwTEYHAGjXyKbUWW73gq8uHo2DgxuaVEySRD4il dt2Q== 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=v92h8itBUYfDlklDlHFCcJBl3/YhqLnEEC7wTIuTHIM=; b=WCWC3x55lhuI4GW2q5FCdjFFk2LbfCPfeQEIesAdlnJ1yAEnzqHyPBsmJaaWvCD/mL Cf+SQBiJA1bT8W5Wo3Ifqu357XP6NgJfC5YZETd5C/Pww0BzL10C9a2NcfLXioPjUNz8 oQV5al5kFxKW7LKYlqn8NWIft3L8bLWg6YKY+wnAuXi/JCp8hVA90QUsOJB481c3+/pL fYirfD8EP3LB9unBTUMO+1XNATQfs3hseQBUupu/IyIlAAhXZhaV146xQWqqgZQEYxCT rPD0SBkVbycM2yLwEfqQOswfAPuNHVy5EQOE6Qj/eDpCSLOwf5t6dKnEuOYObp2ZwpSf bErw== X-Gm-Message-State: APjAAAW8EnC8U8XkIQmOhwtaWMFng5sHGcIL7FLis3H7+poui3ZGcc1j RRF9aCTq5sYGihiNjziX6WOqSMQAL0u/X7hRd2I= X-Google-Smtp-Source: APXvYqyEasMSInV7lTRAqxTR3tlK+X6lvMZOcDgfdEHMr3xXlhBiE/O5JogcdnzzcRFyPYoTDe25RsVg0qI/jFZJc7U= X-Received: by 2002:a1f:3143:: with SMTP id x64mr8099236vkx.32.1558735887958; Fri, 24 May 2019 15:11:27 -0700 (PDT) Date: Fri, 24 May 2019 15:11:17 -0700 In-Reply-To: <20190524221118.177548-1-samitolvanen@google.com> Message-Id: <20190524221118.177548-3-samitolvanen@google.com> Mime-Version: 1.0 References: <20190524221118.177548-1-samitolvanen@google.com> X-Mailer: git-send-email 2.22.0.rc1.257.g3120a18244-goog Subject: [PATCH v3 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-20190524_151131_127376_6B771373 X-CRM114-Status: UNSURE ( 9.70 ) X-CRM114-Notice: Please train this message. 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 24 22:11:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 10960513 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 ABA9D14B6 for ; Fri, 24 May 2019 22:12:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A0FC28A45 for ; Fri, 24 May 2019 22:12:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D2DC28A4A; Fri, 24 May 2019 22:12:08 +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 395C228A45 for ; Fri, 24 May 2019 22:12:08 +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=sqR40JxkQ5no0Ld0g8FB6KxAe8o0KipDwTk6tKxFIM4=; b=n27H/ROHZ+Rid5 sG24YDL0k6pprpXlTNOmAJRZDreIBRiGF7lqaOnZNjlLbGxx7Sxz9TltdlT7jp5NCHvjkpmCO9qDc 1KBFJ5D1J75CimZrRA7iB4QWRjlTRlU9vW1IhDL4+gT14Xv97yUP4ulUzXKoy+L8WlGrM0BtLC9zX RRvrknE2xTnhcvdW34++qphsN1uF8tjjcvM3J0nVgJbmm71TTi6UBIyxRT976gOG3N/f7dKHkNBDI 1kfyUee7Gm4GlK7fe1EOmJ1yzKNEMyauDNbNC8QC4MaThRJKM0mC9OVua7MWHPTL0XDb5ivqRPKWr 4R9lhjotXwiKF+uMGdYQ==; 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 1hUIPy-0002uI-DC; Fri, 24 May 2019 22:12:02 +0000 Received: from mail-yw1-xc49.google.com ([2607:f8b0:4864:20::c49]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hUIPV-0002J6-4G for linux-arm-kernel@lists.infradead.org; Fri, 24 May 2019 22:11:36 +0000 Received: by mail-yw1-xc49.google.com with SMTP id g203so9744815ywe.21 for ; Fri, 24 May 2019 15:11: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=q0pnEpuGpsfO4o4/PpGY6OcjeWOaJUu326iPNm0R3Pc=; b=RNG0ZKg6/OghWFPwBoYwNzzYloxIFDIocpLzYRM7vLV5WjfKTdG0n8nzOmvNytNZF6 sfTW8MpEGAm41YabVTVREGIGWD6JHYrXq8KmQPoaszezFCDN1Dxmz5Qbva8y/LYgPCtO ce3D+ayaKaJaDDrKEKplXgZQoRMLisOlwkdsPuJcLrOTxavfI22g+OKZ1MTHn4qK1gA+ cZqSbSqI5bkynak7VLvlSPeenO0NkiFk5E0iq3pq8ibZbXC5xv6IOnQepuR6bpn9v/S/ lV75WhtPEZjzQnpCk6/yGlc9a8T5mp/CvOQgr4k8ZchtltDF/h+lqFOKDiP2tL9xS90Y n0JQ== 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=q0pnEpuGpsfO4o4/PpGY6OcjeWOaJUu326iPNm0R3Pc=; b=rlE09OnauA0W/h1A/F8ilWoqPuruiartwfj+xMm2KAonxiy2WvWx6klF5XHIiwGUJI kMtI0bbLf7eMOETv5jqiU1oOKxJZnLHXmwLelMphfihJR17h5bZLx/IThhAkduGp0EiH CllOaCYYcA4/CF32+h86d+hRi4Y9uUOLJgLOGU6BE6iHra6ax4IB1nwi+h+OgL4Z39K0 Q2l5o0JQvenmBJLC+p2xR486azwJutFV4O438lqcvjAve94686/hjfO9OL8gOwRGE6eR ZVbTorDtgGI/dGwQGYcYF20JcQxf6qIrb5dtPWIZZsmR16jQe9RobE4xcyxagAB9+x/6 7Jvw== X-Gm-Message-State: APjAAAWleTEB1G2n132rR+21HfDfK4/6irTBulRWoXg9Juz3aanePJN2 LjMV9Fk1kDoSW5lIbie5pdPrepUMpZptHpfFKHw= X-Google-Smtp-Source: APXvYqxDeASkLXDKWGHrVqaBSK/xzXsxmzMcmmg5HzG3TNLITJge2KYm2eHYLxy/MUCdgQ/j1WC7sUY9hOVabnK32vo= X-Received: by 2002:a81:a34a:: with SMTP id a71mr37463051ywh.318.1558735890589; Fri, 24 May 2019 15:11:30 -0700 (PDT) Date: Fri, 24 May 2019 15:11:18 -0700 In-Reply-To: <20190524221118.177548-1-samitolvanen@google.com> Message-Id: <20190524221118.177548-4-samitolvanen@google.com> Mime-Version: 1.0 References: <20190524221118.177548-1-samitolvanen@google.com> X-Mailer: git-send-email 2.22.0.rc1.257.g3120a18244-goog Subject: [PATCH v3 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-20190524_151133_481492_148A2267 X-CRM114-Status: UNSURE ( 9.81 ) X-CRM114-Notice: Please train this message. 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 | 7 ++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/arch/arm64/kernel/sys.c b/arch/arm64/kernel/sys.c index 6f91e81165147..d8b35cfe5e94e 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); + +asmlinkage long __arm64_sys_ni_syscall(const struct pt_regs *__unused) +{ + 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..3c80a40c1c9d6 100644 --- a/arch/arm64/kernel/sys32.c +++ b/arch/arm64/kernel/sys32.c @@ -133,17 +133,14 @@ 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 - #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 };