FreeBSD Security Advisory FreeBSD-SA-02:37.kqueue

From: FreeBSD Security Advisories (security-advisories@freebsd.org)
Date: 08/06/02


Date: Mon, 5 Aug 2002 16:52:02 -0700 (PDT)
From: FreeBSD Security Advisories <security-advisories@freebsd.org>
To: Bugtraq <bugtraq@securityfocus.com>


-----BEGIN PGP SIGNED MESSAGE-----

=============================================================================
FreeBSD-SA-02:37.kqueue Security Advisory
                                                          The FreeBSD Project

Topic: local users can panic the system using the kqueue mechanism

Category: core
Module: kqueue
Announced: 2002-08-05
Credits: Mark Delany <markd@bushwire.net>
Affects: FreeBSD 4.3-RELEASE
                FreeBSD 4.4-RELEASE
                FreeBSD 4.5-RELEASE
                FreeBSD 4.6-RELEASE
                FreeBSD 4.6-STABLE prior to the correction date
Corrected: 2002-08-05 15:05:15 (RELENG_4)
                2002-08-05 15:13:48 (RELENG_4_6)
                2002-08-05 15:13:44 (RELENG_4_5)
                2002-08-05 15:13:40 (RELENG_4_4)
FreeBSD only: YES

I. Background

The kqueue mechanism allows a process to register interest in
particular events on particular file descriptors, and receive
asynchronous notification when these events occur on the selected
descriptors.

II. Problem Description

If a pipe was created with the pipe(2) system call, and one end of the
pipe was closed, registering an EVFILT_WRITE filter on the other end
would cause a kernel panic.

A common scenario in which this could occur is when a process uses a
pipe to communicate with a child and uses kqueue to monitor the pipe,
and the child dies shortly after the fork(2) call, before the parent
has had time to register the filter.

III. Impact

A local attacker may cause the system to panic by executing their own
malicious application.

IV. Workaround

There is no known workaround.

V. Solution

The following patch has been verified to apply to FreeBSD 4.4, 4.5, and
4.6 systems.

a) Download the relevant patch from the location below, and verify the
detached PGP signature using your PGP utility.

# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:37/kqueue.patch
# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:37/kqueue.patch.asc

b) Apply the patch.

# cd /usr/src
# patch < /path/to/patch

c) Recompile your kernel as described in
<URL:http://www.freebsd.org/handbook/kernelconfig.html> and reboot the
system.

VI. Correction details

The following list contains the revision numbers of each file that was
corrected in FreeBSD.

Path Revision
  Branch
- -------------------------------------------------------------------------
sys/kern/sys_pipe.c
  RELENG_4 1.60.2.13
  RELENG_4_6 1.60.2.12.2.1
  RELENG_4_5 1.60.2.11.2.1
  RELENG_4_4 1.60.2.10.2.1
- -------------------------------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)

iQCVAwUBPU8OFlUuHi5z0oilAQFTugP/S+2u/BK8Oz53oFTcTY84ReNRJZMEJ8dX
PVHMWZ7xl4stYoeo8iX+moq+R2riZqEfzT+lx1lYZBkYkkmIwGxI+6qJgBqkPriL
acswOhfdzLSgwIoXNJsGdO9vlYwsNqiRsf5Yay+gKDqRUxCPA27X528uc1jhtAdd
UzagA6Lhrk8=
=uTZC
-----END PGP SIGNATURE-----



Relevant Pages

  • FreeBSD Security Advisory FreeBSD-SA-02:37.kqueue
    ... particular events on particular file descriptors, ... If a pipe was created with the pipesystem call, ... has had time to register the filter. ... Download the relevant patch from the location below, ...
    (FreeBSD-Security)
  • Re: PATCH: fd leak if pipe() is called with an invalid address.
    ... the file descriptors opened by pipe() call ... This patch is not correctly made... ... There's no point in the kernel trying to clean up, ...
    (Linux-Kernel)
  • Re: PATCH: fd leak if pipe() is called with an invalid address.
    ... the file descriptors opened by pipe() call ... This patch is not correctly made... ... Probably this is the reason why Linus still doesn't merge it. ...
    (Linux-Kernel)
  • Re: [PATCH 2.6.19.2] r8169: support RTL8169SC/8110SC
    ... If I correctly read the patch, it should go along the 0x98000000 ... The current driver is intended to handle the whole set of PCI IDs ... Can you provide a more descriptive name for this register? ... does this new field bring something that struct net_device.dev_addr ...
    (Linux-Kernel)
  • Re: [PATCH/RFC] hwmon: Add support for W83667HG-B
    ... preliminary patch, and then your patch adding support for the ... to fix to be included into your W83667HG-B support patch. ... turns out the 0xff register values are not a problem. ... expected that the driver exposes only 3 pwm outputs for this chip. ...
    (Linux-Kernel)