Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13478119ybl; Sun, 29 Dec 2019 12:52:30 -0800 (PST) X-Google-Smtp-Source: APXvYqynqcMCxNhTgA8a3mrBGHNnm0F0+XTaehVdJtykxB52wAPF0VliMXZ8Yb+VmzxBmos/OOba X-Received: by 2002:a05:6830:689:: with SMTP id q9mr66491579otr.285.1577652750279; Sun, 29 Dec 2019 12:52:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577652750; cv=none; d=google.com; s=arc-20160816; b=hOyFg9AAYNnud5vcmbI+woYMUBslMDcmOMdj+LtXAg+Hg+5eDLEjnDI2AGBw/6Ko1e gFiOKVhOKF44+EBJcCzrfMtaW+SS18XuVbgu/BIphvcEoAoeuTbHcKRAYch7NZH+MUAR 8C0nrPP+D6dy3GOnl050z3qrUBDr3gMBj05P3LqqmrEo1cHNz8YtTGRYDNr7U/bwwg4c 8ZwwWWK6Tpr1lsN7KwEECC8x7svm1yVj4kqJ7vN3wmBEkdHLLPpuAdLQvShm/WM79R93 niEzbyfekRWFDNTzKscnY7gvpjfyawHMASX/6w4wSYWr96noZK+by4vgbKjnaTjJxoZU QPWA== 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=1I3etguQJQ0dQCDlLqMHGNC0MZ2ih90BKPDAictJKZc=; b=keAnrC2g8vgsP3drwCdL5ImTX0JHUOoQHcG2hoecZr1mvnaVQQVnQ3Ft1W2wbnNhMo hEdPj/aWrC+QcSxAiVl2MIMNRQHNlSqH1ZSAiDwp6prZEhNK81qTJzXpwwrOHKAFZ44I eU8xX9VeAVsqCo+YvDxFncauHS6kqJuMe3QhM5wTmkp+ee5ly2t76qf4eQIO0+xLd64E 8p7lBO2gWTiGQvALjR2G2nitSThI8gSorcZvmeHSZILngT7VXemngpyHz9uR94HmIrGk gkV44XaIfmo5cDhPHSpNXwh1UDcZbmsRgN0Dcx35/Qj4Bq9oWSSeN5fLxDxGMe1rg9ru 0RWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=B3XAn16Q; 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 u25si19579365otg.170.2019.12.29.12.52.19; Sun, 29 Dec 2019 12:52:30 -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=B3XAn16Q; 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 S2387843AbfL2SRQ (ORCPT + 99 others); Sun, 29 Dec 2019 13:17:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:40696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727498AbfL2RXS (ORCPT ); Sun, 29 Dec 2019 12:23:18 -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 1941220722; Sun, 29 Dec 2019 17:23:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640197; bh=23MIemvDnVYpQ/Jg4IDiTKLp5TLQ4khO51RSB4qnpk4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B3XAn16QwKFl2n16OhA/RQYSKlbwkvquTVQL3OC6M5ef0w+N/tWwuKEyQEpHr/Q1m kUhpfQkUJYz0By1CUN7wZBPj1D+xd2gqnIu05j+9hFyroVEzFrd4RIa2KKefmunFrO XQ2ALskfVSNjknWtwl3K6fTjE4MVuVRaNmOReg6M= 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 4.14 058/161] x86/mm: Use the correct function type for native_set_fixmap() Date: Sun, 29 Dec 2019 18:18:26 +0100 Message-Id: <20191229162416.866318313@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162355.500086350@linuxfoundation.org> References: <20191229162355.500086350@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 6390bd8c141b..5e12b2319d7a 100644 --- a/arch/x86/include/asm/fixmap.h +++ b/arch/x86/include/asm/fixmap.h @@ -159,7 +159,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 diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index b4fd36271f90..55338b392221 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c @@ -590,8 +590,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) { __native_set_fixmap(idx, pfn_pte(phys >> PAGE_SHIFT, flags)); } -- 2.20.1