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: <20091006114528.GV4452@nokia.com>
Date:	Tue, 6 Oct 2009 14:45:28 +0300
From:	Felipe Balbi <felipe.balbi@...ia.com>
To:	"Balbi Felipe (Nokia-D/Helsinki)" <felipe.balbi@...ia.com>
Cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	"alan@...rguk.ukuu.org.uk" <alan@...rguk.ukuu.org.uk>,
	"dbrownell@...rs.sourceforge.net" <dbrownell@...rs.sourceforge.net>
Subject: Re: TTY loosing bytes ?

On Tue, Oct 06, 2009 at 11:48:45AM +0200, Balbi Felipe (Nokia-D/Helsinki) wrote:
> Hi all,
> 
> I'm facing a weird issue with TTY when using u_serial gadget.
> 
> The problem seems to be related to ldisc's buffer getting full. Imagine
> a situation where you have 510 bytes available on N_TTY's buffer and you
> try to flush 512 bytes then the code path would look like:
> 
> --> flush_to_ldisc();
> 	--> n_tty_receive_buf(512 bytes);
> 		--> i = 510;
> 		--> memcpy(i);
> 
> 		--> i = 0;
> 		--> memcpy(i);
> 	<-- wake_up_interruptible();
> 
> What happens is that we loose those 2 extra bytes. I tried digging this
> problem and try to find a fix for it but it's been really complicated
> for me.
> 
> Hope you guys can help. Actually, I've been reproducing the problem on
> 2.6.28 but looking at the code current mainline should have the same
> problem. I also cherry-picked the relevant patches to my 2.6.28 tree
> (hope I got all of them) and it still failed.
> 
> Sorry I'm reporting such a problem with such an old kernel but upgrading
> the kernel right now is just impossible.
> 
> If you guys could give any pointers I would be really glad.

one more information/question:

why doesn't receive_buf() return the amount of bytes actually received ?
I see flush_to_ldisc() believes it can flush everything before even
calling receive_buf() then it will never act on the possibility of
receive_buf() not being able to receive the entire data.

Am I right ? Should receive_buf() return the amount of bytes actually
received ? Also, why isn't receive_room enough to be sure there's
enough space to really receive that block of data ?

-- 
balbi
--
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