Received: by 2002:a17:90a:9103:0:0:0:0 with SMTP id k3csp11802051pjo; Thu, 2 Jan 2020 14:32:02 -0800 (PST) X-Google-Smtp-Source: APXvYqxpVEJ+RQxAFaheSdltJsWFQjQdBFmdprER7aKMG1jzlXl+YhzuUO7E/j5wu//DiYb17978 X-Received: by 2002:a9d:708f:: with SMTP id l15mr83481869otj.229.1578004321902; Thu, 02 Jan 2020 14:32:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578004321; cv=none; d=google.com; s=arc-20160816; b=CxIZkBGbJaIuzm0wJO55zghGgyea0f+jmYdT8mG0Zk1tTw7ul8pcXCynFTWqQz3N3k PFlRtxNX4cC9qxrby2V5vvaUxUk9hlPPxeiuixco5UBpm3PKj3N2sMnXr/U1B1E5RTs3 VLLPWTMW1SL9ZxdyzwZzwG8Nxh32FUOK7vDhZjTxJx2j9+RLQzI7g5x93Ukh8wnSI/+K LS2KsTILOwAlDcS+ivijDqYx5nSFjhBs38oZYja4mHVxW/uq9OKTntsCMT183pxE+s/6 /bXGHB3ax80nv2/WXAtsPBAZdqNvYWlsIJSB+Y/FkwQpeFB24RplB2r/EXFsU4keDa5p GLyg== 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=h3QcNVMQXqTVaiqjRY5oeRYp/BEo4FnRgqTGj7yZgMA=; b=Gu7oaYkncnO9RMU7xBJxPRs3uZJeoi6Ez9E/drV+Q9RBljnpffeVhKmMxfd75nb/VN PaTznfYjhrhVt5fJtM9UPh+AqDzOUUaSYXiFW56xeJqrZTdMrYJWRFtmN3+KZUVVS7XX cEBNBLh4uCHoDGrkODrcJyg6w2+MoLvQ54YNYKdUGtRxWgerA0iv6X905ZcO4CpIUabP TziEvvhrQ855hOHM61UnscftgeHOrbzo2qX1lbJwc5v78byo3cvuauflw4SzKkIJfBvv iMQ1fjeFOH6fEywNQyg0eTiFhZxGIKd5GdMs//Z1tEf3VXyVNiseAFebhi2ScruYZy6E G4nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LLmrN8h9; 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 13si21051138oiy.28.2020.01.02.14.31.50; Thu, 02 Jan 2020 14:32:01 -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=LLmrN8h9; 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 S1729845AbgABW2L (ORCPT + 99 others); Thu, 2 Jan 2020 17:28:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:57522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729429AbgABW2J (ORCPT ); Thu, 2 Jan 2020 17:28:09 -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 8F55621835; Thu, 2 Jan 2020 22:28:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578004089; bh=1jIHEIvuuMwZFtemNiO+ihiaLGFsEZIW44QRFyOCguc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LLmrN8h9n8pLviQ6xxDo9o1vW/pykA1gtnOBmwA2rwqcBxOKdM0E6tRC3DKslumZL vIye2cehARmr7jn5DLLLbcL5pzF2ktwwa4+bWkgKnqQgdxmOcDcA6wS4orKbTnNKuR Fl5y13Hl8TO2FI/QuJgqBCbUFwj0DTgSKi5Kx/FI= 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.9 032/171] x86/mm: Use the correct function type for native_set_fixmap() Date: Thu, 2 Jan 2020 23:06:03 +0100 Message-Id: <20200102220551.464645777@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220546.960200039@linuxfoundation.org> References: <20200102220546.960200039@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 8554f960e21b..61d6f2c05757 100644 --- a/arch/x86/include/asm/fixmap.h +++ b/arch/x86/include/asm/fixmap.h @@ -142,7 +142,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 dff8ac2d255c..08e0380414a9 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c @@ -544,8 +544,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