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: <506491C1.7060807@suse.cz>
Date:	Thu, 27 Sep 2012 19:49:53 +0200
From:	Jiri Slaby <jslaby@...e.cz>
To:	Cyrill Gorcunov <gorcunov@...nvz.org>
CC:	linux-kernel@...r.kernel.org, alan@...rguk.ukuu.org.uk,
	hpa@...or.com, gregkh@...uxfoundation.org, xemul@...allels.com
Subject: Re: [patch 2/2] tty: Add get- ioctls to fetch tty status v2

On 09/27/2012 07:00 PM, Cyrill Gorcunov wrote:
> @@ -199,6 +207,25 @@ static int pty_set_pktmode(struct tty_st
>  	return 0;
>  }
>  
> +/* Get the packet mode of a pty */
> +static int pty_get_pktmode(struct tty_struct *tty, int __user *arg)
> +{
> +	unsigned long flags;
> +	int pktmode;
> +
> +	if (tty->driver->subtype != PTY_TYPE_MASTER)
> +		return -ENOTTY;

The same as for 1/2^UFixed in v3 ;).

> +	spin_lock_irqsave(&tty->ctrl_lock, flags);

I believe the lock is not the right one. It protects ctrl_status in
TIOCPKT, not the packet. And it very seems that packet is unprotected at
all over the code => the lock does not improve anything and is redundant.

> +	pktmode = tty->packet;
> +	spin_unlock_irqrestore(&tty->ctrl_lock, flags);
> +
> +	if (put_user(pktmode, arg))
> +		return -EFAULT;
> +
> +	return 0;

This can be just
  return put_user(pktmode, arg);
Right?

> +}
> +
...
> --- tty.git.orig/include/asm-generic/ioctls.h
> +++ tty.git/include/asm-generic/ioctls.h
> @@ -74,6 +74,9 @@
>  #define TCSETXW		0x5435
>  #define TIOCSIG		_IOW('T', 0x36, int)  /* pty: generate signal */
>  #define TIOCVHANGUP	0x5437
> +#define TIOCGPKT	_IOR('T', 0x38, int) /* Get packet mode state */
> +#define TIOCGPTLCK	_IOR('T', 0x39, int) /* Get Pty lock state */
> +#define TIOCGEXCL	_IOR('T', 0x40, int) /* Get exclusive mode state */

This is not enough. Some arches do not include this file in their
ioctls.h. You need to update them all.

thanks,
-- 
js
suse labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ