From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nadav Amit Subject: [PATCH v2 6/6] x86/alternatives: remove text_poke() return value Date: Sun, 2 Sep 2018 10:32:24 -0700 Message-ID: <20180902173224.30606-7-namit@vmware.com> References: <20180902173224.30606-1-namit@vmware.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: <20180902173224.30606-1-namit@vmware.com> Sender: linux-kernel-owner@vger.kernel.org To: Thomas Gleixner Cc: linux-kernel@vger.kernel.org, Ingo Molnar , x86@kernel.org, Arnd Bergmann , linux-arch@vger.kernel.org, Dave Hansen , Nadav Amit , Nadav Amit , Andy Lutomirski , Kees Cook , Peter Zijlstra List-Id: linux-arch.vger.kernel.org The return value of text_poke() is meaningless - it is one of the function inputs. One day someone may allow the callers to deal with text_poke() failures, if those actually happen. In the meanwhile, remove the return value. Cc: Andy Lutomirski Cc: Kees Cook Cc: Peter Zijlstra Reviewed-by: Masami Hiramatsu Tested-by: Masami Hiramatsu Signed-off-by: Nadav Amit --- arch/x86/include/asm/text-patching.h | 2 +- arch/x86/kernel/alternative.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/text-patching.h b/arch/x86/include/asm/text-patching.h index ffe7902cc326..1f73f71b4de2 100644 --- a/arch/x86/include/asm/text-patching.h +++ b/arch/x86/include/asm/text-patching.h @@ -34,7 +34,7 @@ extern void *text_poke_early(void *addr, const void *opcode, size_t len); * On the local CPU you need to be protected again NMI or MCE handlers seeing an * inconsistent instruction while you patch. */ -extern void *text_poke(void *addr, const void *opcode, size_t len); +extern void text_poke(void *addr, const void *opcode, size_t len); extern int poke_int3_handler(struct pt_regs *regs); extern void *text_poke_bp(void *addr, const void *opcode, size_t len, void *handler); extern int after_bootmem; diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index edca599c4479..7a30c5a3ca37 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -809,7 +809,7 @@ static void text_poke_safe(void *addr, const void *opcode, size_t len, * holding the mutex and ensures that none of them will acquire the * mutex while the code runs. */ -void *text_poke(void *addr, const void *opcode, size_t len) +void text_poke(void *addr, const void *opcode, size_t len) { bool cross_page_boundary = offset_in_page(addr) + len > PAGE_SIZE; struct page *pages[2] = {0}; @@ -851,7 +851,6 @@ void *text_poke(void *addr, const void *opcode, size_t len) BUG_ON(memcmp(addr, opcode, len)); local_irq_restore(flags); - return addr; } static void do_sync_core(void *info) -- 2.17.1 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=-2.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 1B9BCC433F5 for ; Sun, 2 Sep 2018 17:33:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D38D820856 for ; Sun, 2 Sep 2018 17:33:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D38D820856 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=vmware.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727254AbeIBVuQ (ORCPT ); Sun, 2 Sep 2018 17:50:16 -0400 Received: from ex13-edg-ou-002.vmware.com ([208.91.0.190]:36915 "EHLO EX13-EDG-OU-002.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726296AbeIBVuQ (ORCPT ); Sun, 2 Sep 2018 17:50:16 -0400 Received: from sc9-mailhost3.vmware.com (10.113.161.73) by EX13-EDG-OU-002.vmware.com (10.113.208.156) with Microsoft SMTP Server id 15.0.1156.6; Sun, 2 Sep 2018 10:33:40 -0700 Received: from sc2-haas01-esx0118.eng.vmware.com (sc2-haas01-esx0118.eng.vmware.com [10.172.44.118]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id 028944072F; Sun, 2 Sep 2018 10:33:43 -0700 (PDT) From: Nadav Amit To: Thomas Gleixner CC: , Ingo Molnar , , Arnd Bergmann , , Dave Hansen , Nadav Amit , Nadav Amit , Andy Lutomirski , Kees Cook , Peter Zijlstra Subject: [PATCH v2 6/6] x86/alternatives: remove text_poke() return value Date: Sun, 2 Sep 2018 10:32:24 -0700 Message-ID: <20180902173224.30606-7-namit@vmware.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180902173224.30606-1-namit@vmware.com> References: <20180902173224.30606-1-namit@vmware.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: None (EX13-EDG-OU-002.vmware.com: namit@vmware.com does not designate permitted sender hosts) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The return value of text_poke() is meaningless - it is one of the function inputs. One day someone may allow the callers to deal with text_poke() failures, if those actually happen. In the meanwhile, remove the return value. Cc: Andy Lutomirski Cc: Kees Cook Cc: Peter Zijlstra Reviewed-by: Masami Hiramatsu Tested-by: Masami Hiramatsu Signed-off-by: Nadav Amit --- arch/x86/include/asm/text-patching.h | 2 +- arch/x86/kernel/alternative.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/text-patching.h b/arch/x86/include/asm/text-patching.h index ffe7902cc326..1f73f71b4de2 100644 --- a/arch/x86/include/asm/text-patching.h +++ b/arch/x86/include/asm/text-patching.h @@ -34,7 +34,7 @@ extern void *text_poke_early(void *addr, const void *opcode, size_t len); * On the local CPU you need to be protected again NMI or MCE handlers seeing an * inconsistent instruction while you patch. */ -extern void *text_poke(void *addr, const void *opcode, size_t len); +extern void text_poke(void *addr, const void *opcode, size_t len); extern int poke_int3_handler(struct pt_regs *regs); extern void *text_poke_bp(void *addr, const void *opcode, size_t len, void *handler); extern int after_bootmem; diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index edca599c4479..7a30c5a3ca37 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -809,7 +809,7 @@ static void text_poke_safe(void *addr, const void *opcode, size_t len, * holding the mutex and ensures that none of them will acquire the * mutex while the code runs. */ -void *text_poke(void *addr, const void *opcode, size_t len) +void text_poke(void *addr, const void *opcode, size_t len) { bool cross_page_boundary = offset_in_page(addr) + len > PAGE_SIZE; struct page *pages[2] = {0}; @@ -851,7 +851,6 @@ void *text_poke(void *addr, const void *opcode, size_t len) BUG_ON(memcmp(addr, opcode, len)); local_irq_restore(flags); - return addr; } static void do_sync_core(void *info) -- 2.17.1