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: <Z47Ocx8ogqJGmGbC@grain>
Date: Tue, 21 Jan 2025 01:30:11 +0300
From: Cyrill Gorcunov <gorcunov@...il.com>
To: Thomas Weißschuh <linux@...ssschuh.net>
Cc: LKML <linux-kernel@...r.kernel.org>,
	Anna-Maria Behnsen <anna-maria@...utronix.de>,
	Frederic Weisbecker <frederic@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH] posix-clock: drop code duplication using compat_ptr_ioctl

On Mon, Jan 20, 2025 at 11:22:52PM +0100, Thomas Weißschuh wrote:
...
> > -#ifdef CONFIG_COMPAT
> > -	.compat_ioctl	= posix_clock_compat_ioctl,
> > -#endif
> > +	.compat_ioctl	= compat_ptr_ioctl,
> 
> This is not correct on s390. (It wasn't before either, though)
> The improved patch below is in my personal queue, but I didn't get
> around to actually testing and submitting it yet.

Hi, Thomas! Thanks for looking into the patch! I somehow miss why it won't
work 'cause compat_ptr_ioctl already does the same conversion as in your
code below, no? I miss something obvious?

```
long compat_ptr_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
	if (!file->f_op->unlocked_ioctl)
		return -ENOIOCTLCMD;

	return file->f_op->unlocked_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
}
EXPORT_SYMBOL(compat_ptr_ioctl);
```

> +#ifdef CONFIG_COMPAT
> +long ptp_compat_ioctl(struct posix_clock_context *pccontext, unsigned int cmd,
> +		      unsigned long arg)
> +{
> +	switch (cmd) {
> +	case PTP_ENABLE_PPS:
> +	case PTP_ENABLE_PPS2:
> +		/* These take in scalar arg, do not convert */
> +		break;
> +	default:
> +		arg = (unsigned long)compat_ptr(arg);

Here^^^

> +	}
> +
> +	return ptp_ioctl(pccontext, cmd, arg);
> +}
> +#endif

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ