Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp931397imi; Thu, 21 Jul 2022 13:51:15 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u0ziHE4qPHMfqwIWRrFLVMoWpn1ICEM5fYGJNZmwBiC13HOH/pnInINi9ZTgXjqgQiRLWo X-Received: by 2002:a17:90a:d195:b0:1ef:b15e:8cb5 with SMTP id fu21-20020a17090ad19500b001efb15e8cb5mr267612pjb.228.1658436675401; Thu, 21 Jul 2022 13:51:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658436675; cv=none; d=google.com; s=arc-20160816; b=bDrjyhKvvl5gUlkq/M20Zda3kR9ML+Qp1UEWZ1Z+1yOf6SOVJ07Y97K3lvjPsWw9i9 thqkWhdmILqUKuN+KS1P6l/8WaxFJE7GltDWpuyxU1vxXKeZRWee8mr9iszJTjpJuxc7 oLzixQoa8x7CQ3dgUDK4/960XoGttYIG89lYGLHrL+2yAlS++1021ktMt10LDT7mr8yH xvMfAcENUEXdxMUOT03wUU5TOl/xbf+oeyD6fJ/8/vcErY+sNXV0e7Td+t4/+mqqiE6Q 1YDYdf0pR/chu5FBxGSiOPnwE6/xwUWggW1XtXI/gL+czPPQNCGXJ3tERUWqn8/uYZ2N x/Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=MY3kboTjNAZXbrK31xdc4/MyqehNd793LiUl2690CR8=; b=S+kAOeMj9c5DeUt3JfSAZP54dpVw5hMxSqcfjtybKC05l4KvTgs4CgC4gkdEXliC/l OYLfeAq9HDP50xaSQg9W28ru4Q0/uTe2zCkbvBptPdpQFdy1SY/iqA9PCg0NWltO2/4j f58HWzBI0BRi7WMZjZlI1kA0FCCluV3jI8lOTLwJcTJgFK0REUhfozIyoa3muz9u63gK Hfej137DMix3OyNYs4HZaFSwpigDMvYObf6fty+rAXH1p6FOLkWYhfJdrEB3LykSJlkP 448rUM2nGXby84wlwPh5yj8AMI8jJyiwHvNIaycm2qtM3+Dq0qPLH3toyX+Wd1sJLCEv yBHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=V6UHbJdA; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d8-20020a170902b70800b0016ced932975si3262190pls.403.2022.07.21.13.51.01; Thu, 21 Jul 2022 13:51:15 -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=@gmail.com header.s=20210112 header.b=V6UHbJdA; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232640AbiGUUlv (ORCPT + 99 others); Thu, 21 Jul 2022 16:41:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbiGUUlu (ORCPT ); Thu, 21 Jul 2022 16:41:50 -0400 Received: from mail-qv1-xf32.google.com (mail-qv1-xf32.google.com [IPv6:2607:f8b0:4864:20::f32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 058C18F50B for ; Thu, 21 Jul 2022 13:41:49 -0700 (PDT) Received: by mail-qv1-xf32.google.com with SMTP id i7so2130728qvr.8 for ; Thu, 21 Jul 2022 13:41:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MY3kboTjNAZXbrK31xdc4/MyqehNd793LiUl2690CR8=; b=V6UHbJdA6E3eNP/Ito/PHrAmnT5s2OUvqIpOIiXwGUSNLtENrmuYbzZPhGbDIKZz/2 lW/sFCtVKkEFIXrzgRUYwvhgWeR9y0DDhuoqBxrztTVnAguGUiK5ZBQJBPm+dhxTEfZv oDFj5/yaOZ5MMqBgQ6EVJ2taS9AQmIlRtZLQQF228pp2np7/AaHk95h72d5VY+lvugd8 YDdu5bcWxRe+4/Jq6su8eU5EC9E/WLL2zKal95Xd9c79wvQkx17g0e1SAzzPsBUsL1aM D7OTA3JMES64hS+DNL7jVOKYKSJbItEGTML21ZX/Uuzfs6bGbr09OIC3Xus3KhDzHjx3 66Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MY3kboTjNAZXbrK31xdc4/MyqehNd793LiUl2690CR8=; b=2IfPoNXut1RWs4XHsXLkzDU7bJKtEsjFg9sFDLa0IvAtKar6sx+vUQIf6WqOg+XFpm BeXSxsOaJOE3uVacze117mgcaFSby6ozBLmRp/TBwgmtnuIjuzfP6q9DBbSxJjtVc/S4 KSHhGRa5FVmjJl2agP/nXk9S4UaS4sBloWRFMxHfbBWGBTMLTpfbSIvrfKo2/X6T8QOe JbWJo688SSN0AZMMz7LqScglju2brERdopgI9MufeYlHB8o5ll9TvGoU2ri35MjaA1l+ 0lJh5UhlOYaGIzlnzl0BN7KntLwbXkq8DZb8ImRFFZ1U+sqNyYZArD6HmqH+/yUqcp2y ClTw== X-Gm-Message-State: AJIora9Mdaw+nmc08j6DpgU4o4BUydkj98pX60tjdjiljEq95K9PiH4K Z730PRqITwO1stNs1dsuciBPreTVCZsCXmO0ed0= X-Received: by 2002:a05:6214:2a4c:b0:472:f8bf:ca74 with SMTP id jf12-20020a0562142a4c00b00472f8bfca74mr323196qvb.111.1658436107864; Thu, 21 Jul 2022 13:41:47 -0700 (PDT) MIME-Version: 1.0 References: <0e910197bfbcf505122f6dae2ee9b90ff8ee31f7.1658189199.git.andreyknvl@google.com> In-Reply-To: From: Andrey Konovalov Date: Thu, 21 Jul 2022 22:41:36 +0200 Message-ID: Subject: Re: [PATCH mm v2 30/33] kasan: implement stack ring for tag-based modes To: Marco Elver Cc: andrey.konovalov@linux.dev, Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , kasan-dev , Peter Collingbourne , Evgenii Stepanov , Florian Mayer , Andrew Morton , Linux Memory Management List , LKML , Andrey Konovalov Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 Tue, Jul 19, 2022 at 1:41 PM Marco Elver wrote: > > > + for (u64 i = pos - 1; i != pos - 1 - KASAN_STACK_RING_SIZE; i--) { > > + if (alloc_found && free_found) > > + break; > > + > > + entry = &stack_ring.entries[i % KASAN_STACK_RING_SIZE]; > > + > > + /* Paired with smp_store_release() in save_stack_info(). */ > > + ptr = (void *)smp_load_acquire(&entry->ptr); > > + > > + if (kasan_reset_tag(ptr) != info->object || > > + get_tag(ptr) != get_tag(info->access_addr)) > > + continue; > > + > > + pid = READ_ONCE(entry->pid); > > + stack = READ_ONCE(entry->stack); > > + is_free = READ_ONCE(entry->is_free); > > + > > + /* Try detecting if the entry was changed while being read. */ > > + smp_mb(); > > + if (ptr != (void *)READ_ONCE(entry->ptr)) > > + continue; > > I thought the re-validation is no longer needed because of the rwlock > protection? Oh, yes, forgot to remove this. Will either do in v3 if there are more things to fix, or will just send a small fix-up patch if the rest of the series looks good. > The rest looks fine now. Thank you, Marco!