Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2804030imw; Sun, 10 Jul 2022 16:00:22 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u3afA6cnGS4Hy94FMjX23PI7CRjLNCM1gKfZO3r545+7CON34BQtesxzWhLDG1I5MBRwE7 X-Received: by 2002:a17:90b:3e84:b0:1f0:3f92:8c91 with SMTP id rj4-20020a17090b3e8400b001f03f928c91mr1622082pjb.112.1657494022013; Sun, 10 Jul 2022 16:00:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657494022; cv=none; d=google.com; s=arc-20160816; b=bv1xnnFm/CFaRFQIYsll2rq8UJBOOTJ+ZJL87YNPf/fYSR6CjNLTv48GdI78ORdpWt IZlMI7m4mAMEy2Rv0Ck22K8IpU3AYj1q/loGpLeqKeu+rTdKuMNZ/5I086i77X9zdwUt yd5YSSmguZbmb66DbPC7gXnX5QYuG43u8e8uke9o28iwyF7C0/hySkHbhspLUqWY4nkY Sxgr6tlGoxXNb2S36V9VZ/EFzPoTt8Mu8fKf1VKm0OLN/bWZMBTvAoKhnjJtLzo43k8a 0m8FnxPHZwJ+AdifWNyeKZcTSgxLaHgKv4wAQQd29HndVj1eEePM6drvLiWx6C9UNJKx XaqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=ZUFb5ucO1JJlddQkXqD+0kfsu3ItWuXMmHu5j+INC1Q=; b=U9G79t8iR+89ECgvlHXUVYXjonojYSf80kgmz5Xjy0Cnx7egVzwwzXE6zGbfZd+IVu nqhi4YVX5wziR8GWZyUOzJkjpW79wXazIpTIh7LqZJRyoUNrzaEiJA5QlWKYeNmDvJ6Y ff3jWvupLf0XjBxX1R4Kz7c5YPNZCI7riAoEXpmbLCFq8eKNvzrS/JrIqMJq65sGR2Ko 8WdO21HVPewNE1ILKC3gd17z8yMVHrPOeIj6VJBqc3I+luK3r5c+egnay0z9hx5smbmC iIedq4/XTV3q3Da98ZJxWwEOEfHxJ5kMAbOsAGqfy0culd1uekye9w0578+/i9hMKBOr ZmvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=laM9f48V; 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=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t125-20020a637883000000b004157aa87086si8538812pgc.857.2022.07.10.15.59.46; Sun, 10 Jul 2022 16:00:22 -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=@linux.dev header.s=key1 header.b=laM9f48V; 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=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229523AbiGJW1n (ORCPT + 99 others); Sun, 10 Jul 2022 18:27:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbiGJW1m (ORCPT ); Sun, 10 Jul 2022 18:27:42 -0400 Received: from out2.migadu.com (out2.migadu.com [188.165.223.204]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2771EA1B4; Sun, 10 Jul 2022 15:27:41 -0700 (PDT) Date: Mon, 11 Jul 2022 06:28:46 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1657492059; 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: in-reply-to:in-reply-to:references:references; bh=ZUFb5ucO1JJlddQkXqD+0kfsu3ItWuXMmHu5j+INC1Q=; b=laM9f48VefRkClFbhgfpIKhMHyWQu0k9ZxfIiwuQBKg701eA/tlpKG1C384CQnjzpiq1NE Rihkx2xXv2f5yzuri9JIArQ+ZlWPw6dPqYgI28M6ql98Fese0NFMBRgAkJUnBTtVyG6sqB rv33k2eZCqLAh34wY9FMIy2AldR15iU= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Tao Zhou To: Steven Rostedt Cc: Daniel Bristot de Oliveira , Wim Van Sebroeck , Guenter Roeck , Jonathan Corbet , Ingo Molnar , Thomas Gleixner , Peter Zijlstra , Will Deacon , Catalin Marinas , Marco Elver , Dmitry Vyukov , "Paul E. McKenney" , Shuah Khan , Gabriele Paoloni , Juri Lelli , Clark Williams , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-devel@vger.kernel.org, Tao Zhou Subject: Re: [PATCH V4 01/20] rv: Add Runtime Verification (RV) interface Message-ID: References: <60548902dbccaa7ba420e40e46835693e27f643f.1655368610.git.bristot@kernel.org> <20220710114242.745d65b3@rorschach.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220710114242.745d65b3@rorschach.local.home> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,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 Sun, Jul 10, 2022 at 11:42:42AM -0400, Steven Rostedt wrote: > On Sun, 10 Jul 2022 23:11:43 +0800 > Tao Zhou wrote: > > > The @*pos of enable_monitors_start() can not be -1 or other negative value. > > And I checked that the *pos is 0(right?). That is safe. Sorry for not being > > that ture and maybe this is a notice here. Because if it is a negative value, > > the returned m_def is a point to a data place 16 bytes before &rv_monitors_list. > > That is a not ture rv_monitors_list stucture data. But it is not possiable now. > > Maybe "inspired" from your question. Look it more, I image this simulation. > > If the monitor(and all is enabled) is more enough to let the *pos to increase > > to -1. And the returned m_def is last monitor that returned from enable_monitors_start(). > > The enable_monitors_next() check from the last monitor and return NULL. > > Only show the last monitor. This will not really happen I think. > > But I am not focus enough to the seq file code or others now, so this may be > > more possible to be not right. Late reply continued from me.. > > > So basically you are saying we should have: > > > +static void *enabled_monitors_start(struct seq_file *m, loff_t *pos) > > +{ > > + struct rv_monitor_def *m_def; > > + loff_t l; > > + > > + mutex_lock(&rv_interface_lock); > > if (list_empty(&rv_monitors_list->list)) > return NULL; > ? From the function itself, this looks safer. Thanks. > Probably safer to have that. > > -- Steve > > > > + m_def = list_entry(&rv_monitors_list, struct rv_monitor_def, list); > > + > > + for (l = 0; l <= *pos; ) { > > + m_def = enabled_monitors_next(m, m_def, &l); > > + if (!m_def) > > + break; > > + } > > + > > + return m_def; > > +}