[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220710114242.745d65b3@rorschach.local.home>
Date: Sun, 10 Jul 2022 11:42:42 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Tao Zhou <tao.zhou@...ux.dev>
Cc: Daniel Bristot de Oliveira <bristot@...nel.org>,
Wim Van Sebroeck <wim@...ux-watchdog.org>,
Guenter Roeck <linux@...ck-us.net>,
Jonathan Corbet <corbet@....net>,
Ingo Molnar <mingo@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Will Deacon <will@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Marco Elver <elver@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
"Paul E. McKenney" <paulmck@...nel.org>,
Shuah Khan <skhan@...uxfoundation.org>,
Gabriele Paoloni <gpaoloni@...hat.com>,
Juri Lelli <juri.lelli@...hat.com>,
Clark Williams <williams@...hat.com>,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-trace-devel@...r.kernel.org
Subject: Re: [PATCH V4 01/20] rv: Add Runtime Verification (RV) interface
On Sun, 10 Jul 2022 23:11:43 +0800
Tao Zhou <tao.zhou@...ux.dev> 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;
?
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;
> +}
Powered by blists - more mailing lists