Anton Blanchard [Sat, 24 Jul 2004 02:39:20 +0000 (19:39 -0700)]
[PATCH] ppc64: exception path optimisations
- We were statically predicting syscalls would be 32bit which meant every
64bit syscall was guaranteed to be mispredicted. Just let the hardware
predict this one.
- We shouldnt use blrl for indirect function calls, it is unlikely to be
predicted correctly and corrupts the link prediction stack. We should
use bctrl instead.
- Statically predict a branch in the system call path, favouring calls from
userspace.
- Remove static prediction in pagefault path, hardware prediction should do
a better job here.
Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
David Mosberger [Fri, 23 Jul 2004 03:26:36 +0000 (20:26 -0700)]
[PATCH] NX: allow architectures to select legacy mode dynamically
On some platforms, you'll want to support READ_IMPLIES_EXEC differently
depending on personality (e.g, native binary vs. x86 binary).
This supports that (and makes the code more readable while at it) by
replacing the old architecture-specific fixed LEGACY_BINARIES macro
define with a architecture-specific "elf_read_implies_exec_binary()"
helper function.
For now, x86 is the only user, and sets the "read implies exec" bit for
legacy apps. ia64 and x86-64 are likely to want to do their own thing.
Make "install_page()" able to handle truncated pages.
This makes it much easier on the callers, no need to
worry about races with vmtruncate() and friends, since
"install_page()" will just cleanly handle that case
and tell the caller about it.
Roman Fietze [Thu, 22 Jul 2004 10:14:12 +0000 (03:14 -0700)]
[PATCH] clean up n_tty alloc_buf()
Don't bother zeroing the allocated memory inside alloc_buf() in the
n_tty line discipline. alloc_buf() is static inline and is only
referenced by n_tty_open() which always clears the memory (once more).
The recent changes to (6 Jul 04) pkt_cls.h are evil, you can't build a version
of 'tc' to work unless you know the kernel config!
It has several API problems:
- API data structures change on kernel config options
- new fields should be added at the end of a structure to allow
binary compatibility.
This patch tries to clean this up.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org> Signed-off-by: David S. Miller <davem@redhat.com>
Herbert Xu [Thu, 22 Jul 2004 05:16:19 +0000 (22:16 -0700)]
[INET]: Create enum of ECN bits
This patch is a preparation for an update of the ECN encap/decap
code with respect to RFC3168.
It creates an enum of the four code-points defined by RFC3168
and uses them throughout the inet_ecn.h file.
The only non-trivial bit is in IP_ECN_set_ce/IP6_ECN_set_ce where
the patch uses INET_ECN_CE instead of 1. This is OK as those
functions assume that the ECT bit is already set.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@redhat.com>
Herbert Xu [Wed, 21 Jul 2004 07:51:31 +0000 (00:51 -0700)]
[CRYPTO]: Fix stack overrun in crypt().
The stack allocation in crypt() is bogus as whether tmp_src/tmp_dst
is used is determined by factors unrelated to nbytes and
src->length/dst->length.
Since the condition for whether tmp_src/tmp_dst are used is very
complex, let's allocate them always instead of guessing.
This fixes a number of weird crashes including those AES crashes
that people have been seeing with the 2.4 backport + ipt_conntrack.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: James Morris <jmorris@redhat.com> Signed-off-by: David S. Miller <davem@redhat.com>
Simple enhancement to netem packet scheduler that makes it classful so
that the underlying pfifo default discipline can be substituted with something
else (tbf, red, ...)
Signed-off-by: Stephen Hemminger <shemminger@osdl.org> Signed-off-by: David S. Miller <davem@redhat.com>
Steve French [Sun, 18 Jul 2004 12:23:42 +0000 (07:23 -0500)]
CIFS: Add missing mount option for optionally cifs perm checks when uids on server and client do not match and for optionally overriding
server setting default uid/gid of new cifs files and directories.
This cleans up legacy x86 binary support by introducing a new
personality bit: READ_IMPLIES_EXEC, and implements Linus' suggestion to
add the PROT_EXEC bit on the two affected syscall entry places,
sys_mprotect() and sys_mmap(). If this bit is set then PROT_READ will
also add the PROT_EXEC bit - as expected by legacy x86 binaries. The
ELF loader will automatically set this bit when it encounters a legacy
binary.
This approach avoids the problems the previous ->def_flags solution
caused. In particular this patch fixes the PROT_NONE problem in a
cleaner way (http://lkml.org/lkml/2004/7/12/227), and it should fix the
ia64 PROT_EXEC problem reported by David Mosberger. Also,
mprotect(PROT_READ) done by legacy binaries will do the right thing as
well.
the details:
- the personality bit is added to the personality mask upon exec(),
within the ELF loader, but is not cleared (see the exceptions below).
This means that if an environment that already has the bit exec()s a
new-style binary it will still get the old behavior.
- one exception are setuid/setgid binaries: these will reset the
bit - thus local attackers cannot manually set the bit and circumvent
NX protection. Legacy setuid binaries will still get the bit through
the ELF loader. This gives us maximum flexibility in shaping
compatibility environments.
- selinux also clears the bit when switching SIDs via exec().
- x86 is the only arch making use of READ_IMPLIES_EXEC currently. Other
arches will have the pre-NX-patch protection setup they always had.
I have booted an old distro [RH 7.2] and two new PT_GNU_STACK distros
[SuSE 9.2 and FC2] on an NX-capable CPU - they work just fine and all
the mapping details are right. I've checked the PROT_NONE test-utility
as well and it works as expected. I have checked various setuid
scenarios as well involving legacy and new-style binaries.
an improved setarch utility can be used to set the personality bit
manually:
David Eger [Sun, 18 Jul 2004 02:06:48 +0000 (19:06 -0700)]
[PATCH] pmac_zilog: serial minors taken failure path fix
I've tracked down the core issue giving me the oops wrt pmac_zilog.
When you have two serial drivers, (e.g. 8250 and PMAC_ZILOG) they both say
"I want to reserve X ports starting with major TTY_MAJOR and minor 64".
By the time pmac_zilog gets there, the ports it requests are already
reserved. Unfortunately, init_pmz() doesn't check for pmz_register()
failure, and so it merrily goes on to register the half-initialized
pmac_zilog driver with the power management subsystem.
This path provides a proper failure path.
Also:
Restore ppc configs now that I know people use AT Keyboards on CHRP and PReP
machines, and the zilog driver is no longer Oops'ing.
Signed-off-by: David Eger <eger@havoc.gtf.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
[PATCH] Fix i386 bootup with HIGHMEM+SLAB_DEBUG+NUMA and no real
For some reason I booted a NUMA and SLAB_DEBUG i386 kernel on a non
NUMA 512MB machine. This caused an oops at bootup in change_page_attr.
The reason was that highmem_start_start page ended up zero and
that triggered the highmem check in change_page_attr when the
slab debug code would unmap a kernel mapping.
Fix is straightforward: if there is no highmem set highmem_start_page
to max_low_pfn+1
[PATCH] Fix memory corruption at x86-64 SMP bootup
This fixes a long standing corruption bug in the x86-64 code. The SMP
trampoline would corrupt page 2, which was sometimes used for other
data. This corrupted the ioport/iomem list in some cases and causes
oopses while read /proc/iomem.
Fix is to check the correct location and don't zero it afterwards
because it gets reinitialized for the next CPU anyways.
This patch fixes a hard-to-trigger condition, where the inode is on the
inode_in_use list while it's state is dirty. In this state dirty pages are
not written back in sync() or from kupdate, only from direct page reclaim.
And this causes a livelock in balance_dirty_pages after a while.
The actual sequence of events required to get into this state is:
Alexander Viro [Fri, 16 Jul 2004 05:04:13 +0000 (22:04 -0700)]
[PATCH] sparse: beginning of iovec cleanups - infrastructure
Beginning of iovec cleanups - added two helpers (kernel_{send,recv}msg)
that do sock_sendmsg/sock_recvmsg with kvec instead of iovec; basically,
they were abstracted from earlier afs patch. They take kvec/length of
kvec as separate arguments, do set_fs(), stick kvec into msghdr and call
sock_...msg().
The next group of patches will switch network filesystems to use of kvec
for kernel data + use of these helpers. Basically, the same thing we'd
done for afs.
Alexander Viro [Fri, 16 Jul 2004 05:03:51 +0000 (22:03 -0700)]
[PATCH] misc sparse cleanups
- missing ; between default: and } in sun4setup.c
- cast of pointer to unsigned long long instead of unsigned long in
x86_64 signal.c
- missed annotations for ioctl structure in sparc64 openpromio.h
(should've been in the same patch as the rest of drivers/sbus/*
annotations)
- 0->NULL in list.h and pmdisk.c
Daniel McNeil [Fri, 16 Jul 2004 04:52:43 +0000 (21:52 -0700)]
[PATCH] mmap PROT_NONE fix for NX patch
This works around the current PROT_NONE problem from elf binaries that
do not have the PT_GNU_STACK so that the do not have execute permission.
The problem was that setting "def_flags" to include the VM_EXEC bit for
compatibility reasons would also make PROT_NONE pages executable, which
is obviously not correct.
Signed-off-by: Daniel McNeil <daniel@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Pat LaVarre [Fri, 16 Jul 2004 04:17:27 +0000 (21:17 -0700)]
[PATCH] fix cdrom mt rainier probe
Writing to RAM capable media was broken by the moving of write flag
detection from probe to drive open time. The media would stay
terminally RO due to the set_disk_ro() call.
This fixes the code to do the right thing - the detection stays at open
time (which it must, since it depends on the media), and we fail with
-EROFS if the media can't be written.
David Woodhouse [Thu, 15 Jul 2004 13:07:49 +0000 (06:07 -0700)]
[PATCH] ppc32: Fix UART initialisation on WindRiver SBC8560.
The UART tristates its IRQ output when the OUT2 bit in the MCR isn't
set. For reasons not known to civilised man, the hardware engineers
stopped it from floating by pulling it _high_ instead of low, so if
anybody requests that IRQ before OUT2 is turned on, we die in an IRQ
storm. The serial8250 driver does precisely that thing, with precisely
that effect.
ALPHA_KLUDGE_MCR was designed to fix exactly this kind of problem, so we
use it here as intended. Ideally ALPHA_KLUDGE_MCR would go away and be
replaced with something like UPF_FORCE_OUT2 and UPF_FORCE_OUT1 flags,
but now is not the time to get me started on a cleanup of everything
about serial8250 that offends me.
Just unearthed another of my warcrimes: reading a 17-page sparse file,
I mean holey file, hits the in_interrupt panic in do_exit on a current
highmem kernel (but 2.6.7 is okay). Fix mismatched preempt count from
shmem_swp_alloc's swapindex hole case by mapping an empty_zero_page.
David Woodhouse [Thu, 15 Jul 2004 19:32:25 +0000 (20:32 +0100)]
NOR flash drivers update
- Handle cached access to flash chips on supporting platforms
- Handle arrangements of chips larger than a single bus width
- Clean up the AMD/Fujitsu chip driver
- Update board 'mapping' drivers to match
- New mapping drivers for new platforms.
David Woodhouse [Thu, 15 Jul 2004 19:27:17 +0000 (20:27 +0100)]
MTD core include and device code cleanup
- Move user-visible bits from headers to include/mtd/ directory.
- Update old DiskOnChip drivers for newer hardware.
- Switch NFTL and INFTL support to work with new DiskOnChip/NAND code.
- New phram driver, reimplenting the ugly slram driver.
- Bug fixes in partitioning code
David Woodhouse [Thu, 15 Jul 2004 19:11:45 +0000 (20:11 +0100)]
NAND flash driver updates.
Update the core NAND code:
- support multiple chips
- support bad block tables
- improved generic ECC support and 'spare area' usage.
- 16-bit NAND
- Large-block NAND devices
- Renesas AG-AND devices
- M-Systems DiskOnChip devices
- Other new board support wrappers
Most of the work was done by Thomas Gleixner.
Signed-Off-By: David Woodhouse <dwmw2@infradead.org>
[PATCH] CFQ: allocation under lock, missing memset on allocation
This fixes two issues in the CFQ IO-scheduler:
o Still a bad allocation under the queue lock
o We need to clear crq after mempool_alloc(), otherwise the rbtree
pointers can contain garbage if slab poisoning is enabled. This causes
crashes on front/back merges because rb_next() returns crap.