Re: [PATCH v2] alloc_tag: fix rw permission issue when handling boot parameter
From: Andrew Morton
Date: Wed Jan 14 2026 - 22:23:37 EST
On Thu, 15 Jan 2026 03:15:36 +0000 ranxiaokai627@xxxxxxx wrote:
> From: Ran Xiaokai <ran.xiaokai@xxxxxxxxxx>
>
> Boot parameters prefixed with "sysctl." are processed
> during the final stage of system initialization via kernel_init()->
> do_sysctl_args(). When CONFIG_MEM_ALLOC_PROFILING_DEBUG is enabled,
> the sysctl.vm.mem_profiling entry is not writable and will cause
> a warning.
This sounds strange. Why would setting a Kconfig debug thing disable
alteration of a runtime control?
Documentation/mm/allocation-profiling.rst provided no hint.
> Before run_init_process(), system initialization executes in kernel
> thread context. Use current->mm to distinguish sysctl writes during
> do_sysctl_args() from user-space triggered ones.
>
> And when the proc_handler is from do_sysctl_args(), always return success
> because the same value was already set by setup_early_mem_profiling()
> and this eliminates a permission denied warning.
>
> Suggested-by: Suren Baghdasaryan <surenb@xxxxxxxxxx>
> Acked-by: Suren Baghdasaryan <surenb@xxxxxxxxxx>
> Signed-off-by: Ran Xiaokai <ran.xiaokai@xxxxxxxxxx>
Should we backport it?