Package: mawk
Version: 1.3.3-11
Followup-For: Bug #387329

Calling ioctl(TCGETS) on random fds is characteristic of a program
that uses isatty() to determine whether fds are terminals or not; libc
implements this operation by trying TCGETS and seeing if it succeeds.
Here's a little program that demonstrates this:

#include <unistd.h>
#include <fcntl.h>

int
main(int argc, char **argv)
{
  int fd = open(argv[1], O_RDONLY);
  return isatty(fd);
}

$ gcc test.c
$ strace -e trace=ioctl ./a.out test.c
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xafb655c8) = -1 ENOTTY (Inappropriate 
ioctl for device)
Process 30712 detached

Note that fopen() uses isatty() internally to decide whether to buffer by
blocks or by lines, so the program may not be doing anything whatsoever
out of the ordinary.

This is something that should be dealt with in libc or in SELinux, not in
every program that uses isatty() or fopen().  I'd recommend dealing with
it in SELinux, just because you're going to have an uphill battle trying
to get libc to change (and there really is no better way to implement this,
and it has no security implications).

zw

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-2-686
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=UTF-8)

Versions of packages mawk depends on:
ii  libc6                        2.3.6.ds1-4 GNU C Library: Shared libraries

mawk recommends no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to