Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp29719987rwd; Wed, 5 Jul 2023 16:44:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlFLJktITvPxJe0G/qjk8DouXvoKXfY0c49rVBXi9cQ8SIDtgQ8Tfl890YgXqAJe0ceX5HgW X-Received: by 2002:a05:6a20:1393:b0:12e:caac:f25b with SMTP id hn19-20020a056a20139300b0012ecaacf25bmr245112pzc.42.1688600667497; Wed, 05 Jul 2023 16:44:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688600667; cv=none; d=google.com; s=arc-20160816; b=RqVnaOIPD+PM1q9YydVrbp6qnD/iDhMpaANPnjiOOqKn8FsPzLb+16C33p2F32zIO6 EKK7UVXR3H3nu3lt7VkyYUBq6CPssuzJd2wFBMTzAtAffMjfhtr97SPdRaPQtaOquapQ BAKlcq+p52dA+heyJPFA1pbagw7Vpl2+BTHZUpguT83ZINkJVNTq9yQDjhTslfhwFMYL XkdO5abofjxRcBlTLiyKd4Bqp9+Eessrw0kfF/TUfMoi4Pz9t1vPd4zBy/q7SigatoUf RWXyZAXNuzkmF91c3dO+IqJKui8+cSTZMV2XLtslZjbM7BLvb0Ni1Jf5+9GzoeSdP2iU 6DEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:cc:content-transfer-encoding :mime-version:date:message-id:subject:references:in-reply-to :dkim-signature; bh=9I+KC5szuYeC056URDwDfaLH071wQ+5HX+v21iNWI4M=; fh=xkBfpSUmiq/o2xdyymPPLT08xUXa+DQTTHP5eHlBNH0=; b=Pl6yYV5uy2Xqx/3VSDHRpw8YFJI4iPh1PRdHJjos/d7+l318eoQ6ROu2z1D135r5fX De4ZyC5p4xgz3TluOJiZvebZkQQMJCKYPoUZuIgfe/u4zEnHsCpIVP3NBvprMrc39/C+ ThloYDTk73pHgyrHhPmiaczRE7/HWlTkbOyKm8o66TW+Gs4ZjczCb9FtgWFV5/BS1wxp I+Bt3YpRwk9JiGg8+a58VgNajXBiGB5l5Wy3BmMca4IbgZfAd2zr+h37ifBBXXcZFkFx l9wnItwmTz7pD9VFplw2KfUu5M4KarizsXJS9ddoFcCYnq2snEKhzyibAD+Cs4fykfgL hzQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=zFu9wtKb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m29-20020a62a21d000000b00677ca082233si219855pff.46.2023.07.05.16.44.15; Wed, 05 Jul 2023 16:44:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=zFu9wtKb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232305AbjGEXkv (ORCPT + 99 others); Wed, 5 Jul 2023 19:40:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232085AbjGEXko (ORCPT ); Wed, 5 Jul 2023 19:40:44 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FB351995 for ; Wed, 5 Jul 2023 16:40:43 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1b8b318c5a7so8030965ad.3 for ; Wed, 05 Jul 2023 16:40:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1688600443; x=1691192443; h=to:from:cc:content-transfer-encoding:mime-version:date:message-id :subject:references:in-reply-to:from:to:cc:subject:date:message-id :reply-to; bh=9I+KC5szuYeC056URDwDfaLH071wQ+5HX+v21iNWI4M=; b=zFu9wtKbHoud76MC9bRZr7ra5IVMIW9jjDhAD83FYmcIWC6lsHh7Gen6BRDlcxUBJB 9sD19tENt5jIbW+a676ca7f8Z0W8rZAjh4Mv9Xgc+PuP0d3o/yfC9eHW5NQAOIml2MaF h8W/ZXnZrffB8JuoXBEZPtBA7JqQXOu/oz32Y7PxW34BZC6048Lw/tx8c5aztm56uYaF YXHg/xOxdiUYxhyd92SW9jNcI6zm3wUdjWlDZIXtPCUQBVkGTX6m17NSlpqu2wmYDNcX /++6fT0hpE49gUZtCdKTSVlN17QGbmhodzHgxpzN6pFqhyYTHsEkgAXerBD68BjVhfNI DIqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688600443; x=1691192443; h=to:from:cc:content-transfer-encoding:mime-version:date:message-id :subject:references:in-reply-to:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9I+KC5szuYeC056URDwDfaLH071wQ+5HX+v21iNWI4M=; b=UiKZiRA6Bi4r57/oF5xX9ky5RjwBOLxH15nDWGPk1D8a7OPmdTRP9fVsl/wB0gBAJJ uy+UCJOmjR5ywqVtjcQYF/VBHq6bNIvk25sCp2kksf58jQO8VRYZuKNYTBD+Jlu7Kh76 oQ39etBwzgRkdltPeGJ5vcjwiHI/8GvxyxVklAMlvvQa7Cn5q+PfQsV5PgC6rueUdWSm LUAoK/O//+9Z15QXZ2EBsqejFxD4AbhTIJx1v9WRCNTMkzkHeEHHLP0U/CzEY7Vizu8o lLnreH40OrNAYec+Nj3l8tOg7skgrnhyR8qqxVXdJQ76NqCxWFkUADbzp31CukMzAE6H bHdg== X-Gm-Message-State: ABy/qLZL95KH20+7UXerFRkzyB89GtxqXtjMHYFpK81LmPFEHfqhxx5h jdAOYb4zdZGJSpe2klphhlT6cQ== X-Received: by 2002:a17:902:b942:b0:1b3:f8db:6f0c with SMTP id h2-20020a170902b94200b001b3f8db6f0cmr354847pls.58.1688600442742; Wed, 05 Jul 2023 16:40:42 -0700 (PDT) Received: from localhost ([135.180.227.0]) by smtp.gmail.com with ESMTPSA id y22-20020a17090264d600b001ab18eaf90esm31967pli.158.2023.07.05.16.40.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jul 2023 16:40:42 -0700 (PDT) In-Reply-To: <20230703190044.311730-1-jhubbard@nvidia.com> References: <20230703190044.311730-1-jhubbard@nvidia.com> Subject: Re: [PATCH] mm: riscv: fix an unsafe pte read in huge_pte_alloc() Message-Id: <168860030766.22647.15542339368600249770.b4-ty@rivosinc.com> Date: Wed, 05 Jul 2023 16:38:27 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Mailer: b4 0.13-dev-901c5 Cc: Albert Ou , Alexandre Ghiti , Andrew Jones , Hugh Dickins , Palmer Dabbelt , Paul Walmsley , Qinglin Pan , linux-riscv@lists.infradead.org, linux-mm@kvack.org, LKML , James Houghton , Ryan Roberts From: Palmer Dabbelt To: Andrew Morton , John Hubbard X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 03 Jul 2023 12:00:44 -0700, John Hubbard wrote: > The WARN_ON_ONCE() statement in riscv's huge_pte_alloc() is susceptible > to false positives, because the pte is read twice at the C language > level, locklessly, within the same conditional statement. Depending on > compiler behavior, this can lead to generated machine code that actually > reads the pte just once, or twice. Reading twice will expose the code to > changing pte values and cause incorrect behavior. > > [...] Applied, thanks! [1/1] mm: riscv: fix an unsafe pte read in huge_pte_alloc() https://git.kernel.org/palmer/c/62ba41d27612 Best regards, -- Palmer Dabbelt