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 };