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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 25 Mar 2019 22:21:05 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Yafang Shao <laoar.shao@...il.com>
Cc:     mingo@...hat.com, peterz@...radead.org, paulmck@...ux.vnet.ibm.com,
        josh@...htriplett.org, mathieu.desnoyers@...icios.com,
        jiangshanlai@...il.com, joel@...lfernandes.org,
        shaoyafang@...iglobal.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] sched/fair: do not expose some tracepoints to user
 if CONFIG_SCHEDSTATS is not set

On Tue, 26 Mar 2019 09:40:06 +0800
Yafang Shao <laoar.shao@...il.com> wrote:

> The tracepoints trace_sched_stat_{iowait, blocked, wait, sleep} should
> be not exposed to user if CONFIG_SCHEDSTATS is not set.
> 
> Signed-off-by: Yafang Shao <laoar.shao@...il.com>
> ---
>  include/trace/events/sched.h | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
> index 9a4bdfa..4686c7f 100644
> --- a/include/trace/events/sched.h
> +++ b/include/trace/events/sched.h
> @@ -336,6 +336,7 @@ static inline long __trace_sched_switch_state(bool preempt, struct task_struct *
>  		  __entry->pid, __entry->old_pid)
>  );
>  
> +#ifdef CONFIG_SCHEDSTATS

Instead of doing this #ifdef here, perhaps we should have at the top of the file:

#ifdef CONFIG_SCHEDSTATS
# define TRACE_EVENT_SCHEDSTAT TRACE_EVENT
#else
# define TRACE_EVENT_SCHEDSTAT TRACE_EVENT_NOP
#endif

And then switch the sched stat tracepoints from TRACE_EVENT to
use TRACE_EVENT_SCHEDSTAT.

And if my magic macro hat is working while sitting on the shelf (don't
have time to put it on), then the TRACE_EVENT_SCHEDSTAT will work like
a TRACE_EVENT when enabled, and a TRACE_EVENT_NOP when not.

Can you give that a try?

If this works, you don't need to duplicate all the parameters again.

-- Steve

>  /*
>   * XXX the below sched_stat tracepoints only apply to
> SCHED_OTHER/BATCH/IDLE
>   *     adding sched_stat support to SCHED_FIFO/RR would be welcome.
> @@ -395,6 +396,19 @@ static inline long
> __trace_sched_switch_state(bool preempt, struct task_struct *
> TP_PROTO(struct task_struct *tsk, u64 delay), TP_ARGS(tsk, delay));
>  
> +#else /* CONFIG_SCHEDSTATS */
> +
> +TRACE_EVENT_NONE(sched_stat_wait,
> +		 TP_PROTO(struct task_struct *tsk, u64 delay));
> +TRACE_EVENT_NONE(sched_stat_sleep,
> +		 TP_PROTO(struct task_struct *tsk, u64 delay));
> +TRACE_EVENT_NONE(sched_stat_iowait,
> +		 TP_PROTO(struct task_struct *tsk, u64 delay));
> +TRACE_EVENT_NONE(sched_stat_blocked,
> +		 TP_PROTO(struct task_struct *tsk, u64 delay));
> +
> +#endif /* CONFIG_SCHEDSTATS */
> +
>  /*
>   * Tracepoint for accounting runtime (time the task is executing
>   * on a CPU).

Powered by blists - more mailing lists