From: Gabriele Monaco <gmonaco@redhat.com>
To: Nam Cao <namcao@linutronix.de>,
Steven Rostedt <rostedt@goodmis.org>,
linux-trace-kernel@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: john.ogness@linutronix.de
Subject: Re: [PATCH v3 13/22] rv: Add support for LTL monitors
Date: Wed, 16 Apr 2025 16:29:53 +0200 [thread overview]
Message-ID: <a85dcc1c6b493838abdc8716ae35fe4ad734db2b.camel@redhat.com> (raw)
In-Reply-To: <19f424c910bfa0f4854117e3f8771aeb6e98a9d2.1744785335.git.namcao@linutronix.de>
On Wed, 2025-04-16 at 08:51 +0200, Nam Cao wrote:
> diff --git a/Documentation/trace/rv/linear_temporal_logic.rst
> b/Documentation/trace/rv/linear_temporal_logic.rst
> new file mode 100644
> index 000000000000..232f9700cbaa
> --- /dev/null
> +++ b/Documentation/trace/rv/linear_temporal_logic.rst
> @@ -0,0 +1,119 @@
> +Introduction
> +============
> +
Just noticed you misplaced the sections in this file, it should be like:
Linear Temporal Logic
=====================
Introduction
------------
[...]
Grammar
-------
[...]
Example linear temporal logic
-----------------------------
[...]
E.g. use === only for the page's title (which is missing) and --- for
the sections, otherwise you get it oddly integrated in the index.
Thanks,
Gabriele
> +Runtime verification monitor is a verification technique which
> checks that the kernel follows a
> +specification. It does so by using tracepoints to monitor the
> kernel's execution trace, and
> +verifying that the execution trace sastifies the specification.
> +
> +Initially, the specification can only be written in the form of
> deterministic automaton (DA).
> +However, while attempting to implement DA monitors for some complex
> specifications, deterministic
> +automaton is found to be inappropriate as the specification
> language. The automaton is complicated,
> +hard to understand, and error-prone.
> +
> +Thus, RV monitors based on linear temporal logic (LTL) are
> introduced. This type of monitor uses LTL
> +as specification instead of DA. For some cases, writing the
> specification as LTL is more concise and
> +intuitive.
> +
> +Many materials explain LTL in details. One book is::
> +
> + Christel Baier aund Joost-Pieter Katoen: Principles of Model
> Checking, The MIT Press, 2008.
> +
> +Grammar
> +========
> +
> +Unlike some existing syntax, kernel's implementation of LTL is more
> verbose. This is motivated by
> +considering that the people who read the LTL specifications may not
> be well-versed in LTL.
> +
> +Grammar:
> + ltl ::= opd | ( ltl ) | ltl binop ltl | unop ltl
> +
> +Operands (opd):
> + true, false, user-defined names consisting of upper-case
> characters, digits, and underscore.
> +
> +Unary Operators (unop):
> + always
> + eventually
> + not
> +
> +Binary Operators (binop):
> + until
> + and
> + or
> + imply
> + equivalent
> +
> +This grammar is ambiguous: operator precedence is not defined.
> Parentheses must be used.
> +
> +Example linear temporal logic
> +=============================
> +.. code-block::
> +
> + RAIN imply (GO_OUTSIDE imply HAVE_UMBRELLA)
> +
> +means: if it is raining, going outside means having an umbrella.
> +
> +.. code-block::
> +
> + RAIN imply (WET until not RAIN)
> +
> +means: if it is raining, it is going to be wet until the rain stops.
> +
> +.. code-block::
> +
> + RAIN imply eventually not RAIN
> +
> +means: if it is raining, rain will eventually stop.
> +
> +The above examples are referring to the current time instance only.
> For kernel verification, the
> +`always` operator is usually desirable, to specify that something is
> always true at the present and
> +for all future. For example::
> +
> + always (RAIN imply eventually not RAIN)
> +
> +means: *all* rain eventually stops.
> +
> +In the above examples, `RAIN`, `GO_OUTSIDE`, `HAVE_UMBRELLA` and
> `WET` are the "atomic
> +propositions".
> +
> +Monitor synthesis
> +=================
> +
> +To synthesize an LTL into a kernel monitor, the `rvgen` tool can be
> used:
> +`tools/verification/rvgen`. The specification needs to be provided
> as a file, and it must have a
> +"RULE = LTL" assignment. For example::
> +
> + RULE = always (ACQUIRE imply ((not KILLED and not CRASHED) until
> RELEASE))
> +
> +which says: if `ACQUIRE`, then `RELEASE` must happen before `KILLED`
> or `CRASHED`.
> +
> +The LTL can be broken down using sub-expressions. The above is
> equivalent to:
> +
> + .. code-block::
> +
> + RULE = always (ACQUIRE imply (ALIVE until RELEASE))
> + ALIVE = not KILLED and not CRASHED
> +
> +From this specification, `rvgen` generates the C implementation of a
> Buchi automaton - a
> +non-deterministic state machine which checks the satisfiability of
> the LTL. See
> +Documentation/trace/rv/monitor_synthesis.rst for details on using
> `rvgen`.
> +
> +References
> +==========
> +
> +One book covering model checking and linear temporal logic is::
> +
> + Christel Baier aund Joost-Pieter Katoen: Principles of Model
> Checking, The MIT Press, 2008.
> +
> +For an example of using linear temporal logic in software testing,
> see::
> +
> + Ruijie Meng, Zhen Dong, Jialin Li, Ivan Beschastnikh, and Abhik
> Roychoudhury. 2022. Linear-time
> + temporal logic guided greybox fuzzing. In Proceedings of the 44th
> International Conference on
> + Software Engineering (ICSE '22). Association for Computing
> Machinery, New York, NY, USA,
> + 1343–1355. https://doi.org/10.1145/3510003.3510082
> +
> +The kernel's LTL monitor implementation is based on::
> +
> + Gerth, R., Peled, D., Vardi, M.Y., Wolper, P. (1996). Simple On-
> the-fly Automatic Verification of
> + Linear Temporal Logic. In: Dembiński, P., Średniawa, M. (eds)
> Protocol Specification, Testing and
> + Verification XV. PSTV 1995. IFIP Advances in Information and
> Communication Technology. Springer,
> + Boston, MA. https://doi.org/10.1007/978-0-387-34892-6_1
next prev parent reply other threads:[~2025-04-16 14:31 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-16 6:51 [PATCH v3 00/22] RV: Linear temporal logic monitors for RT application Nam Cao
2025-04-16 6:51 ` Nam Cao
2025-04-16 6:51 ` [PATCH v3 01/22] rv: Add #undef TRACE_INCLUDE_FILE Nam Cao
2025-04-16 6:51 ` [PATCH v3 02/22] printk: Make vprintk_deferred() public Nam Cao
2025-04-16 6:51 ` [PATCH v3 03/22] panic: Add vpanic() Nam Cao
2025-04-16 6:51 ` [PATCH v3 04/22] rv: Let the reactors take care of buffers Nam Cao
2025-04-16 6:51 ` [PATCH v3 05/22] verification/dot2k: Make a separate dot2k_templates/Kconfig_container Nam Cao
2025-04-16 6:51 ` [PATCH v3 06/22] verification/dot2k: Remove __buff_to_string() Nam Cao
2025-04-16 6:51 ` [PATCH v3 07/22] verification/dot2k: Replace is_container() hack with subparsers Nam Cao
2025-04-16 6:51 ` [PATCH v3 08/22] rv: rename CONFIG_DA_MON_EVENTS to CONFIG_RV_MON_EVENTS Nam Cao
2025-04-16 6:51 ` [PATCH v3 09/22] verification/dot2k: Prepare the frontend for LTL inclusion Nam Cao
2025-04-16 13:21 ` Gabriele Monaco
2025-04-16 6:51 ` [PATCH v3 10/22] Documentation/rv: Prepare monitor synthesis document " Nam Cao
2025-04-16 6:51 ` [PATCH v3 11/22] verification/rvgen: Restructure the templates files Nam Cao
2025-04-16 6:51 ` [PATCH v3 12/22] verification/rvgen: Restructure the classes to prepare for LTL inclusion Nam Cao
2025-04-16 6:51 ` [PATCH v3 13/22] rv: Add support for LTL monitors Nam Cao
2025-04-16 9:34 ` Gabriele Monaco
2025-04-16 11:56 ` Nam Cao
2025-04-16 13:05 ` Gabriele Monaco
2025-04-16 14:13 ` Gabriele Monaco
2025-04-16 14:15 ` Nam Cao
2025-04-16 14:29 ` Gabriele Monaco [this message]
2025-04-16 6:51 ` [PATCH v3 14/22] rv: Add rtapp container monitor Nam Cao
2025-04-16 7:32 ` Gabriele Monaco
2025-04-17 5:42 ` Nam Cao
2025-04-16 6:51 ` [PATCH v3 15/22] x86/tracing: Remove redundant trace_pagefault_key Nam Cao
2025-04-16 6:51 ` [PATCH v3 16/22] x86/tracing: Move page fault trace points to generic Nam Cao
2025-04-16 6:51 ` [PATCH v3 17/22] arm64: mm: Add page fault trace points Nam Cao
2025-04-16 6:51 ` [PATCH v3 18/22] riscv: " Nam Cao
2025-04-16 6:51 ` Nam Cao
2025-04-16 6:51 ` [PATCH v3 19/22] rv: Add rtapp_pagefault monitor Nam Cao
2025-04-16 6:51 ` [PATCH v3 20/22] rv: Add rtapp_sleep monitor Nam Cao
2025-04-16 6:51 ` [PATCH v3 21/22] rv: Add documentation for rtapp monitor Nam Cao
2025-04-16 8:56 ` Gabriele Monaco
2025-04-16 6:51 ` [PATCH v3 22/22] rv: Allow to configure the number of per-task monitor Nam Cao
2025-08-10 21:12 ` [PATCH v3 00/22] RV: Linear temporal logic monitors for RT application patchwork-bot+linux-riscv
2025-08-10 21:12 ` patchwork-bot+linux-riscv
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a85dcc1c6b493838abdc8716ae35fe4ad734db2b.camel@redhat.com \
--to=gmonaco@redhat.com \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=namcao@linutronix.de \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.