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]
Message-ID: <20250511142237.GA2023217@ZenIV>
Date: Sun, 11 May 2025 15:22:37 +0100
From: Al Viro <viro@...iv.linux.org.uk>
To: WangYuli <wangyuli@...ontech.com>
Cc: brauner@...nel.org, jack@...e.cz, akpm@...ux-foundation.org,
	tglx@...utronix.de, jlayton@...nel.org, frederic@...nel.org,
	chenlinxuan@...ontech.com, xu.xin16@....com.cn,
	adrian.ratiu@...labora.com, lorenzo.stoakes@...cle.com,
	mingo@...nel.org, felix.moessbauer@...mens.com,
	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
	zhanjun@...ontech.com, niecheng1@...ontech.com,
	guanwentao@...ontech.com
Subject: Re: [PATCH] proc: Show the mountid associated with exe

On Sun, May 11, 2025 at 07:42:43PM +0800, WangYuli wrote:

> +static int proc_exe_mntid(struct seq_file *m, struct pid_namespace *ns,
> +			struct pid *pid, struct task_struct *task)
> +{
> +	struct file *exe_file;
> +	struct path exe_path;
> +
> +	exe_file = get_task_exe_file(task);
> +
> +	if (exe_file) {
> +		exe_path = exe_file->f_path;
> +		path_get(&exe_file->f_path);
> +
> +		seq_printf(m, "%i\n", real_mount(exe_path.mnt)->mnt_id);
> +
> +		path_put(&exe_file->f_path);

Excuse me, just what is that path_get/path_put for?  If you have
an opened file, you do have its ->f_path pinned and unchanging.
Otherwise this call of path_get() would've itself been unsafe...

And I still wonder about the rationale, TBH...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ