From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-173.mta1.migadu.com (out-173.mta1.migadu.com [95.215.58.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 987BD368941 for ; Mon, 11 May 2026 02:49:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778467778; cv=none; b=Plbbvh4kXdFZcDBLrbDVQgLgqRf79BzQuOaSjmjqNGhUAeKh+/7e9Zk89gPoGlvG3Zc6qnTGqFBKGdSJfRAeSdKgOsZ/4B4a6HuKETBCSszZCJXaOCtCwIU25WAfgnfICOoRL2q/3QP0PeGG7EQa80Xuq2jAKlAOJCKgOnjCdXw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778467778; c=relaxed/simple; bh=Q8yhCRo8NzonWlSii0d9l+VLVr8OjGe8OGS49wtMk6g=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=U+QFvDRK6fKSz73SverRI58H6ZI9SsWFFrkOvP6LB9N3gFyViJIk5vQ5mdWsbKrALRmb28EALGTYBqgtptc1pm3aZWBdacc/yUp6NGCMIwsRC4gPL1poL0i+G3GaUh6y2Ve2WlFnecbIu0Vb8RmubwY4KzcpTQbLDvs0cCezWTs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=rx/sUNmw; arc=none smtp.client-ip=95.215.58.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="rx/sUNmw" Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1778467773; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q8yhCRo8NzonWlSii0d9l+VLVr8OjGe8OGS49wtMk6g=; b=rx/sUNmwJV38UnKGxGVDoFaVY5c0MfDnP18yB86HQKy5DCPvh9xUtiIVRFapNtZ6lZYqnq aBruLqAnQFzM0rGCKVavU2HEzKESK0BSehaX2up3LPg3lmYoSk9UJvRFfeZ+QKY9f82A0y m6tuvn+E1nFVUyJ0kHl7DbC0/hqMz1c= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.500.181\)) Subject: Re: [PATCH] mm/shrinker: avoid out-of-bounds read in set_shrinker_bit() X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: <20260510183700.102475-1-devnexen@gmail.com> Date: Mon, 11 May 2026 10:48:41 +0800 Cc: Andrew Morton , Dave Chinner , Qi Zheng , Roman Gushchin , linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <3E00B1F3-9C41-4E41-892B-81BE19C3757C@linux.dev> References: <20260510183700.102475-1-devnexen@gmail.com> To: David Carlier X-Migadu-Flow: FLOW_OUT > On May 11, 2026, at 02:37, David Carlier wrote: >=20 > set_shrinker_bit() reads info->unit[shrinker_id_to_index(shrinker_id)] > before checking shrinker_id against info->map_nr_max, so an id past = the > currently visible map_nr_max reads past the unit[] array before the > WARN_ON_ONCE() catches it. >=20 > Move the load into the bounded branch. >=20 > Fixes: 307bececcd12 ("mm: shrinker: add a secondary array for = shrinker_info::{map, nr_deferred}") > Signed-off-by: David Carlier Acked-by: Muchun Song Thanks.