From patchwork Mon Jul 8 15:13:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 168663 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp7301801ilk; Mon, 8 Jul 2019 08:22:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxO7BoOAQCk0/ZXU1VCpWR379KH59UJnsOUiAfjQm5nKmHJySuxAAlv710geBZiGdBiDhlm X-Received: by 2002:a17:90a:220a:: with SMTP id c10mr19096051pje.33.1562599344173; Mon, 08 Jul 2019 08:22:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562599344; cv=none; d=google.com; s=arc-20160816; b=wfPheXCYl8rOteRt9zB+gNq/XaxfLol8jWhk02ZIU6Eh42A/8RkCSA6iy3x1BN+DJo 8kaKVQCoxyjuCPksRnTZfY2yJTw6vN05MVd7/4rxaKEsuMx4Dnx8JlZC3AGRS/hj2Evu ODGECOhCZ+oWgdJdjHyfcY/2r70Aa/31J1B1gzglNiGLPF2JZP36uJDYYt5leC0JOSxp Kzg7I3hxi3FXHfmgPhRI9hXGm5lU2fYlcw+TzZFhQJqOpQPsAtpG6A5U35XdcN9cnDQh ff/XPlj6f+LCptKKGFmuNiYTZ2n0IhX4MY1iAzojGmDUTG7p3aJfyUEngXS500fanOBO NA+g== 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=yBkppgtYzuDSnIOxfa+M6BnO5lSJzFMlwXTl0J+GQrs=; b=jJPzmmxx5MynEv53RXIn3s8WgDQiRIxQpOrkwocRtIRDufvh8U9XVY0tfX8QS2X/tN 9BMfdANidP0mIs9FYIbl9CrQ9FB/TzD7SJSaozCcRbUcfu4qRuhDjIMagZ2k9sXV62ly TYCy9LHU3rw9bfO0QlA8HYlTtXv/hlzlL1nnjnmws3TNQcYlBe8OqRaGKSti2VNy0zMZ 2HdC9Z4VkLCsfosI1tlySMP41r1rezYF/9ElnVETqyA73IZWC3eKhA3vj++5mCwxxyZ0 qqWxrrb1r6z0T2ATF4Vj5dfs1Q1dtycNrCfMtlFAcZlVMXtKoIOt9yYTGm2EClqHoErt PCxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=n3ZDQ0NF; 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 y15si18587348pjp.90.2019.07.08.08.22.23; Mon, 08 Jul 2019 08:22:24 -0700 (PDT) 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=n3ZDQ0NF; 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 S2387941AbfGHPWW (ORCPT + 30 others); Mon, 8 Jul 2019 11:22:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:48684 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387541AbfGHPWT (ORCPT ); Mon, 8 Jul 2019 11:22:19 -0400 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 97547216C4; Mon, 8 Jul 2019 15:22:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562599338; bh=Nf2YQlA6/8uRbuf11XOZ+HRCsHe6fw5Z0BmejLtcxfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n3ZDQ0NF/RwvVw/wCPuINkm5H/wmyV+/SQBJMZSOFVJ7y4QE9oUyu4uXBrVO9LzGL Z4OUzVp96MkwdiwgogDineyjpuSriUiZZ7p11sEpwd27bmEGalDpy8MFzboX0usWjz RsOTtgtd7R62OR1SUfAZKoxW+0oTFtggehtXuISc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Maxime Ripard , Stephen Boyd Subject: [PATCH 4.9 082/102] clk: sunxi: fix uninitialized access Date: Mon, 8 Jul 2019 17:13:15 +0200 Message-Id: <20190708150530.716651984@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150525.973820964@linuxfoundation.org> References: <20190708150525.973820964@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann commit 4e903450bcb9a6bc90733b981d7cb8b3c4996a0e upstream. gcc-8 reports an uninitialized variable access in a code path that we would see with incorrect DTB input: drivers/clk/sunxi/clk-sun8i-bus-gates.c: In function 'sun8i_h3_bus_gates_init': drivers/clk/sunxi/clk-sun8i-bus-gates.c:85:27: error: 'clk_parent' may be used uninitialized in this function [-Werror=maybe-uninitialized] This works around by skipping invalid input and printing a warning instead if it ever happens. The problem was apparently part of the initiali driver submission, but older compilers don't notice it. Fixes: ab6e23a4e388 ("clk: sunxi: Add H3 clocks support") Signed-off-by: Arnd Bergmann Acked-by: Maxime Ripard Signed-off-by: Stephen Boyd Signed-off-by: Greg Kroah-Hartman --- drivers/clk/sunxi/clk-sun8i-bus-gates.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/clk/sunxi/clk-sun8i-bus-gates.c +++ b/drivers/clk/sunxi/clk-sun8i-bus-gates.c @@ -78,6 +78,10 @@ static void __init sun8i_h3_bus_gates_in clk_parent = APB1; else if (index >= 96 && index <= 127) clk_parent = APB2; + else { + WARN_ON(true); + continue; + } clk_reg = reg + 4 * (index / 32); clk_bit = index % 32; From patchwork Mon Jul 8 15:13:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 168664 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp7302838ilk; Mon, 8 Jul 2019 08:23:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqw8Yfv/5G+I1cmFTUS8NfgsQjxcj6L1UcdxMJRyhvq2xsPpsxIjkBc8FhmywNIer7zOZpWi X-Received: by 2002:a17:90a:350c:: with SMTP id q12mr26503632pjb.46.1562599394697; Mon, 08 Jul 2019 08:23:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562599394; cv=none; d=google.com; s=arc-20160816; b=sKeR2jCm3rK130gmUd3NRzJIMFT7WZHm2eUZIRY7Qj8qTkMvGO6c90eLFmo3T0LUas 7XS9DCvJjnxIaeslBIDPHmS2mCN2mPTx1ag2akj3hGglyJBsK5NiguRtgap3ePhpIhLs 2WuXCuOc9+bFsP+TJ4uTbcx0qqUMN15x/Llvn9v6VkckZmmCwRiKPGTXrrUpCF5CFNAN JCb+dun+Qc8lTCRVXhbHhCLv02zmMxyYmz2+g1F0GjbHViFyQo+NmIKHJeh5wBzjXFFS 40nJvRt1M6uIPcwN59jodsBewIBgfsbCZIizysYxqZH0RKaBjB7MrF/aGa2L8naA0XR4 VtqA== 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=EBGThibohalGDQx0JHUjvLSErbP6tzO0lJHuIrkqJAw=; b=fz44vel4Yvkdg979PlFE7h9BEs9/W2rB8PTW2tMZlbjNOtUZZh7X0X1xsnpo4GMrBE e8dd3bZIpAITdMX06P4TZn/zEELmfAwcjQwgHCLYyLU6NamHP8bOMuZt4bEpla+i/3Tl Ew4Pw+Msz4XBfXzL9GL13SqHX8oOSuOIoxhNXNB+b1T/54xMAoyhvi9jT4MglXc2gumB ZDGYQZ+wK/hV3bVqkzZziwZ9u0he8xOAsV+Jm5KaYEz/rbpwI9LROB4kvbGjMHfIWLuE JUei5II1fzC6uPHFTZ38Nka2zejfuTVpW8GVfY/rwReUNe7TPdB4JtcWPiV3OsukhvCj oQ+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xojPNPSw; 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 v11si18018074plo.223.2019.07.08.08.23.14; Mon, 08 Jul 2019 08:23:14 -0700 (PDT) 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=xojPNPSw; 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 S2388154AbfGHPXM (ORCPT + 30 others); Mon, 8 Jul 2019 11:23:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:50044 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388134AbfGHPXJ (ORCPT ); Mon, 8 Jul 2019 11:23:09 -0400 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 D958E204EC; Mon, 8 Jul 2019 15:23:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562599388; bh=N+UVgD7OA5w7i4Zf1c+vj6sMbNBUCNtULkD6pkUw0ws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xojPNPSwViqvhqS/AWJkLO6l7Lr3/qj1C5vtEDrBcm0LUp2pv9r0gLx5hhZQ/CmC5 GRFDeIvWk4MmIUKvfnHsO+g68cXaWvZ/iUP30NzP/7zg8EWaVG4Tzmup/IeOUSDPsd E6GXmehiLDzU/K1sSkzPBjyL+50s7tywWO143HPQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Catalin Marinas , Ard Biesheuvel , Will Deacon Subject: [PATCH 4.9 102/102] arm64: kaslr: keep modules inside module region when KASAN is enabled Date: Mon, 8 Jul 2019 17:13:35 +0200 Message-Id: <20190708150531.760421168@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150525.973820964@linuxfoundation.org> References: <20190708150525.973820964@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ard Biesheuvel commit 6f496a555d93db7a11d4860b9220d904822f586a upstream. When KASLR and KASAN are both enabled, we keep the modules where they are, and randomize the placement of the kernel so it is within 2 GB of the module region. The reason for this is that putting modules in the vmalloc region (like we normally do when KASLR is enabled) is not possible in this case, given that the entire vmalloc region is already backed by KASAN zero shadow pages, and so allocating dedicated KASAN shadow space as required by loaded modules is not possible. The default module allocation window is set to [_etext - 128MB, _etext] in kaslr.c, which is appropriate for KASLR kernels booted without a seed or with 'nokaslr' on the command line. However, as it turns out, it is not quite correct for the KASAN case, since it still intersects the vmalloc region at the top, where attempts to allocate shadow pages will collide with the KASAN zero shadow pages, causing a WARN() and all kinds of other trouble. So cap the top end to MODULES_END explicitly when running with KASAN. Cc: # 4.9+ Acked-by: Catalin Marinas Tested-by: Catalin Marinas Signed-off-by: Ard Biesheuvel [will: backport to 4.9.y] Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/module.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/arch/arm64/kernel/module.c +++ b/arch/arm64/kernel/module.c @@ -33,10 +33,14 @@ void *module_alloc(unsigned long size) { void *p; + u64 module_alloc_end = module_alloc_base + MODULES_VSIZE; + + if (IS_ENABLED(CONFIG_KASAN)) + /* don't exceed the static module region - see below */ + module_alloc_end = MODULES_END; p = __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base, - module_alloc_base + MODULES_VSIZE, - GFP_KERNEL, PAGE_KERNEL_EXEC, 0, + module_alloc_end, GFP_KERNEL, PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE, __builtin_return_address(0)); if (!p && IS_ENABLED(CONFIG_ARM64_MODULE_PLTS) &&