Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1636045imm; Wed, 1 Aug 2018 21:07:16 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe4HfILpz6Cuh4g8nRKfr9kc0PL/kPXQSAJfU0gyi/i63sPJU2zAfBl8YoEes0Knl7EJSgg X-Received: by 2002:aa7:8713:: with SMTP id b19-v6mr1146458pfo.151.1533182836046; Wed, 01 Aug 2018 21:07:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533182836; cv=none; d=google.com; s=arc-20160816; b=PWa4EfgyY7aM8zQD4ZS49b0TJqYhdJgBC2/DtIBJ2T4JesU1/pvkwuXQxGfiN+F8os h7ihw/uAObJIQ3QFXjODH+AGTvViq3GR4LYUV7+pmijs1/LzFtisYo6rel9EWJUSDmSG +AKF05KFuz11pCAmRbqf2tcv/WkJmk2k4vLvjY/toN1MqYwRJqlByojOlhKNEptlfdn5 /xBuOHZCgJtg0BGwBV/mRthSRkPKEVXHJTjF756v5i37u+cAPiQEKCDuxtJSOdFC5NL4 9pX+OggcQ3jiI4jaZQiZl234l7Vs0pjgzd3wpfToGzMleYVdAbmj6rZnasTd+09D/1lX Ct6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=LCCfssrd3CeWdkpKxHDAHOJ6cjkdIVLcqZC2rT8pLYA=; b=OfLYn2d/8tNE4N7lr7IagFzLUX0/awzgQJxV/TAHasxDxMEO4v8w79cL24hfTEI/FC WZewYMHUKnmtmSBGcqjZTG/z5pjRZHGKOZXjwC7wHUZ6E9ypFJxnRsr8zVk0Fizvla+p s/oPHSUocYg2P77n/DCTfvsVly2iaqeZjOmOMbqt/COMNn07iUPk2RRvsA/b+zmzH7yM jW+5b4HefOTZnT0QtrLEgUgRnoX8X4g123CBz8O3rfWCZb6R9xfaoSfBmsy+k/uNJjnC BzBaWiU6iyK1ZzPPz5V+JXf8xYRutwamOJi/LfPzWWe9Sd7IIvK5mV7PfZICb6ocUBdw e9PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@thunk.org header.s=ef5046eb header.b=CoSs6Q4V; 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 78-v6si814653pfb.204.2018.08.01.21.07.01; Wed, 01 Aug 2018 21:07:16 -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=fail header.i=@thunk.org header.s=ef5046eb header.b=CoSs6Q4V; 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 S1726229AbeHBFzV (ORCPT + 99 others); Thu, 2 Aug 2018 01:55:21 -0400 Received: from imap.thunk.org ([74.207.234.97]:56434 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725954AbeHBFzV (ORCPT ); Thu, 2 Aug 2018 01:55:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=thunk.org; s=ef5046eb; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=LCCfssrd3CeWdkpKxHDAHOJ6cjkdIVLcqZC2rT8pLYA=; b=CoSs6Q4VFm+I0zPZq/XSxi7mO+ l3TIHw+uUIA8ZSW76AmcaSozIE5Reo4dSlu9lfvCQrT5aNrevnnW9Kdf/myzCwAgmwXboTKCorwp6 SESzKpko+yj1YZMxBqy0oPqEAnH4Z04cMigGv5Ns9lY0yHM8TkmAMxNj3rorbD1hcLGA=; Received: from root (helo=callcc.thunk.org) by imap.thunk.org with local-esmtp (Exim 4.89) (envelope-from ) id 1fl4sM-0001vS-G9; Thu, 02 Aug 2018 04:06:10 +0000 Received: by callcc.thunk.org (Postfix, from userid 15806) id 5F2607A614F; Thu, 2 Aug 2018 00:06:09 -0400 (EDT) Date: Thu, 2 Aug 2018 00:06:09 -0400 From: "Theodore Y. Ts'o" To: Jeremy Cline Cc: Andreas Dilger , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, Josh Poimboeuf , stable@vger.kernel.org Subject: Re: [PATCH v2] ext4: mballoc: Fix spectre gadget in ext4_mb_regular_allocator Message-ID: <20180802040609.GD9187@thunk.org> Mail-Followup-To: "Theodore Y. Ts'o" , Jeremy Cline , Andreas Dilger , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, Josh Poimboeuf , stable@vger.kernel.org References: <20180730180747.25200-1-jcline@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180730180747.25200-1-jcline@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 30, 2018 at 06:07:47PM +0000, Jeremy Cline wrote: > 'ac->ac_g_ex.fe_len' is a user-controlled value which is used in the > derivation of 'ac->ac_2order'. 'ac->ac_2order', in turn, is used to > index arrays which makes it a potential spectre gadget. Fix this by > sanitizing the value assigned to 'ac->ac2_order'. This covers the > following accesses found with the help of smatch: > > * fs/ext4/mballoc.c:1896 ext4_mb_simple_scan_group() warn: potential > spectre issue 'grp->bb_counters' [w] (local cap) > > * fs/ext4/mballoc.c:445 mb_find_buddy() warn: potential spectre issue > 'EXT4_SB(e4b->bd_sb)->s_mb_offsets' [r] (local cap) > > * fs/ext4/mballoc.c:446 mb_find_buddy() warn: potential spectre issue > 'EXT4_SB(e4b->bd_sb)->s_mb_maxs' [r] (local cap) > > Cc: Josh Poimboeuf > Cc: stable@vger.kernel.org > Suggested-by: Josh Poimboeuf > Signed-off-by: Jeremy Cline Thanks, applied. - Ted