Andrew Morton [Sun, 31 Aug 2003 11:36:41 +0000 (04:36 -0700)]
[PATCH] tty oops fix
Ancient bug, reported by Hiroshi Inoue <inoueh@uranus.dti.ne.jp>:
1. login to tty2 (not tty1)
2. start kon (Kanji cONsole emulator, console which support
Japanese characters)
3. exit kon
4. logout
It oopses in the debugging function check_tty_count(), walking a list_head
which has been list_del()'d. Call trace is:
#0 check_tty_count (tty=0x10d42000, routine=0xc817b00 ".paths") at include/asm/processor.h:583
#1 0x022c6c00 in do_tty_hangup (data=0x10d42000) at drivers/char/tty_io.c:426
#2 0x022c6f60 in tty_vhangup (tty=0xc817b00) at drivers/char/tty_io.c:536
#3 0x022c6fcc in disassociate_ctty (on_exit=1) at drivers/char/tty_io.c:574
#4 0x02127aee in do_exit (code=0) at kernel/exit.c:718
#5 0x02127caa in do_group_exit (exit_code=0) at kernel/exit.c:796
#6 0x02127cbc in sys_exit_group (error_code=0) at kernel/exit.c:807
The tty refcount is zero, so everything seems consistent and sensible. The
fix just uses list_del_init() on that list_head.
Heaven knows what the locking for tty->count is though. Some bizarre mixture
of BKL, tty_sem and nothing at all.
Andrew Morton [Sun, 31 Aug 2003 11:36:33 +0000 (04:36 -0700)]
[PATCH] scsi_unregister() oops fix
Some drivers such as aha1542 and aic7xxx_old will call scsi_register() and
then, if some succeeding operations fails they will call scsi_unregister(),
without an intervening scsi_set_host().
This causes an oops in scsi_put_device(), because kobj->parent is NULL.
In other words, scsi_register() immediately followed by scsi_unregister()
is guaranteed to oops.
The patch makes scsi_host_dev_release() more robust against this usage
pattern.
High Precision Event Timer (HPET) is next generation timer
hardware and has various advantages over legacy 8254
(PIT) timer, like:
- Associated registers are mapped to memory space. So, we no
longer require in and out on legacy ioports
- Memory map address is reported by ACPI (and are not
hard-coded)
- Each timer can be configured to generate separate interrupts,
even sharing lines with PCI devices
- HPET has a minimum period of 100 nanosecs and is not fixed.
Giving a flexibility of increasing the resolution in future.
- Most current implementations has 3 counters, but in future,
we can have as many as 32 timers per block, and 8
HPET timer blocks (total 256 timers)
- Can support 32bit and 64bit counting
(Refer to http://www.intel.com/labs/platcomp/hpet/hpetspec.htm
for complete specs)
The patchset that follow adds support for High Precision Event
Timer (HPET) based timer in kernel. This uses the HPET in
LegacyReplacement mode (so that counter 0 will be tied to IRQ0,
and counter 1 will be tied to IRQ 8). In this mode, HPET overrides
PIT and RTC interrupt lines. The patch will enable HPET by default,
on systems where ACPI tables reports this feature. The patch will
have no impact on systems that do not support this feature.
A major change from previous version is elimination of fixmap for HPET.
Based on Andrew Morton's suggestion, we have a new hook in init/main.c for
late_time_init(), at which time we can use ioremap, in place of fixmap.
Impact on other archs: Calibrate_delay() (and hence loops_per_jiffy
calculation) has moved down in main.c, from after time_init() to after
kmem_cache_init().
1/6 - hpet1.patch - main.c change to introduce late_time_init()
Andrew Morton [Sun, 31 Aug 2003 11:35:17 +0000 (04:35 -0700)]
[PATCH] vmscan: zone pressure simplification and fix
The zone->pressure field is supposed to record the amount of reclaim pressure
which this zone is under. We need this info so we know whether to unmap
pages from pagetables right from the outset of a balance_pgdat() or
try_to_free_pages() invokation.
The problem with the current code is that the exponential average gets tugged
around too much: as we perform the increasing-priority scan, the pressure
metric is made artificially low by the early part of the scan.
So instead what we do here is to record within the zone the scanning priority
from the zone's previous scan. It is defined as the priority at which the
zone achieved the "enough pages free" state. This prev_priority is used on
the next scan for the do-we-need-to-be-unmapping-pages decision.
Andrew Morton [Sun, 31 Aug 2003 11:35:09 +0000 (04:35 -0700)]
[PATCH] vmscan: zone pressure calculation fix
Off-by-one in balance_pgdat(): `priority' can never go negative. It causes
the scanning priority thresholds to be quite wrong and kswapd tends to go
berzerk when there is a lot of mapped memory around.
Andrew Morton [Sun, 31 Aug 2003 11:35:02 +0000 (04:35 -0700)]
[PATCH] ipc_init() uses vmalloc too early
From: Andrea Arcangeli <andrea@suse.de>
aka: "vmalloc allocations in ipc needs smp initialized (and vm must be
allowed to schedule in 2.6)"
In short if you change SEMMNI to 8192 the kernel will crash at boot, beause
it tries to call vmalloc before the smp is initialized. The reason is that
vmalloc calls into the pte alloc code, and the fast pte alloc is tried
first, but that reads into the pte_quicklist, that requires the cpu_data to
be initialized (and that happens in smp_init()).
the patch is obviously safe, since no piece of kernel (especially the code
in the check_bugs and smp_init paths ;) calls into the ipc subsystem.
The reason this started to trigger wasn't really that we increased SEMMNI,
but what happend is that some IPC data structure grown, and for some reason
the corruption due the uninitalized pte_quicklist triggers only for smp
boxes with less than 1G (not very common anymore ;). So it wasn't
immediatly reproducible on all setups.
2.6 doesn't suffer from the same problem, simply because 2.6 isn't using
the quicklist anymore, but I think it would be much more correct to make
the same change in 2.6 too, since whatever cond_resched() in the vm paths
(and they're definitely allowed to call it), will lead to a crash since the
init task isn't initialized and the scheduler can't be invoked yet. (and
2.6 already has the bigger data structures that should trigger the vmalloc
all the time on all setups)
Andrew Morton [Sun, 31 Aug 2003 11:34:53 +0000 (04:34 -0700)]
[PATCH] raw driver oops fix
From: Dave Olien <dmo@osdl.org>
The raw.c character device Oopses dereferencing a NULL pointer in
bd_claim() This problem occurred after bd_claim() in block_dev.c was
modified to "claim the whole device when a partition is claimed".
raw_open() made the mistake of calling bd_claim BEFORE calling blkdev_get().
At that time, the bdev->bd_contains field has not yet been initialized.
Switching the order allows blkdev_get() to initialize those fields before
calling bd_claim().
Also fixed up some error return paths:
igrab() should never fail under these circumstances since the caller
already has a reference to that inode through the bdev at that time.
In the event of blkdev_get() failure or set_blocksize() failure, not all
the work to unwind from the error was done.
Andrew Morton [Sun, 31 Aug 2003 11:34:26 +0000 (04:34 -0700)]
[PATCH] make voyager work again after the cpumask_t changes
From: James Bottomley <James.Bottomley@SteelEye.com>
Most is just simple fixes; however, the needless change from atomic to
non-atomic operations in smp_invalidate_interrupt() caused me a lot of
pain to track down since it introduced some very subtle bugs.
I've also taken phys_cpu_present_map out of smp.h. Since it
physid_mask_t is defined in mpspec.h anyway, and contains a duplicate
definition, I don't believe it can hurt anything.
Andrew Morton [Sun, 31 Aug 2003 11:34:11 +0000 (04:34 -0700)]
[PATCH] Use tgid rather than pid in dnotify
From: Ulrich Drepper <drepper@redhat.com>
I'm not entirely sure about this change. But it seems to be necessary.
The dnotify code stores the PID in the file structure. The entire process
shares the file and any signal (is it used for that?) should be sent to the
process (thread group), not the individual thread. Also keep in mind that
threads can go away while the process (and therefore file descriptor)
remain. And the ID of the thread can be reused.
Somebody who knows this code should take a good look.
Andrew Morton [Sun, 31 Aug 2003 11:33:50 +0000 (04:33 -0700)]
[PATCH] kbuild: warn if the user has old modutils
From: Valdis.Kletnieks@vt.edu, Sam Ravnborg <sam@ravnborg.org>
Adds an explicit check for the new modutils in the build system.
Generally we should avoid these sorts of hardwired checks for the right
versions of things, but we are still getting a significant number of problem
reports due to people not having the new tools. Let's help them out.
Andrew Morton [Sun, 31 Aug 2003 11:33:12 +0000 (04:33 -0700)]
[PATCH] large dev_t 12/12 oops fix
From: viro@parcelfarce.linux.theplanet.co.uk
On Wed, Aug 27, 2003 at 01:46:37AM -0700, Andrew Morton wrote:
>
> LILO seems to be oopsing in HDIO_GETGEO ioctl for some reason, in
> generic_ide_ioctl().
>
> I'm not sure quite why though. Could one of your patches affected this
> area?
The last one (fix for hd_struct handling). The fix follows:
Andrew Morton [Sun, 31 Aug 2003 11:32:56 +0000 (04:32 -0700)]
[PATCH] add context switch counters
From: Peter Chubb <peterc@gelato.unsw.edu.au>
Currently, the context switch counters reported by getrusage() are
always zero. The appended patch adds fields to struct task_struct to
count context switches, and adds code to do the counting.
The patch adds 4 longs to struct task struct, and a single addition to
the fast path in schedule().
Andrew Morton [Sun, 31 Aug 2003 11:32:34 +0000 (04:32 -0700)]
[PATCH] do_no_page() rss accounting fix
From: Jaroslav Kysela <perex@suse.cz>
The do_no_page() function in mm/memory.c does accounting for reserved pages
(++mm->rss), but in zap_pte_range() we don't decrement rss if the page was
reserved.
So don't account for PageReserved pages in the rss. (Maybe it would be
better to fix zap_pte_range in the opposite direction..)
Andrew Morton [Sun, 31 Aug 2003 11:31:46 +0000 (04:31 -0700)]
[PATCH] Fix typo in #ifdef for ext2 xattr support
From: Stephen Smalley <sds@epoch.ncsc.mil>
This patch corrects a typo in an ifdef that enables xattr operations for
special files in the ext2 code; otherwise, extended attributes cannot be
obtained or set on such inodes.
Andrew Morton [Sun, 31 Aug 2003 11:31:37 +0000 (04:31 -0700)]
[PATCH] Rework SELinux binprm hooks
From: Stephen Smalley <sds@epoch.ncsc.mil>
This patch reworks the SELinux binprm hook functions to use a security
structure for the linux_binprm rather than directly stuffing the security
identifier into the void* security field. It also performs some cleanup of
the SELinux binprm hook functions, and one miscellaneous fix.
Andrew Morton [Sun, 31 Aug 2003 11:30:57 +0000 (04:30 -0700)]
[PATCH] Fix ext3 htree corruption on big-endian platforms
From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
current bk 2.6.0 corrupts my ext3 filesystems, usually in the RESYNC dir
during a bk pull. Checking the recent changes I noticed that the one in
fs/ext3/namei.c misses an endian conversion. The attached patch fixes that
and works fine for me since 2 days now on PPC.
Andrew Morton [Sun, 31 Aug 2003 11:29:40 +0000 (04:29 -0700)]
[PATCH] Fix permissions on /proc/kallsyms
From: Rusty Russell <rusty@rustcorp.com.au>
Change the permissions on /proc/kallsyms. As David M-T points out,
it's nice for analysis tools not to need root. Place
cond_resched() to avoid starvation problems on non-preempt.
Andrew Morton [Sun, 31 Aug 2003 11:28:52 +0000 (04:28 -0700)]
[PATCH] airo CONFIG_PCI=n build fix
From: Geert Uytterhoeven <geert@linux-m68k.org>
On Fri, 22 Aug 2003, Linus Torvalds wrote:
> Javier Achirica:
> o [wireless airo] Fix PCI unregister code
This patch causes a regression: if CONFIG_PCI is not set, it doesn't compile
anymore. Here's a fix. I also killed a dead variable and its corresponding
warning:
Andrew Morton [Sun, 31 Aug 2003 11:28:44 +0000 (04:28 -0700)]
[PATCH] zoran: correct name field breakage
From: Ronald Bultje <rbultje@ronald.bitfreak.net>
I suddenly noticed that 2.6.0-test4 seems to have removed the struct
device->name field, apparently for memory consumption reasons. Linus
changed this to pci_name((zr)->pci_dev) in my driver, and that's almost
correct, except that it is the PCI device ID, and I'm not supposed to
touch it. Also, since it's only 4 bytes, all my device names now show
like 'DC1' (this should be 'DC10plus') and alike.
The attached patch fixes this by going back to the behaviour that we
used in 2.4.x: we use a separate name field in our private driver
struct.
Andrew Morton [Sun, 31 Aug 2003 11:28:29 +0000 (04:28 -0700)]
[PATCH] zoran: cleanups
From: Ronald Bultje <rbultje@ronald.bitfreak.net>
This patch changes some funky coding style (a.k.a. indent artifact) in
the function zoran_irq() to a somewhat more conservative coding style.
It was noticed by Francois Romieu.
Andrew Morton [Sun, 31 Aug 2003 11:28:22 +0000 (04:28 -0700)]
[PATCH] zoran: add pci_disable_device() call
From: Ronald Bultje <rbultje@ronald.bitfreak.net>
This patch adds pci_disable_device() to the card release function; we
already used pci_enable_device() in the card detection function. This was
noticed by Francois Romieu.
Andrew Morton [Sun, 31 Aug 2003 11:28:14 +0000 (04:28 -0700)]
[PATCH] zoran: add release callback
From: Ronald Bultje <rbultje@ronald.bitfreak.net>
This patch adds a release callback which frees the video_device struct.
This is needed to prevent freeing memory before it's not in use anymore,
as described in http://lwn.net/Articles/36850/. Without this, the driver
will give a warning when loaded. It might crash when unloading (see
article), too. The video4linux patch (by Gerd Knorr) was accepted a week
(or 2?) ago, but I forgot to adapt my driver to it.
Andrew Morton [Sun, 31 Aug 2003 11:28:07 +0000 (04:28 -0700)]
[PATCH] zoran: debug->zr_debug
From: Ronald Bultje <rbultje@ronald.bitfreak.net>
This patch renames the debug symbol to zr_debug because debug is already
defined somewhere else. Without it, it will cause a symbol conflict when
compiling this driver statically into the kernel. This was noticed by
several people, including Linus himself.
Andrew Morton [Sun, 31 Aug 2003 11:27:59 +0000 (04:27 -0700)]
[PATCH] zoran: memleak fixes
From: Ronald Bultje <rbultje@ronald.bitfreak.net>
This patch fixes several memleaks in error cases when the setup of i2c
client drivers for video encoders/decoders fails. We forgot to free some
memory in various places. This was noticed by Francois Romieu.
Andrew Morton [Sun, 31 Aug 2003 11:27:35 +0000 (04:27 -0700)]
[PATCH] don't report async write errors on close() after all
I had second thoughts on this.
Reporting background writeout errors via close() only really makes sense if
allthe IO has completed anyway: ie, the app has had the fd open without
writing to it for many tens of seconds.
It would be OK if it was harmless, but it is not. Changes are, applications
ignore errors from close(). So if an application does a fork/exit and the
child correctly does an fsync() of the fd, the close-on-exit will have wiped
out any accumulated EIO/ENOSPC errors.
Or if someone does dup()/close()/fsync(), the fsync() could fail to detect
earlier errors, thanks to the close.
So. The clear-and-report of errors on close() makes the reporting of errors
on fsync/msync/fdatasync less reliable.
Andrew Morton [Sun, 31 Aug 2003 11:27:28 +0000 (04:27 -0700)]
[PATCH] zeromap_pmd_range bugfix
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
The patch below fixes a 2.6 mm problem. Without this patch, zeromapped
pages are not flushed properly when they are swapped out.
What happens is that the page->index field is zero for page table pages
corresponding to the zeromapped range. This causes ptep_to_address() to
return an incorrect virtual address with the result that PTEs are never
invalidated at swap-out...
Andrew Morton [Sun, 31 Aug 2003 11:27:21 +0000 (04:27 -0700)]
[PATCH] Add 3GB personality
From: Andi Kleen <ak@muc.de>
Another a bit ugly but necessary patch for 32bit emulation.
Some applications including some versions of java break when the stack is
beyond the i386 standard 3GB boundary. For these add a 3GB personality
that moves the stack to 3GB and fixes the beginning of the mmap area. It's
a bit ugly, but better than not running these applications at all (e.g.
the Oracle installer depends on such a buggy java :-(). It's also not only
Java, but some other programs as well.
Andrew Morton [Sun, 31 Aug 2003 11:26:51 +0000 (04:26 -0700)]
[PATCH] v4l use-after-free fix
From: Greg KH <greg@kroah.com>
When working on converting the usb v4l drivers to the new v4l class
changes, I ran into this nasty bug. Seems that the core was using a
structure after it had been freed. The patch below fixes it.
Andrew Morton [Sun, 31 Aug 2003 11:26:27 +0000 (04:26 -0700)]
[PATCH] move DAC960 GAM IOCTLs into a new device
From: Dave Olien <dmo@osdl.org>
The DAC960 driver uses an ugly overloading of the O_NONBLOCK flag to
support the controller's RAID configuration features.
Opening "/dev/rd/c0d0" with the O_NONBLOCK flag set returns a file
descriptor that can be used to do RAID control operations using ioctl().
The normal ioctl operations are not availabe with that file descriptor.
This patch removes that O_NONBLOCK overloading from DAC960_open() and
DAC960_ioctl() functions. It introduces a new "miscellaneous" device
named /dev/dac960_gam. It uses minor device number 252 of the miscellaneous
character devices.
The currently distrubted "Global Array Manager" server distrubted by
LSIlogic on their web page page works only on RH7.3 or earlier. It doesn't
work under RH9. There are probably some library incompatabilities.
So, I don't view this patch as breaking anything that currently works.
If this software package is ever brought up to date (which I doubt),
then it can be modified to use this new device at that time.
Andrew Morton [Sun, 31 Aug 2003 11:26:19 +0000 (04:26 -0700)]
[PATCH] Call security hook from pid*_revalidate
From: Stephen Smalley <sds@epoch.ncsc.mil>
This patch against 2.6.0-test3-mm3 adds calls to the security_task_to_inode
hook to the pid*_revalidate functions to ensure that the inode security field
is also updated appropriately for /proc/pid inodes. This corresponds with
the uid/gid update performed by the proc-pid-setuid-ownership-fix.patch that
is already in -mm3.
Andrew Morton [Sun, 31 Aug 2003 11:26:04 +0000 (04:26 -0700)]
[PATCH] disable prefetch on athlons
K7's (at least) are faulting in the prefetch instruction. The AMD
engineers have said they will be getting back to us on it, and the fix is
looking complex, and nobody seems to be standing up to work on it.
So hum. The usual manifestation is an oops in hlist_for_each(), down in
the VFS inode lookup code. Disrupting our testers in this way is very bad,
so this patch just disables prefetch on all AMD parts in a rather stupid
way.
Andrew Morton [Sun, 31 Aug 2003 11:25:56 +0000 (04:25 -0700)]
[PATCH] random: accounting and sleeping fixes
From: Oliver Xymoron <oxymoron@waste.org>
This fixes several calculation errors and races in entropy accounting
that would allow /dev/random output to greatly exceed the measured
entropy collection. This doesn't include any of my more controversial
hardening, it just makes it behave as intended.
It also corrects the operation of the 'catastrophic reseeding' feature
so that it will actually prevent the state extension attack it's meant
to guard against.
And finally, it also fixes a couple missed wake-up and accidental
sleep bugs uncovered by the above fixes.
Debug instrumentation has been improved to help verify correctness.
Andrew Morton [Sun, 31 Aug 2003 11:25:47 +0000 (04:25 -0700)]
[PATCH] random: SMP locking
From: Oliver Xymoron <oxymoron@waste.org>
This patch adds locking for SMP. Apparently Willy never managed to
revive his laptop with his version so I revived mine.
The batch pool is copied as a block to avoid long lock hold times
while mixing it into the primary pool.
Two locks are added:
gobal batch_lock
batch_entropy_store can be called from any context, and typically from
interrupts -> spin_lock_irqsave
batch_entropy_process is called called via schedule_delayed_work and
runs in process context -> spin_lock_irq
entropy_store.lock
the mixing process is too expensive to be called from an interrupt
context and the basic worker function extract_entropy can sleep, so
all this stuff can be under a normal spin_lock
Andrew Morton [Sun, 31 Aug 2003 11:25:40 +0000 (04:25 -0700)]
[PATCH] .config checks updated
From: Sam Ravnborg <sam@ravnborg.org>
When building a kernel right after 'make mrproper' resulted in a very short
run, and no sign that .config was missing. This has been fixed by adding a
new rule for .config in the top-level Makefile, and a new target
'silentoldconfig' in scripts/kconfig/Makefile.
Guillaume Morin [Sun, 31 Aug 2003 08:41:18 +0000 (01:41 -0700)]
[PATCH] fix cu3088 group write
The current cu3088 ccwgroup write code overwrite the last char of the
given arguments. This fixes the problem. It is been tested and applies
on latest bk.
Krishna Kumar [Sun, 31 Aug 2003 08:27:52 +0000 (01:27 -0700)]
[PATCH] Remaining task queue to work queue conversion.
Somewhere in the transition of task queue to the work queue, in
stallion.c, some of the schedule_task were left out from being converted
to schedule_work. This fixes it.