Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4293157imm; Mon, 30 Jul 2018 11:55:12 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd47kacGf3zs7x1LMoN4Sb0+DfjGD6lOxfdWtqYHlmaN5Q+QdhLdss+rmR4NpGdYITeMCyP X-Received: by 2002:a65:608b:: with SMTP id t11-v6mr17553634pgu.259.1532976912478; Mon, 30 Jul 2018 11:55:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532976912; cv=none; d=google.com; s=arc-20160816; b=dXk9jsiV9/pDDm0+Cj2FrwawHssH8E4lk+Z7369ucfB0JePQ1VdI8RHjqeDrEp9Nu5 yKi+dri0spPvZfCSdayVR1SbYHZ1ZDRdZOcwj7n3PpShrLr/WKXrXm5X8owBn6elB/VG 2xKuPMt3+rBLe+pJAICAb9dGiqSJPm+pN5Kvts/BAotJdr1mIKHDNd+3jBOr9q6CnBcQ NqxmCSszgQXBLahUDtmOH4QnUkD4pwzqiyQEdhjLvPRKNhfPdNogBmt/9UGlF7tzKbhX NIuHSpdkf4gkdtoQnePP91arH0MB9pnkeMBVFDnGPPNfwpr/kdDqw1azFXBCm39/4M+Z 6NnA== 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:message-id:subject:cc :to:from:date:arc-authentication-results; bh=xTtUG/5xAS9wnrmT/yMdmoyZjMP8rvAEWGucTuHZyqA=; b=IEkqV1q0RcZ7I5Xx80/S0vYMAKGAupARjsBH+O9ZNIpU0J2ncwItJZpfireU3j4ApT 1V50jCFwVuNiirx6MhzfbhzJrVGNYIEtGN3QqtXAv06G11QuCcOBsWOoJzWnJVo3BVEr XKNwXNXbsyGFLspo/nZrRAHsrGJ8sZR/yBaqT2lvf6fVc07S/uDBLaw0ti/o7oorE3BR a8uQIEQIKLZhvnICo5NFSU7LIVxR1/Pdb70+uedtv4YM9CG6iJW3KOEDt8Qu7fovmk0Y lm5YU7SAOn3yZiD1S204Hh9RWP5UdzK0d8uUwtXtBDw3Jlt8eNjF5/4YzWiBZY2qkkyj RPnQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 144-v6si8455108pfw.95.2018.07.30.11.54.57; Mon, 30 Jul 2018 11:55:12 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731597AbeG3Uab (ORCPT + 99 others); Mon, 30 Jul 2018 16:30:31 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47748 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730400AbeG3Uab (ORCPT ); Mon, 30 Jul 2018 16:30:31 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C3D6E9017; Mon, 30 Jul 2018 18:54:11 +0000 (UTC) Received: from treble (ovpn-120-73.rdu2.redhat.com [10.10.120.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6C85A20389E0; Mon, 30 Jul 2018 18:54:10 +0000 (UTC) Date: Mon, 30 Jul 2018 13:54:08 -0500 From: Josh Poimboeuf To: Jeremy Cline Cc: Theodore Ts'o , Andreas Dilger , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2] ext4: mballoc: Fix spectre gadget in ext4_mb_regular_allocator Message-ID: <20180730185408.hl6omiitkqpac5d3@treble> References: <20180730180747.25200-1-jcline@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180730180747.25200-1-jcline@redhat.com> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 30 Jul 2018 18:54:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 30 Jul 2018 18:54:11 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jpoimboe@redhat.com' RCPT:'' 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 Reviewed-by: Josh Poimboeuf -- Josh