Subject: NetBSD Security Advisory 1998-003
To: None <current-users@NetBSD.ORG, netbsd-announce@NetBSD.ORG>
From: matthew green <firstname.lastname@example.org>
Date: 05/10/1998 22:33:54
-----BEGIN PGP SIGNED MESSAGE-----
NetBSD Security Advisory 1998-003
Topic: mmap(2) of append-only files may result in corrupted data.
Version: NetBSD 1.3.1 and prior.
Severity: Possible data corruption.
Files that have the append-only flag set are erroneously allowed to
be memory mapped shared, causing other processes to see changes made
to the file. While the on-disk copy is not updated, any other process
using memory mapping will see this change, causing data corruption.
4.4BSD added several new concepts to the system security, including a
system `securelevel', and the ability to mark FFS files as append-only
or immutable. These flags are settable at any time, but can only be
removed when the securelevel is zero, or less. The securelevel of a
running system can only be lowered by the /sbin/init process, which
typically only does this when entering single user mode. This ensures
that the even the super-user can not tamper with the file flags.
Due to a bug in the mmap(2) system call, files that are marked
append-only, may be opened with append, read and write flags, as normal
for append-only files, and then mmap(2)'ed shared with write protection.
When the data mapped is changed, other processes that use mmap(2) on
this file will also see the changes, defeating the purpose of the
append-only flag. The actual on-disk copy of the file is not updated.
Solutions and Workarounds
NetBSD has changed the mmap(2) system call to fail when creating a shared,
writable file mapping if the file is marked immutable or append-only.
A patch has been made available for NetBSD 1.3 and 1.3.1, and can be
found on the NetBSD FTP server:
Thanks to Darren Reed <email@example.com>, Luke Mewburn
<firstname.lastname@example.org>, Charles Hannum <email@example.com>, Chris Demetriou
<firstname.lastname@example.org> and Matthew Green <email@example.com> for finding
this problem and/or providing input towards fixing the problem.
Information about NetBSD and NetBSD security can be found at
http://www.NetBSD.ORG/ and http://www.NetBSD.ORG/Security/.
Copyright 1998, The NetBSD Foundation. All Rights Reserved.
-----BEGIN PGP SIGNATURE-----
-----END PGP SIGNATURE-----