Message ID | 1519908862-11425-5-git-send-email-alex.shi@linaro.org |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp2760559edc; Thu, 1 Mar 2018 04:55:46 -0800 (PST) X-Google-Smtp-Source: AG47ELvRjYifAMTSBczhImcKIzgjcGL+jRDvgPkZ8gv68hPW+e9KDcyWu+I89RKhIvIh8eo1XYCM X-Received: by 10.99.110.5 with SMTP id j5mr1458659pgc.65.1519908946004; Thu, 01 Mar 2018 04:55:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519908945; cv=none; d=google.com; s=arc-20160816; b=Tau/PzApld6rgCofLxwv6AEV3EYy6JjKTsMHqqOgWQIGMETL8Pbsl3aNM2dFuQrib6 3co7B8i7Jj+/CdI5wAJAoMdQE2QYlTiM1wQkTijMHDHLWcJUtxRg8D02kAD5ZO+RiTyP tVpRMoeoFM5w0QQxlG0XP8BZaSPsvuQ16iLrKiH/zFHqVq6QEUixPPxymIQt0TW0fBN7 tt3Ybo8EfOPhcjVDy7qN7NIAsZh47cn+KQ9NcTPaa6uk9fgK7Ha/UwUn1FI8mOVH/uDq 6k4tgZgrsxpDrjv2DwGzmn9fURZ6XOfNvSMzAY3L8fGR1LRKH63h46ki6XFwFwuRIlqf 7pKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=1urEszs1X1+fSgF2FtrvQb+AjsP1I5AehCNh9xZoYO0=; b=gMrfI1KWenz4ZjTyuwQQ91lYn40yaAJcRC0Hu1UQy+3cPrLmm/LECkiyPi539B9leo JLPJ98F0kUPk96KT3dPEPGqLKZfkFgoXG/H3m9MgQl1BHFLbmhdQoeHkD7DuvCL8tMhU Q3utfT9+tTwCicYlSyHUglh9IrkT7IxZgfY28h+8EviUAJjHO/9e2Jys4N6Q4RY7DqvS XPgnK8c/37R7uxF8PakOjsAV+qpeq6NGV1XFiPGKHt0jLAiT/X1ut6YrYyaurrOf+H79 nVR3OQjb/NJ0BmMpn7Fs8dx51QcZsz6AICPj69gIZyUbMpvHpYeibjxT6wFUDZKqBR1y sirQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Vm6pcX2U; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: <linux-kernel-owner@vger.kernel.org> Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c10si2454231pgf.230.2018.03.01.04.55.45; Thu, 01 Mar 2018 04:55:45 -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=@linaro.org header.s=google header.b=Vm6pcX2U; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030646AbeCAMzm (ORCPT <rfc822; dan.rue@linaro.org> + 28 others); Thu, 1 Mar 2018 07:55:42 -0500 Received: from mail-pl0-f65.google.com ([209.85.160.65]:32883 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030629AbeCAMzj (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 1 Mar 2018 07:55:39 -0500 Received: by mail-pl0-f65.google.com with SMTP id c11-v6so3602536plo.0 for <linux-kernel@vger.kernel.org>; Thu, 01 Mar 2018 04:55:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1urEszs1X1+fSgF2FtrvQb+AjsP1I5AehCNh9xZoYO0=; b=Vm6pcX2UzAbaWdmyVa0rPvXZyO2E8/n8CFR09KxGgLr7DE84EkFSOc58SyN7MgSzHs R140O1gA1/VhJMJRrfpYoHFqDGmBjG0KNF0Pz/9niTXSBo1iMAboRvBbN0DACyGbIVAP DuTd7fju1g+IeY/LScim2LVwWOpyXitzWnwIs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1urEszs1X1+fSgF2FtrvQb+AjsP1I5AehCNh9xZoYO0=; b=qzpoumiRtOtnJbFW8BfKHIz1EtNb/9Kkil/VwF7PicBWphvTGi0F1WLSjAPfAsl1l7 BKWUqHc/tWtxrK383f7RMpuCTFzfLA12BUR6rvd3j87TG6QCAKHphMEWGNRWtBX2yN6u em49STmEIuFZm315cTIbhufkAHKqRWUTPUn0Vd8NX8zwrX0vN2saGhSq6/ciChMrEvLH zL/NAYGGTJIdCmUhAbZJuxsWtJoOCWHm78BIsqBhnjPyAnE4el9/llVrUlZB6dh6JRvb TnUGZMlKFgRkwP3xR0kHzpqNB4GgduGSbIpAHkj0JidZON3J6wl6oG2Nut1VlThzhHEh RO6w== X-Gm-Message-State: APf1xPCmrZmKM5tEkHKeTCwnB9nITsT1cHi6JmL5FTrFgMknzb9ZzuOO 7sbxjSVPDZonVpKYhOZcTejqSA== X-Received: by 2002:a17:902:b605:: with SMTP id b5-v6mr1871768pls.354.1519908939113; Thu, 01 Mar 2018 04:55:39 -0800 (PST) Received: from localhost.localdomain (176.122.172.82.16clouds.com. [176.122.172.82]) by smtp.gmail.com with ESMTPSA id x4sm2289655pfb.46.2018.03.01.04.55.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Mar 2018 04:55:38 -0800 (PST) From: Alex Shi <alex.shi@linaro.org> To: Marc Zyngier <marc.zyngier@arm.com>, Will Deacon <will.deacon@arm.com>, Ard Biesheuvel <ard.biesheuvel@linaro.org>, Catalin Marinas <catalin.marinas@arm.com>, stable@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Robin Murphy <robin.murphy@arm.com>, Alex Shi <alex.shi@linaro.org> Subject: [PATCH 04/45] arm64: Implement array_index_mask_nospec() Date: Thu, 1 Mar 2018 20:53:41 +0800 Message-Id: <1519908862-11425-5-git-send-email-alex.shi@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519908862-11425-1-git-send-email-alex.shi@linaro.org> References: <1519908862-11425-1-git-send-email-alex.shi@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org |
Series |
arm Spectre fix backport review for LTS 4.9
|
expand
|
diff --git a/arch/arm64/include/asm/barrier.h b/arch/arm64/include/asm/barrier.h index c68fdc5..0b0755c 100644 --- a/arch/arm64/include/asm/barrier.h +++ b/arch/arm64/include/asm/barrier.h @@ -40,6 +40,27 @@ #define dma_rmb() dmb(oshld) #define dma_wmb() dmb(oshst) +/* + * Generate a mask for array_index__nospec() that is ~0UL when 0 <= idx < sz + * and 0 otherwise. + */ +#define array_index_mask_nospec array_index_mask_nospec +static inline unsigned long array_index_mask_nospec(unsigned long idx, + unsigned long sz) +{ + unsigned long mask; + + asm volatile( + " cmp %1, %2\n" + " sbc %0, xzr, xzr\n" + : "=r" (mask) + : "r" (idx), "Ir" (sz) + : "cc"); + + csdb(); + return mask; +} + #define __smp_mb() dmb(ish) #define __smp_rmb() dmb(ishld) #define __smp_wmb() dmb(ishst)