Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13473627ybl; Sun, 29 Dec 2019 12:45:53 -0800 (PST) X-Google-Smtp-Source: APXvYqw8kOKFXlupqBph/PWI/HTsFr1nbWJLnA3wE1P8qaFvKI1wXwwvLxtXHoh+xT/lpL2jC3Ux X-Received: by 2002:a9d:68d1:: with SMTP id i17mr53980287oto.367.1577652353510; Sun, 29 Dec 2019 12:45:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577652353; cv=none; d=google.com; s=arc-20160816; b=WYFNUrL4eLD7J1mve3645w+8b251SwSCftkc4/4/5XwyAefLHnW288X1MrMf4AYWbr K6OAM0HmL8YBk2A4OcTD4RtuPOwrGaj5hAhL1J/tLDUWPsO6u81vDrG4mPSmuUoe4aHs AGj02qKbvvPKmvq68ALbZcWh8PCA3zk5T6EH6NGWd3e6Mz2ZEwhQJcRzRViFumCbVfvQ rAazwmDMMlq56WKOWYTfWfncUAi7ekDXt0zvXxNRwsu7M6gZZN82IAHsObUZAnPrSwZa 0PjUoK0nWWYioizaViu2TowqnyqwnIXwYxyCPD1h40g5kLh1/W9+DL9jJaSz/xQHnPn5 TsdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tNWwg7MXeNx40XGZ1UPRIq2AXnH3CS8bdFzTXc4NiOQ=; b=chqtDKrk9CZ/ejozGHs3PAhKpBx+9u2jQYG21UpOHYwJDb2RbgqSso8DXaeZpdC0FU /DcpsVoVo7PCpVXMpXdfScosJXe2kDGRExnU98d2QxKgRjO1Z/OiEtvQh+pN35dWPreE sJdQtS7b1q6LQwd2eaRQBCe3z6LtsmCHtv48VDW0GhN4nCbPfTk++PdiqkpJTv7mVX6g 57PEqspT9RDzA0O7GnAFJGxzxm+OLr+Ane+yFvbUjY117jm3eLVZJfADqDpBvXOZ1REt HhpTYXyNc2lZixVVt1FeEgEee2a4vRUDvZQGoAkQNld9+hpqLxcVEqRRMuuKoOhfg8TV aZwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IkxS4Fcd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i15si21004680otk.120.2019.12.29.12.45.43; Sun, 29 Dec 2019 12:45:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IkxS4Fcd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731225AbfL2RrO (ORCPT + 99 others); Sun, 29 Dec 2019 12:47:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:57372 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731191AbfL2RrF (ORCPT ); Sun, 29 Dec 2019 12:47:05 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F1A9D206DB; Sun, 29 Dec 2019 17:47:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577641624; bh=MkNcUybdADWvdamOB6zS++HxLBROXBRnhT7JYiimUjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IkxS4Fcd/unKN2KQ6RvGuO6jownTuVbkwc7omb6TVWMCTO8t//2tdHKiA4nSUDyHu ZQRzpd/2JQcFndsmBUpOhKTx1XtCXCspxvEgLMPY8cVKobyGMvtPO07wPnCt1ZDF6x W8TTrO9BTYP5CRjJmghyAG1tM4SA7sHMOef18vbQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sami Tolvanen , Kees Cook , Andy Lutomirski , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , Linus Torvalds , Peter Zijlstra , Rik van Riel , Thomas Gleixner , Ingo Molnar , Sasha Levin Subject: [PATCH 5.4 141/434] x86/mm: Use the correct function type for native_set_fixmap() Date: Sun, 29 Dec 2019 18:23:14 +0100 Message-Id: <20191229172711.098355004@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229172702.393141737@linuxfoundation.org> References: <20191229172702.393141737@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sami Tolvanen [ Upstream commit f53e2cd0b8ab7d9e390414470bdbd830f660133f ] We call native_set_fixmap indirectly through the function pointer struct pv_mmu_ops::set_fixmap, which expects the first parameter to be 'unsigned' instead of 'enum fixed_addresses'. This patch changes the function type for native_set_fixmap to match the pointer, which fixes indirect call mismatches with Control-Flow Integrity (CFI) checking. Signed-off-by: Sami Tolvanen Reviewed-by: Kees Cook Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Dave Hansen Cc: H . Peter Anvin Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Rik van Riel Cc: Thomas Gleixner Link: https://lkml.kernel.org/r/20190913211402.193018-1-samitolvanen@google.com Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- arch/x86/include/asm/fixmap.h | 2 +- arch/x86/mm/pgtable.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h index 0c47aa82e2e2..28183ee3cc42 100644 --- a/arch/x86/include/asm/fixmap.h +++ b/arch/x86/include/asm/fixmap.h @@ -156,7 +156,7 @@ extern pte_t *kmap_pte; extern pte_t *pkmap_page_table; void __native_set_fixmap(enum fixed_addresses idx, pte_t pte); -void native_set_fixmap(enum fixed_addresses idx, +void native_set_fixmap(unsigned /* enum fixed_addresses */ idx, phys_addr_t phys, pgprot_t flags); #ifndef CONFIG_PARAVIRT_XXL diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index 3e4b9035bb9a..7bd2c3a52297 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c @@ -643,8 +643,8 @@ void __native_set_fixmap(enum fixed_addresses idx, pte_t pte) fixmaps_set++; } -void native_set_fixmap(enum fixed_addresses idx, phys_addr_t phys, - pgprot_t flags) +void native_set_fixmap(unsigned /* enum fixed_addresses */ idx, + phys_addr_t phys, pgprot_t flags) { /* Sanitize 'prot' against any unsupported bits: */ pgprot_val(flags) &= __default_kernel_pte_mask; -- 2.20.1