From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40D25C2BB55 for ; Tue, 7 Apr 2020 15:44:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F409F20730 for ; Tue, 7 Apr 2020 15:44:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="QoSShl9o" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F409F20730 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A8F188E0034; Tue, 7 Apr 2020 11:44:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A408B8E002A; Tue, 7 Apr 2020 11:44:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 956CA8E0034; Tue, 7 Apr 2020 11:44:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0200.hostedemail.com [216.40.44.200]) by kanga.kvack.org (Postfix) with ESMTP id 7FC318E002A for ; Tue, 7 Apr 2020 11:44:57 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 3AE621F1A for ; Tue, 7 Apr 2020 15:44:57 +0000 (UTC) X-FDA: 76681482234.07.foot68_2b33ddd8a550f X-HE-Tag: foot68_2b33ddd8a550f X-Filterd-Recvd-Size: 4541 Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Tue, 7 Apr 2020 15:44:56 +0000 (UTC) Received: by mail-lj1-f195.google.com with SMTP id p10so4301477ljn.1 for ; Tue, 07 Apr 2020 08:44:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5Y6Hx1sXgJ3W5d0gTkp6nD1FW85ltE5sJAkh5hIto3A=; b=QoSShl9oiN/+zyCgi+M5b9ay4gbY0igdPZcELx3hFDjksWUQnrgJlAFGIBzEKmr4jp GWnJl5dnFxKhoCI5IGvvQqbEEp0eZlH03J2tFItJeKqX97kAW0keTpO+wb1Z3pjATCCy UNQpOCiIYNAqhbyGH35z5yaeRiMvOI/XPKTdE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5Y6Hx1sXgJ3W5d0gTkp6nD1FW85ltE5sJAkh5hIto3A=; b=XO/Fdfd5W8r/Clp3iqNDYWKA5D1Z0CmHiw0MJGzqa2JTBaQJqUgnb5ZDho8a4gPuHO dXEKiVHNtdEPOqP41fjmw/xQjepL3dgdtAhH4w0Gmo5un9/OdBj9CigjwMGzrCu7YTUa 2NUTGzY6WBTy6gmOIB/64Ad0li3kWC6mKehCABc1iASNwqNUppve/mKlKiF8ku0glRmA tTh3u2usm7tZsVn8UBXYqv4WqUVEhQP/1mw342IrXdUZJ/Guq3T4U91FvgjKQTSNSqQ2 jjzCffeYTpn72snbm9uQ1ErZoE4lVrjXo08L6/sdsRdHv/wFC4v63f47xKF8QxC6qDFg SM6w== X-Gm-Message-State: AGi0Pub0LaZ6q6G9RvHgZB3O1ZS+13FTxOUKXNVqeHpuwZ7rMZBYzGvl VZ895Dtt00torAJufE64Sz4lAIaFn0g= X-Google-Smtp-Source: APiQypLOKTL0dHKdbOSIeBSSOu9wrObanwFsMa7mPwQsnUyBEj3xucqt7s6AmT0Fx8JVni+BlwlKbw== X-Received: by 2002:a05:651c:390:: with SMTP id e16mr2059313ljp.142.1586274294492; Tue, 07 Apr 2020 08:44:54 -0700 (PDT) Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com. [209.85.167.49]) by smtp.gmail.com with ESMTPSA id i4sm13552628lfl.57.2020.04.07.08.44.52 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Apr 2020 08:44:53 -0700 (PDT) Received: by mail-lf1-f49.google.com with SMTP id z23so2743575lfh.8 for ; Tue, 07 Apr 2020 08:44:52 -0700 (PDT) X-Received: by 2002:a19:9109:: with SMTP id t9mr1918172lfd.10.1586274292580; Tue, 07 Apr 2020 08:44:52 -0700 (PDT) MIME-Version: 1.0 References: <20200406200254.a69ebd9e08c4074e41ddebaf@linux-foundation.org> <20200407031042.8o-fYMox-%akpm@linux-foundation.org> In-Reply-To: <20200407031042.8o-fYMox-%akpm@linux-foundation.org> From: Linus Torvalds Date: Tue, 7 Apr 2020 08:44:35 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [patch 125/166] lib/list: prevent compiler reloads inside 'safe' list iteration To: Andrew Morton Cc: Chris Wilson , David Laight , Marco Elver , Linux-MM , Mark Rutland , mm-commits@vger.kernel.org, "Paul E. McKenney" , Randy Dunlap , stable Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Apr 6, 2020 at 8:10 PM Andrew Morton wrote: > > From: Chris Wilson > Subject: lib/list: prevent compiler reloads inside 'safe' list iteration > > Instruct the compiler to read the next element in the list iteration > once, and that it is not allowed to reload the value from the stale > element later. This is important as during the course of the safe > iteration, the stale element may be poisoned (unbeknownst to the > compiler). Andrew, Chris, this one looks rather questionable to me. How the heck would the ->next pointer be changed without the compiler being aware of it? That implies a bug to begin with - possibly an inline asm that changes kernel memory without having a memory clobber. Quite fundamentally, the READ_ONCE() doesn't seem to fix anything. If something else can change the list _concurrently_, it's still completely broken, and hiding the KASAN report is just hiding a bug. What and where was the actual KASAN issue? The commit log doesn't say... Linus