Alan Stern [Thu, 22 Apr 2004 06:03:22 +0000 (23:03 -0700)]
[PATCH] USB: Important bugfix for UHCI list management code
A major bug in the UHCI driver turned up recently. Thanks to a lot of
help from Simone Gotti it was identified and fixed late last week. It
turned out to be entirely my fault -- a previous patch had introduced two
(!) errors. (A combination of carelessness and a nasty thinko, and
somehow it passed the regression tests...)
Anyway, it's entirely possible that many of the problems people have been
seeing are caused by that bug. This patch is the solution.
Dave Jones [Wed, 21 Apr 2004 20:49:59 +0000 (21:49 +0100)]
[CPUFREQ] Fix security hole in proc handler.
Brad Spengler <spender@grsecurity.net> found an exploitable bug in the proc handler
of cpufreq, where a user-supplied unsigned int is cast to a signed int and then
passed on to copy_[to|from]_user() allowing arbitary amounts of memory to be written
(root only thankfully), or read (as any user).
The Common Vulnerabilities and Exposures project (cve.mitre.org) has assigned
the name CAN-2004-0228 to this issue.
Dave Jones [Wed, 21 Apr 2004 20:18:57 +0000 (21:18 +0100)]
[CPUFREQ] Make an educated guess at the current P-state in the ACPI driver.
One big limitation of the ACPI specification is that it's impossible to
detect the current P-State by reading from ACPI-defined registers. And the
CPU isn't always at P0 when the system boots. So, try to "guess" the current
P-State by analyzing cpu_khz.
Dave Jones [Wed, 21 Apr 2004 18:58:29 +0000 (19:58 +0100)]
[CPUFREQ] Remove redundant part of powernow-k7 module parm
If used as a bootparam, this would've become powernow-k7.powernow_acpi_force which looks silly.
[PATCH] removal of MOD_{INC,DEC}_USE_COUNT in ide-cs.c
From: Pavel Roskin <proski@gnu.org>
The "ide-cs" module cannot be unloaded because it uses obsolete
MOD_INC_USE_COUNT and MOD_DEC_USE_COUNT macros. In fact, they are not
needed in ide-cs.c in 2.6 kernels. The generic PCMCIA code already
increases use count for every device served by the driver, so it's
impossible to unload the ide-cs driver while it's in use.
I was told that the removal of IDE interfaces may be unsafe in 2.6
kernels. However, MOD_INC_USE_COUNT only prevents removal of the module,
not the interface. It's also the first obstacle, albeit a trivial one,
for anybody debugging those problems (i.e. loading a modified module
requires "rmmod -f" or reboot to unload the old version).
[PATCH] ide-disk.c: fix for IDE CF card ejection with devfs
From: Pavel Roskin <proski@gnu.org>
If I eject IDE CompactFlash card, I get a stack dump from
devfs_remove() because ide/host2/bus0/target0/lun0 doesn't exist.
After del_gendisk() is called from idedisk_cleanup() drive->devfs_name refers
to a non-existent directory and should be erased, so that ide_unregister()
doesn't try to remove that directory again.
Andrew Morton [Wed, 21 Apr 2004 00:44:58 +0000 (17:44 -0700)]
[PATCH] loop_set_fd() sendfile check fix
From: Yury Umanets <torque@ukrpost.net>
I have found small inconsistency in loop_set_fd(). It checks if
->sendfile() is implemented for passed block device file. But in fact,
loop back device driver never calls it. It uses ->sendfile() from backing
store file.
Andrew Morton [Wed, 21 Apr 2004 00:44:44 +0000 (17:44 -0700)]
[PATCH] i386 hugetlb tlb correction
From: William Lee Irwin III <wli@holomorphy.com>
i386 does hardware interpretation of pagetables, so pte_clear() can't be
used on present ptes, as it sets the upper half of the hugepte prior to
setting the lower half (which includes the valid bit). i.e. there is a
window where having a hugepage mapped at 56GB and doing pte_clear() in
unmap_hugepage_range() allows other threads of the process to see a
hugepage at 0 in place of the original hugepage at 56GB.
This patch corrects the situation by using ptep_get_and_clear(), which
clears the lower word of the pte prior to clearing the upper word.
There is another nasty where huge_page_release() needs to wait for TLB
flushes before returning the hugepages to the free pool, analogous to the
issue tlb_remove_page() and tlb_flush_mm() repair.
Andrew Morton [Wed, 21 Apr 2004 00:44:05 +0000 (17:44 -0700)]
[PATCH] selinux: remove hardcoded policy assumption from get_user_sids() logic
From: Stephen Smalley <sds@epoch.ncsc.mil>
This patch removes a hardcoded policy assumption from the get_user_sids logic
in the SELinux module that was preventing it from returning contexts that had
the same type as the caller even if the policy allowed such a transition. The
assumption is not valid for all policies, and can be handled via policy
configuration and userspace rather than hardcoding it in the module logic.
Andrew Morton [Wed, 21 Apr 2004 00:43:53 +0000 (17:43 -0700)]
[PATCH] selinux: add runtime disable
From: Stephen Smalley <sds@epoch.ncsc.mil>
This patch adds a kernel configuration option that enables writing to a new
selinuxfs node 'disable' that allows SELinux to be disabled at runtime prior
to initial policy load. SELinux will then remain disabled until next boot.
This option is similar to the selinux=0 boot parameter, but is to support
runtime disabling of SELinux, e.g. from /sbin/init, for portability across
platforms where boot parameters are difficult to employ (based on feedback by
Jeremy Katz).
Andrew Morton [Wed, 21 Apr 2004 00:43:42 +0000 (17:43 -0700)]
[PATCH] selinux: change context_to_sid handling for no-policy case
From: Stephen Smalley <sds@epoch.ncsc.mil>
This patch changes the behavior of security_context_to_sid in the no-policy
case so that it simply accepts all contexts and maps them to the kernel SID
rather than rejecting anything other than an initial SID. The change avoids
error conditions when using SELinux in permissive/no-policy mode, so that any
file contexts left on disk from prior use of SELinux with a policy will not
cause an error when they are looked up and userspace attempts to set contexts
can succeed.
Andrew Morton [Wed, 21 Apr 2004 00:43:05 +0000 (17:43 -0700)]
[PATCH] lockfs - xfs bits
From: Christoph Hellwig <hch@lst.de>
Remove all the code now in the VFS, make XFS's freeze ioctls use the new
infastructure and reorganize some code.
This code needs some work so the source files shared with 2.4 aren't
exposed to the new VFS interfaces directly. You'll get an update once this
has been discussed with the other XFS developers and is implemented. Note
that the current patch works fine and I wouldn't complain if it gets into
Linus' tree as-is.
Andrew Morton [Wed, 21 Apr 2004 00:42:39 +0000 (17:42 -0700)]
[PATCH] lockfs - vfs bits
From: Christoph Hellwig <hch@lst.de>
These are the generic lockfs bits. Basically it takes the XFS freezing
statemachine into the VFS. It's all behind the kernel-doc documented
freeze_bdev and thaw_bdev interfaces.
Andrew Morton [Wed, 21 Apr 2004 00:42:28 +0000 (17:42 -0700)]
[PATCH] remove amd7xx_tco
From: Zwane Mwaikambo <zwane@linuxpower.ca>
We've had trouble with this driver, it appears to work but the hardware
never does the final reboot. I have yet to come across someone with a
board which works and don't have personal access to one. So how about
scrapping the whole thing.
Andrew Morton [Wed, 21 Apr 2004 00:42:18 +0000 (17:42 -0700)]
[PATCH] Call populate_rootfs later in boot
populate_rootfs() is called rather early - before we've called init_idle().
But populate_rootfs() does file I/O, which involves calls to cond_resched(),
and downing of semaphores, etc. If it scheules, the scheduler emits
scheduling-while-atomic warnings and sometimes oopses.
So run populate_rootfs() later, after the scheduler is all set up.
Solar Designer discovered an information leak in the ext3 code of Linux.
In a worst case an attacker could read sensitive data such as cryptographic
keys which would otherwise never hit disk media. Theodore Ts'o developed a
correction for this.
I assume the task_lock is to prevent another process (on SMP or preempt)
from ptracing the execing process between the check and the assignment. If
that's the concern then the fact that the lock is dropped before the call
to security_brpm_compute_creds means that, if security_bprm_compute_creds
does anything interesting, there's a race.
For my (nearly complete) caps patch, I obviously need to fix this. But I
think it may be exploitable now. Suppose there are two processes, A (the
malicious code) and B (which uses exec). B starts out unprivileged (A and
B have, e.g., uid and euid = 500).
1. A ptraces B.
2. B calls exec on some setuid-root program.
3. in cap_bprm_set_security, B sets bprm->cap_permitted to the full
set.
4. B gets to compute_creds in exec.c, calls task_lock, and does not
change its uid.
5. B calls task_unlock.
6. A detaches from B (on preempt or SMP).
7. B gets to task_lock in cap_bprm_compute_creds, changes its
capabilities, and returns from compute_creds into load_elf_binary.
8. load_elf_binary calls create_elf_tables (line 852 in 2.6.5-mm1),
which calls cap_bprm_secureexec (through LSM), which returns false (!).
9. exec finishes.
The setuid program is now running with uid=euid=500 but full permitted
capabilities. There are two (or three) ways to effectively get local root
now:
1. IIRC, linux 2.4 doesn't check capabilities in ptrace, so A could
just ptrace B again.
2. LD_PRELOAD.
3. There are probably programs that will misbehave on their own under
these circumstances.
Is there some reason why this is not doable?
The patch renames bprm_compute_creds to bprm_apply_creds and moves all uid
logic into the hook, where the test and the resulting modification can both
happen under task_lock().
This way, out-of-tree LSMs will fail to compile instead of malfunctioning.
It should also make life easier for LSMs and will certainly make it easier
for me to finish the cap patch.
One of the stack size optimizations introduced a new static variable in
a function marked with __init. But the variable is not marked
appropriately and so 1k of data is never freed.
Andrew Morton [Tue, 20 Apr 2004 00:59:56 +0000 (17:59 -0700)]
[PATCH] MIPS update
From: Ralf Baechle <ralf@linux-mips.org>
- more work on resurrecting AMD Alchemy platforms
- cleanup of unnecessary <asm/pgalloc.h> inclusions
- update default config files
- cleanup 32-bit compat ioctl code
- support for Montum Jaguar ATX
- workarounds for early revs of the RM9000
- fixes for RM5000 and RM7000 cache handling
- add support for PMC-Sierra Yosemite eval board
- further cleanup and bugfixes for SGI IP27
- make LASAT and VR41xx build and work in 2.6
- improved SGI IP32 support
- plenty of small fixes
Andrew Morton [Tue, 20 Apr 2004 00:23:00 +0000 (17:23 -0700)]
[PATCH] MIPS: don't offer SERIAL_DZ on 64-bit DEC
From: Ralf Baechle <ralf@linux-mips.org>
Limit the DZ driver to MIPS32 as the supported hardware is only present in
R2k/R3k-based systems (unless someone sends Maciej a PMAC-A board for driver
development).
Andrew Morton [Tue, 20 Apr 2004 00:22:03 +0000 (17:22 -0700)]
[PATCH] fix madvise(MADV_DONTNEED) for nonlinear vmas
From: Hugh Dickins <hugh@veritas.com>
Jamie points out that madvise(MADV_DONTNEED) should unmap pages from a
nonlinear area in such a way that the nonlinear offsets are preserved if the
pages do turn out to be needed later after all, instead of reverting them to
linearity: needs to pass down a zap_details block.
(But this still leaves mincore unaware of nonlinear vmas: bigger job.)
Andrew Morton [Tue, 20 Apr 2004 00:21:51 +0000 (17:21 -0700)]
[PATCH] reiserfs use-after-free fix
From: Chris Mason <mason@suse.com>
reiserfs-delayed-work started using queue_delayed_work, but did not make sure
the timer was finished before it freed the work queue structs during unmount.
This leads to timer oopsen if you unmount at just the right time.
Roland McGrath [Tue, 20 Apr 2004 00:20:06 +0000 (17:20 -0700)]
[PATCH] fix for potential deadlock after posix-timers change
Ulrich has been working on the glibc code using posix-timers and
stressing it more now than it has before. He ran into an SMP deadlock
on process exit in the case there are pending queued signals from a
timer.
The deadlock arises because in the path through exit_itimers, the
tasklist_lock is already held (for writing). When a timer is being
deleted, sigqueue_free will try to take it (for reading) in the case
where that timer has a pending signal queued on somebody's queue. This
patch avoids the problem by making sure the queues are flushed before
calling exit_itimers, thus ensuring its code path won't try to take
tasklist_lock.
My message queue patch fixes the 64 bits -> 32 bits conversion of
siginfo, but didn't change the 32 -> 64 bits conversion done in
sys32_rt_sigqueueinfo() which was apparently bogus as well.
After much discussion & debate on the right way of converting that
structure, I decided to go the sparc64 / s390 way, and not the x86_64
way, that is to copy the various unions data "as is". This guarantees
that whatever a 32 bist app passes there, another 32 bits app will
understand it. Crossover between 32 and 64 bits apps on such things
as home-made userland siginfo isn't something we can help with anyway.
The x86_64 choice of converting as if it was an RT signal, thus
converting the sigval, cannot easily be applied to big endian archs
since the sigval is a union of a ptr and an int, on BE, the int
happens to be on the wrong half of the 64 bits ptr, thus we can't
do a simple conversion.
Dave Jones [Mon, 19 Apr 2004 10:23:44 +0000 (11:23 +0100)]
[CPUFREQ] Fix broken cast.
This breaks on x86-64 with the following warning.
drivers/cpufreq/cpufreq_userspace.c: In function `cpufreq_procctl':
drivers/cpufreq/cpufreq_userspace.c:170: warning: cast from pointer to integer of different size
drivers/cpufreq/cpufreq_userspace.c: In function `cpufreq_sysctl':
drivers/cpufreq/cpufreq_userspace.c:208: warning: cast from pointer to integer of different size
init_ide_data() initializes default IDE interfaces but without default IRQ
(hwif->irq and hwif->hw.irq fields) so introduce ide_init_default_irq() and
remove redundant ide_init_default_hwifs() (except arm26 and arm ones).
As a side-effect it fixes:
- CONFIG_BLK_DEV_HD_IDE if !CONFIG_BLK_DEV_IDEPCI (i386)
- hwif->noprobe shouldn't be 0 if !hwif->io_ports[IDE_DATA_OFFSET]
(alpha, i386, ia64, mips, sh, x86_64)
The following patch allows hw_random.c to build on ia64. (The problem
was just that the VIA stuff has i386 assembly in it. The current code
only probes for VIA on i386 anyway, so this patch just adds more ifdefs
so the VIA code is only built for i386.)
Pavel Roskin [Mon, 19 Apr 2004 09:04:06 +0000 (05:04 -0400)]
[PATCH] Tulip endianess fix
My tulip ethernet card doesn't work on Blue&White G3 PowerMac with Linux
2.6.5-rc2. The card is shown by lspci as
01:03.0 Ethernet controller: Linksys Network Everywhere Fast Ethernet
10/100 model NC100 (rev 11)
The kernel detects it as "ADMtek Comet rev 17".
The MAC address reported by the kernel looked obviously wrong. Also, I
could only ping the system successfully if the interface was in promiscuous
mode (running Ethereal).
Those two symptoms indicated two different problems - one for reading the
MAC address from the card on module load (tulip_init_one), and the other
for writing the address to the card when the interface was brought up
(tulip_up). I have fixed both, and here's the explanation:
tulip_init_one:
When reading the first 4 bytes of the address, inl() returns the same data
to the CPU on all platforms, interpreting the data from the lowest port
address as the least significant byte. In other words, I/O is little
endian on all platforms; it's the memory that differs across platforms.
We want to write the data to memory preserving little-endianness of the
PCI bus. To force little endian write to the memory, the data should be
converted to the little endian format.
When reading the remaining 2 bytes, the CPU gets them in 2 least
significant bytes. To write those 2 bytes to the memory in a 16-bit
operation, they should be byte-swapped for the 16-bit operation.
tulip_up:
The first 4 bytes are processed correctly, but the code is confusing.
Reading from memory needs conversion to CPU format, while writing to I/O
ports doesn't. So I replaced cpu_to_le32() to le32_to_cpu().
The second 2 bytes are read in a 16-bit memory operation, so they should
be passed to le16_to_cpu() rather than cpu_to_le32() to make them CPU
independent and suitable for outl().
All those conversions do nothing on little-endian machines, so they should
not be affected.
The patch has been tested. The driver is working fine. ping is OK, ssh
is OK, X11 over ssh is OK. Even netconsole is working fine.
Russell King [Mon, 19 Apr 2004 08:50:20 +0000 (04:50 -0400)]
[PATCH] fix arm/etherh.c
On Tue, Apr 13, 2004 at 02:35:40PM -0400, Jeff Garzik wrote:
> Russell,
>
> Would you be willing to provide an updated diff of this?
I didn't particularly like the PRIV() method implemented previously -
gcc appears to want to avoid some optimisations it if its an inline
function rather than a macro.
Also, 'ei_local' may look unused in some functions, but it's your
typical hidden-use-in-a-macro crap which 8390 likes.
In systems with mixed network cards, and all drivers compiled into
the kernel; the PCI device (eth0) will get probed first, before the ISA.
The problem is that the ISA device can mistakenly try to probe
for eth0. The problem is that the ISA driver will not detect the failure
until it goes to call register_netdevice, and not all drivers have
perfect error unwind code.
This patch short circuits the device probe, so it won't bother
looking for devices that already are registered.
Adrian Bunk [Mon, 19 Apr 2004 08:43:04 +0000 (04:43 -0400)]
[PATCH] fix warning in drivers/net/tulip/timer.c
I get the following warning in 2.6.5-mm6 and 2.6.6-rc1:
<-- snip -->
...
CC drivers/net/tulip/timer.o
drivers/net/tulip/timer.c: In function `comet_timer':
drivers/net/tulip/timer.c:156: warning: unused variable `ioaddr'
...
<-- snip -->
Since the
[netdrvr tulip] add MII support for Comet chips
patch has removed the only use of this variable, the fix is simple:
Chris Wright [Mon, 19 Apr 2004 08:26:30 +0000 (04:26 -0400)]
[PATCH] wan sdla: fix probable security hole
> [BUG] minor
> /home/kash/linux/linux-2.6.5/drivers/net/wan/sdla.c:1206:sdla_xfer:
> ERROR:TAINT: 1201:1206:Passing unbounded user value "(mem).len" as arg 0
> to function "kmalloc", which uses it unsafely in model
> [SOURCE_MODEL=(lib,copy_from_user,user,taintscalar)]
> [SINK_MODEL=(lib,kmalloc,user,trustingsink)] [MINOR] [PATH=] [Also
> used at, line 1219 in argument 0 to function "kmalloc"]
> static int sdla_xfer(struct net_device *dev, struct sdla_mem *info, int
> read)
> {
> struct sdla_mem mem;
> char *temp;
>
> Start --->
> if(copy_from_user(&mem, info, sizeof(mem)))
> return -EFAULT;
>
> if (read)
> {
> Error --->
> temp = kmalloc(mem.len, GFP_KERNEL);
> if (!temp)
> return(-ENOMEM);
> sdla_read(dev, mem.addr, temp, mem.len);
Hrm, I believe you could use this to read 128k of kernel memory.
sdla_read() takes len as a short, whereas mem.len is an int. So,
if mem.len == 0x20000, the allocation could still succeed. When cast
to short, len will be 0x0, causing the read loop to copy nothing into
the buffer. At least it's protected by a capable() check. I don't
know what proper upper bound is for this hardware, or how much it's
used/cared about. Simple memset() is trivial fix.
Andrew Morton [Mon, 19 Apr 2004 05:06:30 +0000 (22:06 -0700)]
[PATCH] From: David Gibson <david@gibson.dropbear.id.au>
hugepage_vma() is both misleadingly named and unnecessary. On most archs it
always returns NULL, and on IA64 the vma it returns is never used. The
function's real purpose is to determine whether the address it is passed is a
special hugepage address which must be looked up in hugepage pagetables,
rather than being looked up in the normal pagetables (which might have
specially marked hugepage PMDs or PTEs).
This patch kills off hugepage_vma() and folds the logic it really needs into
follow_huge_addr(). That now returns a (page *) if called on a special
hugepage address, and an error encoded with ERR_PTR otherwise. This also
requires tweaking the IA64 code to check that the hugepage PTE is present in
follow_huge_addr() - previously this was guaranteed, since it was only called
if the address was in an existing hugepage VMA, and hugepages are always
prefaulted.
Andrew Morton [Mon, 19 Apr 2004 05:06:16 +0000 (22:06 -0700)]
[PATCH] Fix default value for commit interval for older reiserfs filesystems.
From: Bart Samwel <bart@samwel.tk>
The reiserfs patch that adds support for "commit=0" saves the default max
commit age in a variable when the fs is originally mounted, so that it can
later restore it. Unfortunately it makes some mistakes with that:
- The default is not saved when the original mount has a commit=NNN option.
- The default is not correctly saved for older reiserfs filesystems, where
the default was not stored on disk.
Andrew Morton [Mon, 19 Apr 2004 05:05:51 +0000 (22:05 -0700)]
[PATCH] Increase number of dynamic inodes in procfs
From: Nathan Lynch <nathanl@austin.ibm.com>
On some larger ppc64 configurations /proc/device-tree is exhausting procfs'
dynamic (non-pid) inode range (16K). This patch makes the dynamic inode
range 0xf0000000-0xffffffff and changes the inode number allocator to use
the idr.c allocator for the first-fit allocations.
A few weeks ago, Pavel and I agreed that PF_IOTHREAD should be renamed to
PF_NOFREEZE. This reflects the fact that some threads so marked aren't
actually used for IO while suspending, but simply shouldn't be frozen.
This patch, against 2.6.5 vanilla, applies that change. In the
refrigerator calls, the actual value doesn't matter (so long as it's
non-zero) and it makes more sense to use PF_FREEZE so I've used that.
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This patch adds the posix message queue syscalls to ppc32 and 64 and fixes
our implementation of compat copy siginfo to 32 bits userland which wasn't
using the si_code but still doing a switch/case on the signal number.