mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-26 20:40:24 +09:00
ANDROID: tracing: Make automounting in debugfs optional
This patch creates a config that can be used to disable the automount of tracefs in the debugfs filesystem. Since the automount happens everytime the path /sys/kernel/debug/tracing is accessed, unmounting from userspace is ineffective against it. The config is intended to prevent new tracefs clients from depending on the automounted tracefs instance mounted at /sys/kernel/debug/tracing instead of the one at /sys/kernel/tracing. Since Android R launching devices and newer cannot mount debugfs in production builds, the config is intended to minimize the difference between user and userdebug builds w.r.t to tracefs and prevent regresssions. Bug: 184381659 Signed-off-by: Hridya Valsaraju <hridya@google.com> Change-Id: Ifda6df88081c8ecf23fcaf97790abc97525bca54
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
eacad94c98
commit
412bd71850
@@ -76,6 +76,9 @@ it::
|
||||
All files located in the tracefs file system will be located in that
|
||||
debugfs file system directory as well.
|
||||
|
||||
In order to not automount tracefs in the debugfs filesystem, enable the
|
||||
defconfig option CONFIG_TRACEFS_DISABLE_AUTOMOUNT.
|
||||
|
||||
.. attention::
|
||||
|
||||
Any selected ftrace option will also create the tracefs file system.
|
||||
|
||||
@@ -648,6 +648,7 @@ CONFIG_SCHEDSTATS=y
|
||||
# CONFIG_DEBUG_PREEMPT is not set
|
||||
CONFIG_BUG_ON_DATA_CORRUPTION=y
|
||||
CONFIG_TRACE_MMIO_ACCESS=y
|
||||
CONFIG_TRACEFS_DISABLE_AUTOMOUNT=y
|
||||
CONFIG_KUNIT=y
|
||||
CONFIG_KUNIT_DEBUGFS=y
|
||||
# CONFIG_RUNTIME_TESTING_MENU is not set
|
||||
|
||||
@@ -586,6 +586,7 @@ CONFIG_DETECT_HUNG_TASK=y
|
||||
CONFIG_WQ_WATCHDOG=y
|
||||
CONFIG_SCHEDSTATS=y
|
||||
CONFIG_BUG_ON_DATA_CORRUPTION=y
|
||||
CONFIG_TRACEFS_DISABLE_AUTOMOUNT=y
|
||||
CONFIG_UNWINDER_FRAME_POINTER=y
|
||||
CONFIG_KUNIT=y
|
||||
CONFIG_KUNIT_DEBUGFS=y
|
||||
|
||||
@@ -103,6 +103,11 @@ config PREEMPTIRQ_TRACEPOINTS
|
||||
Create preempt/irq toggle tracepoints if needed, so that other parts
|
||||
of the kernel can use them to generate or add hooks to them.
|
||||
|
||||
menuconfig TRACEFS_DISABLE_AUTOMOUNT
|
||||
bool "Do not autmount tracefs in the debugfs filesystem"
|
||||
help
|
||||
Provides an option to not automount tracefs in /sys/kernel/debug/tracing.
|
||||
|
||||
# All tracer options should select GENERIC_TRACER. For those options that are
|
||||
# enabled by all tracers (context switch and event tracer) they select TRACING.
|
||||
# This allows those options to appear when no other tracer is selected. But the
|
||||
|
||||
@@ -9010,6 +9010,7 @@ init_tracer_tracefs(struct trace_array *tr, struct dentry *d_tracer)
|
||||
ftrace_init_tracefs(tr, d_tracer);
|
||||
}
|
||||
|
||||
#ifndef CONFIG_TRACEFS_DISABLE_AUTOMOUNT
|
||||
static struct vfsmount *trace_automount(struct dentry *mntpt, void *ingore)
|
||||
{
|
||||
struct vfsmount *mnt;
|
||||
@@ -9031,6 +9032,7 @@ static struct vfsmount *trace_automount(struct dentry *mntpt, void *ingore)
|
||||
|
||||
return mnt;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* tracing_init_dentry - initialize top level trace array
|
||||
@@ -9055,6 +9057,7 @@ int tracing_init_dentry(void)
|
||||
if (WARN_ON(!tracefs_initialized()))
|
||||
return -ENODEV;
|
||||
|
||||
#ifndef CONFIG_TRACEFS_DISABLE_AUTOMOUNT
|
||||
/*
|
||||
* As there may still be users that expect the tracing
|
||||
* files to exist in debugfs/tracing, we must automount
|
||||
@@ -9063,6 +9066,9 @@ int tracing_init_dentry(void)
|
||||
*/
|
||||
tr->dir = debugfs_create_automount("tracing", NULL,
|
||||
trace_automount, NULL);
|
||||
#else
|
||||
tr->dir = ERR_PTR(-ENODEV);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user