lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1569023966-23004-1-git-send-email-divya.indi@oracle.com>
Date:   Fri, 20 Sep 2019 16:59:25 -0700
From:   Divya Indi <divya.indi@...cle.com>
To:     Steven Rostedt <rostedt@...dmis.org>, linux-kernel@...r.kernel.org
Cc:     Divya Indi <divya.indi@...cle.com>, Joe Jin <joe.jin@...cle.com>,
        Srinivas Eeda <srinivas.eeda@...cle.com>,
        Aruna Ramakrishna <aruna.ramakrishna@...cle.com>,
        Manjunath Patil <manjunath.b.patil@...cle.com>
Subject: [RFC]Sample module for Kernel access to Ftrace instances.

[PATCH] tracing: Sample module to demonstrate kernel access to Ftrace

Hi,

This patch is for a sample module to demonstrate the use of APIs that 
were introduced/exported in order to access Ftrace instances from within the kernel.

Please Note: This module is dependent on -
- commit: f45d122 tracing: Kernel access to Ftrace instances
- Patches pending review: https://lore.kernel.org/lkml/1565805327-579-1-git-send-email-divya.indi@oracle.com/

The sample module creates/lookup a trace array called sample-instance on module load time. 
We then start a kernel thread(simple-thread) to -
1) Enable tracing for event "sample_event" to buffer associated with the trace array - "sample-instance".
2) Start a timer that will disable tracing to this buffer after 5 sec. (Tracing disabled after 5 sec ie at count=4)
3) Write to the buffer using trace_array_printk()
4) Stop the kernel thread and destroy the buffer during module unload.

A sample output for the same -

# tracer: nop
#
# entries-in-buffer/entries-written: 16/16   #P:4
#
#                              _-----=> irqs-off
#                             / _----=> need-resched
#                            | / _---=> hardirq/softirq
#                            || / _--=> preempt-depth
#                            ||| /     delay
#           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
#              | |       |   ||||       |         |
 sample-instance-26797 [003] .... 955180.489833: simple_thread: trace_array_printk: count=0
 sample-instance-26797 [003] .... 955180.489836: sample_event: count value=0 at jiffies=5249940864
 sample-instance-26797 [003] .... 955181.513722: simple_thread: trace_array_printk: count=1
 sample-instance-26797 [003] .... 955181.513724: sample_event: count value=1 at jiffies=5249941888
 sample-instance-26797 [003] .... 955182.537629: simple_thread: trace_array_printk: count=2
 sample-instance-26797 [003] .... 955182.537631: sample_event: count value=2 at jiffies=5249942912
 sample-instance-26797 [003] .... 955183.561516: simple_thread: trace_array_printk: count=3
 sample-instance-26797 [003] .... 955183.561518: sample_event: count value=3 at jiffies=5249943936
 sample-instance-26797 [003] .... 955184.585423: simple_thread: trace_array_printk: count=4
 sample-instance-26797 [003] .... 955184.585427: sample_event: count value=4 at jiffies=5249944960
 sample-instance-26797 [003] .... 955185.609344: simple_thread: trace_array_printk: count=5
 sample-instance-26797 [003] .... 955186.633241: simple_thread: trace_array_printk: count=6
 sample-instance-26797 [003] .... 955187.657157: simple_thread: trace_array_printk: count=7
 sample-instance-26797 [003] .... 955188.681039: simple_thread: trace_array_printk: count=8
 sample-instance-26797 [003] .... 955189.704937: simple_thread: trace_array_printk: count=9
 sample-instance-26797 [003] .... 955190.728840: simple_thread: trace_array_printk: count=10

Let me know if you have any questions.

Thanks,
Divya

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ