🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.4bsd
Article #1201

some unportable code in 4.3bsd tty driver

#1201
From: Ian Donaldson
Date: Wed, 21 Sep 1988 17:38
37 lines
1585 bytes
Files:
	/usr/src/sys/sys/tty.c

O/S: 4.3bsd (vax release, but probably all)

Priority: low (unless of course it affects -you-)

Description:
	The 4.3bsd tty driver contains some code that assumes that
	a structure is contained within another structure, but there
	are no physical bindings between the two structures.

	ie: the code that handles the 4 ioctls:  TIOCGETC, TIOCSETC,
	TIOCGLTC, TIOCSLTC assume that the structure that they copy
	in or out (ie: struct tchars or struct ltchars) aligns exactly
	with a component of struct ttychars (ie: t_intrc or t_suspc,
	respectively).

	Whilst this probably will work on most byte addressable
	machines, it is clearly unportable and a dangerous practise.

Implications:
	somebody changes struct ttychars without knowing what
	the kernel expects of the order/adjacency of components
	and the kernel may fall over

Fix:
	Easy. Copy each component to/from user space using individual
	assignments rather than a single bcopy().

	Either that, or make struct ttychars consist of struct tchars
	and struct ltchars plus other goodies.

	(well I would do the former, since all these extra structs
	are really pointless and should be chucked out of the kernel anyway)

Ian Donaldson
Technical Details
Message-ID: <871@yabbie.rmit.oz>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!attcan!uunet!munnari!bruce!goanna!yabbie!rcodi

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!attcan!uunet!munnari!bruce!goanna!yabbie!rcodi
From: rcodi@yabbie.rmit.oz (Ian Donaldson)
Newsgroups: comp.bugs.4bsd
Subject: some unportable code in 4.3bsd tty driver
Message-ID: <871@yabbie.rmit.oz>
Date: 21 Sep 88 17:38:09 GMT
Organization: RMIT Comm & Elec Eng, Melbourne, Australia.
Lines: 37