Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3924964imm; Mon, 8 Oct 2018 11:46:59 -0700 (PDT) X-Google-Smtp-Source: ACcGV62iy8gYGBECr+576S3hUCIacc5rHltiWFFB/YqD/X5Z7Pdli/bqik3T4wiYsonG5ogNd1ht X-Received: by 2002:a63:c044:: with SMTP id z4-v6mr22080767pgi.274.1539024419370; Mon, 08 Oct 2018 11:46:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539024419; cv=none; d=google.com; s=arc-20160816; b=tw+BghawFh0oL1iLEk3OCe+44q4+JKJMfhZw95N9XZTH1qUa9LhNWSKKDGFauGpbK+ L8CokaoVt4ATNYLoPSz5MkyR8e1JbV81jnzRcKlNLgGMvAKDU9qjN+pIS5BaDB6EQ0zi 9uCqY1faofnwgaPwFEsdEsRKHEvH13wTDXVLX84QWLosMdcDcNcsU/Ha5vF9Xi9H7SXO Ui5rC1k6Jb/iZmpk++3+HdlarmLEyoOwiH28WuE3Q7HPpGQZzel6Dp4+vroP9b4aRwsF wvpzhOh/oNA78CgrTKKJcvzxay7Zhi4tQlXKz8lL/Cg6B1nlqnawgmioOw0dNGF4tgeA WfCA== 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=mBEiXr+9iGAz6deFTq5b492aBIET5Bg/lRhewmupNfU=; b=V1ejhrf8aqzwinaG76AmgDexJ+pae2QOsFabWnB4GDia5DwFvmYzPcs7HOQ41vkxuu vqk+tKMvI9rFT+iX9V/F1zvdeo9jGM4whhiOpx951SuJcBoNtHsSjTbyQLG/xpmm0zTY g3jGKfN+MjsjVvREuSqyEwNAHMlVWtuj57o3YNAyGZTd+VJP43y/Ym+YMQOkctQCuxlv rIW1oyUNJ5PDYLGy24nILdxu1DS03+qli/gViuqzZMcZ4ZJRogG/bvQFHkNWbZ2Cz/5R VWUZkAPOSNPRO6Co6yW1GEGajoYg37uj1lZfDrrIni4VWRqw6Jc/Gl9XQfQgmWRA/uxX vANw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rc90iIFJ; 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 o18-v6si19327969pfj.25.2018.10.08.11.46.44; Mon, 08 Oct 2018 11:46:59 -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=rc90iIFJ; 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 S1731154AbeJIB7O (ORCPT + 99 others); Mon, 8 Oct 2018 21:59:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:47440 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728570AbeJIB7N (ORCPT ); Mon, 8 Oct 2018 21:59:13 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (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 EE7722064A; Mon, 8 Oct 2018 18:46:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539024367; bh=CNQqPVLaAzNc/y6r86HbUERgvUq8uQm94vmTnjZhs2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rc90iIFJbj+dtGwKnH+gbpjKeVvZGB7gKrJWuQowz+pFOiBcY0zYnNHcuemk9xGMP +VbMU6Ee5WvIwZfhoZN0OaXU+9B38i+ZPBxl9baTfGCSUL0yoOLEe7iSQMnnquDSXV RCiDSfeTA0i/hmiqYrkpiwLMcvmUrtzC5GiattCg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jinbum Park , Johannes Berg , Sasha Levin Subject: [PATCH 4.18 018/168] mac80211_hwsim: Fix possible Spectre-v1 for hwsim_world_regdom_custom Date: Mon, 8 Oct 2018 20:29:58 +0200 Message-Id: <20181008175620.744522583@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175620.043587728@linuxfoundation.org> References: <20181008175620.043587728@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jinbum Park [ Upstream commit 3a2af7cccbbaf2362db9053a946a6084e12bfa73 ] User controls @idx which to be used as index of hwsim_world_regdom_custom. So, It can be exploited via Spectre-like attack. (speculative execution) This kind of attack leaks address of hwsim_world_regdom_custom, It leads an attacker to bypass security mechanism such as KASLR. So sanitize @idx before using it to prevent attack. I leveraged strategy [1] to find and exploit this gadget. [1] https://github.com/jinb-park/linux-exploit/tree/master/exploit-remaining-spectre-gadget/ Signed-off-by: Jinbum Park [johannes: unwrap URL] Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/mac80211_hwsim.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "mac80211_hwsim.h" #define WARN_QUEUE 100 @@ -3229,6 +3230,9 @@ static int hwsim_new_radio_nl(struct sk_ kfree(hwname); return -EINVAL; } + + idx = array_index_nospec(idx, + ARRAY_SIZE(hwsim_world_regdom_custom)); param.regd = hwsim_world_regdom_custom[idx]; }