Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2735946imn; Tue, 2 Aug 2022 14:03:00 -0700 (PDT) X-Google-Smtp-Source: AA6agR4apaCjPMCp4MR7SRHv2NSE9Exh9oDCDzzj/azEpInLiiAv7DScBwBLl4gMWzu7kGKnVo6K X-Received: by 2002:a63:510f:0:b0:41b:f29f:1412 with SMTP id f15-20020a63510f000000b0041bf29f1412mr10695596pgb.547.1659474180139; Tue, 02 Aug 2022 14:03:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659474180; cv=none; d=google.com; s=arc-20160816; b=iLAYoYmOlVRXydx9ADmQ39E1KGrJepKh3en78bJgkoV49weW6P6astTacFlen9D4BD ipB6EU0RFtbfymvL4H88lN/vGmsEVGmjRQg8R8pyxpA93NLk5gOKTO8Ryfh8D+N0rsWI k7KspOCqy4C35FJxmVd2IXGN4YttBOSwbnewVPNMnlz4uUx44kg/crIBWjhibpF7NSwu 5gsNIBVZOXNxmRGnt1UgfLTuu4uo+Rt4yvC7m+8tJg2kdXU/814sm8sfzifyMNo1N9os 5P9B8BWhXvk44gg73XYFAFh41Rh1BQiIgBmCuwNg/V7I/l+b/lJaHdcwO1+2RFpPhIWg 9DCA== 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=kGCFQktL9LEp0y8IboY5IhTEHaLuC/gj8xxem3T8C/Y=; b=nScPrLdYSwOVuHgP3664U+760D6XRTXhkqnAAb82iM5pbFxTPodCVdjvtbRJ7bqm2k HfVQkI1nSUSQKnoQT3EWi3o/xiU7SlqwBPBZZ+kT+EnDwF8Om48YD0Ve8Ptuxr7JzkiF 62/iDQScTaKVZV/eO6AwSezvLMZZRadNslJRZJOFLlsVRi/yoZk8N36qcte/7lZ/jBFu o78X+YjuMSA6NJ82sKQVfmBAtwGkBnm6eDCDnUi32XLDIDQ/gFBNSWnuyUKRVRBjcnUx OZM6Olg3Iz++K8t5rzCVMuqMs++WUcMnrW9BnUOL2cdcnvB+UdMvUPsDd5le2Khil2Wz i/GA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qbPlwMtM; 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 h2-20020a170902f7c200b0016dad0dd520si261631plw.589.2022.08.02.14.02.35; Tue, 02 Aug 2022 14:03:00 -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=qbPlwMtM; 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 S229854AbiHBUri (ORCPT + 99 others); Tue, 2 Aug 2022 16:47:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233140AbiHBUpl (ORCPT ); Tue, 2 Aug 2022 16:45:41 -0400 Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A35E81147C for ; Tue, 2 Aug 2022 13:45:38 -0700 (PDT) Received: by mail-qk1-x72e.google.com with SMTP id f14so11573402qkm.0 for ; Tue, 02 Aug 2022 13:45:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=kGCFQktL9LEp0y8IboY5IhTEHaLuC/gj8xxem3T8C/Y=; b=qbPlwMtMO5h/PDQTD8omxj4fSd7e7PJsjjKJOHmg6R8Y6RwqvKQtLeDFdaUz7pKZH7 b97h1eWAK77yYBaSl8vDfywpavsYhldW93mZi8CqRdUlnjKyeLQ+fIOVrk/PF3KEVSgX TOoGLjsfn54mSJesiRUE07L8lhbBGwGbqjQsri2+AE56hIeM0W4KgWTQf3nbCvDt3BPG O3XK6HrtsOAhjoNfeO6aWc2YD7T2pzNIig11vNuREQeuVq1YW/CQiaHeNk8c3xbg+liW Ic61OcBVAgXD4+URBD3+Id0NMZr+1CKA4OG/rUlpbbMOCtafkqYdcgjRpmaxgFS6zo4v De1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=kGCFQktL9LEp0y8IboY5IhTEHaLuC/gj8xxem3T8C/Y=; b=YQ1mBc0q4dd8iUpcoERe8y7lH1GRzDWtWzFaZ2B4mek/P22Qxj+Ty892K7QSfpUJ4n /FvfVbk38mg6cWpa79kvcK+vuMIvZuykI/5tSAV6vhy85MbKy9cOSDpxjogeRpZQI0KE 6GRMEXLaY1xinxbvSyHZTndxJu64ysb/tIiLcQ0+FRouOSbn4R2Q8QKWOK2RnKVQf4QS oWsUj3WVjokhvlnyIw60vC2KQs0fAqL0LcGSeFhFsffjaQ0LGyQKCsjWXWZawxkS6jqL zXQtLqoLKcMJnhsAJSA576YbldlNu6lO0ViB8kkFIKfXZr1eBkPG42K2b3zUkvyif6MJ Rekw== X-Gm-Message-State: AJIora/MPO/SnlBjdqEsv39hmhpP/gP8KD9bK59WWjT9JIDE419VEEZ9 37E4FDs1rZ0V2I+UIT7NBK4pNwZCn6YJdI0qaWa0dyahN9M= X-Received: by 2002:a05:620a:f93:b0:6b5:c8ff:d2d8 with SMTP id b19-20020a05620a0f9300b006b5c8ffd2d8mr16640819qkn.386.1659473137334; Tue, 02 Aug 2022 13:45:37 -0700 (PDT) MIME-Version: 1.0 References: <0e910197bfbcf505122f6dae2ee9b90ff8ee31f7.1658189199.git.andreyknvl@google.com> In-Reply-To: From: Andrey Konovalov Date: Tue, 2 Aug 2022 22:45:26 +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 Thu, Jul 21, 2022 at 10:41 PM Andrey Konovalov wrote: > > 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! Hi Marco, I'm thinking of sending a v3. Does your "The rest looks fine now" comment refer only to this patch or to the whole series? If it's the former, could you PTAL at the other patches? Thanks!