Some time ago ( http://lkml.org/lkml/2007/6/19/128 ) I wrote about
MNT_UNBINDABLE that it felt like a bug that it is not reset by "mount
--make-private".
Today I happened to see mount(8) and Documentation/sharedsubtree.txt and
both document the version obtained by applying the little patch given in
the above (and again below).
So, the present kernel code is not according to specs and must be regarded
as buggy.
Specification in Documentation/sharedsubtree.txt:
See state diagram: unbindable should become private upon make-private.
Specification in mount(8):
... It's
also possible to set up uni-directional propagation (with --make-
slave), to make a mount point unavailable for --bind/--rbind (with
--make-unbindable), and to undo any of these (with --make-private).
David Woodhouse [Wed, 6 Feb 2008 09:36:27 +0000 (01:36 -0800)]
Allow auto-destruction of loop devices
This allows a flag to be set on loop devices so that when they are
closed for the last time, they'll self-destruct.
In general, so that we can automatically allocate loop devices (as with
losetup -f) and have them disappear when we're done with them.
In particular, right now, so that we can stop relying on the hackish
special-case in umount(8) which kills off loop devices which were set up by
'mount -oloop'. That means we can stop putting crap in /etc/mtab which
doesn't belong there, which means it can be a symlink to /proc/mounts, which
means yet another writable file on the root filesystem is eliminated and the
'stateless' folks get happier... and OLPC trac #356 can be closed.
The mount(8) side of that is at
http://marc.info/?l=util-linux-ng&m=119362955431694&w=2
[akpm@linux-foundation.org: coding-style fixes] Signed-off-by: David Woodhouse <dwmw2@infradead.org> Cc: Bernardo Innocenti <bernie@codewiz.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Robin Getz [Wed, 6 Feb 2008 09:36:26 +0000 (01:36 -0800)]
remove support for un-needed _extratext section
When passing a zero address to kallsyms_lookup(), the kernel thought it was
a valid kernel address, even if it is not. This is because is_ksym_addr()
called is_kernel_extratext() and checked against labels that don't exist on
many archs (which default as zero). Since PPC was the only kernel which
defines _extra_text, (in 2005), and no longer needs it, this patch removes
_extra_text support.
For some history (provided by Jon):
http://ozlabs.org/pipermail/linuxppc-dev/2005-September/019734.html
http://ozlabs.org/pipermail/linuxppc-dev/2005-September/019736.html
http://ozlabs.org/pipermail/linuxppc-dev/2005-September/019751.html
[akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Robin Getz <rgetz@blackfin.uclinux.org> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Jon Loeliger <jdl@freescale.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Matt Domsch [Wed, 6 Feb 2008 09:36:24 +0000 (01:36 -0800)]
dcdbas: add DMI-based module autloading
DMI autoload dcdbas on all Dell systems.
This looks for BIOS Vendor or System Vendor == Dell, so this should
work for systems both Dell-branded and those Dell builds but brands
for others. It causes udev to load the dcdbas module at startup,
which is used by tools called by HAL for wireless control and
backlight control, among other uses.
Thanks to Kay Sievers for figuring out how to do this with a single alias.
Signed-off-by: Matt Domsch <Matt_Domsch@dell.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
David Miller [Wed, 6 Feb 2008 09:36:23 +0000 (01:36 -0800)]
Genericizing iova.[ch]
I would like to potentially move the sparc64 IOMMU code over to using
the nice new drivers/pci/iova.[ch] code for free area management..
In order to do that we have to detach the IOMMU page size assumptions
which only really need to exist in the intel-iommu.[ch] code.
This patch attempts to implement that.
[akpm@linux-foundation.org: build fix] Signed-off-by: David S. Miller <davem@davemloft.net> Acked-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Pierre Peiffer [Wed, 6 Feb 2008 09:36:23 +0000 (01:36 -0800)]
IPC: fix error check in all new xxx_lock() and xxx_exit_ns() functions
In the new implementation of the [sem|shm|msg]_lock[_check]() routines, we
use the return value of ipc_lock() in container_of() without any check.
But ipc_lock may return a errcode. The use of this errcode in
container_of() may alter this errcode, and we don't want this.
And in xxx_exit_ns, the pointer return by idr_find is of type 'struct
kern_ipc_per'...
Today, the code will work as is because the member used in these
container_of() is the first member of its container (offset == 0), the
errcode isn't changed then. But in the general case, we can't count on
this assumption and this may lead later to a real bug if we don't correct
this.
Again, the proposed solution is simple and correct. But, as pointed by
Nadia, with this solution, the same check will be done several times (in
all sub-callers...), what is not very funny/optimal...
Signed-off-by: Pierre Peiffer <pierre.peiffer@bull.net> Cc: Nadia Derbey <Nadia.Derbey@bull.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Dmitry Antipov [Wed, 6 Feb 2008 09:36:19 +0000 (01:36 -0800)]
SIGIO-driven I/O with inotify queues
Add SIGIO-driven I/O for descriptors returned by inotify_init(). The thing
may be enabled by convenient fcntl (fd, F_SETFL, O_ASYNC) call.
Signed-off-by: Dmitry Antipov <antipov@dev.rtsoft.ru> Cc: Robert Love <rlove@google.com> Cc: John McCutchan <ttb@tentacle.dhs.org> Cc: Michael Kerrisk <mtk-manpages@gmx.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
ext2 file system was by default ignoring errors and continuing. This is
not a good default as continuing on error could lead to file system
corruption. Change the default to mark the file system readonly. Debian
and ubuntu already does this as the default in their fstab.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Cc: <linux-ext4@vger.kernel.org> Cc: Eric Sandeen <sandeen@redhat.com> Cc: Jan Kara <jack@ucw.cz> Cc: Dave Jones <davej@codemonkey.org.uk> Cc: Chuck Ebbert <cebbert@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This fixes some instances where we were continuing after calling
ext2_error. ext2_error call panic only if errors=panic mount option is
set. So we need to make sure we return correctly after ext2_error call.
Matthew Wilcox [Wed, 6 Feb 2008 09:36:14 +0000 (01:36 -0800)]
hash: add explicit u32 and u64 versions of hash
The 32-bit version is more efficient (and apparently gives better hash
results than the 64-bit version), so users who are only hashing a 32-bit
quantity can now opt to use the 32-bit version explicitly, rather than
promoting to a long.
Signed-off-by: Matthew Wilcox <willy@linux.intel.com> Cc: William Lee Irwin III <wli@holomorphy.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Oleg Nesterov [Wed, 6 Feb 2008 09:36:13 +0000 (01:36 -0800)]
use __set_task_state() for TRACED/STOPPED tasks
1. It is much easier to grep for ->state change if __set_task_state() is used
instead of the direct assignment.
2. ptrace_stop() and handle_group_stop() use set_task_state() which adds the
unneeded mb() (btw even if we use mb() it is still possible that do_wait()
sees the new ->state but not ->exit_code, but this is ok).
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Acked-by: Roland McGrath <roland@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Michael Neuling [Wed, 6 Feb 2008 09:36:12 +0000 (01:36 -0800)]
taskstats scaled time cleanup
This moves the ability to scale cputime into generic code. This allows us
to fix the issue in kernel/timer.c (noticed by Balbir) where we could only
add an unscaled value to the scaled utime/stime.
This adds a cputime_to_scaled function. As before, the POWERPC version
does the scaling based on the last SPURR/PURR ratio calculated. The
generic and s390 (only other arch to implement asm/cputime.h) versions are
both NOPs.
Also moves the SPURR and PURR snapshots closer.
Signed-off-by: Michael Neuling <mikey@neuling.org> Cc: Jay Lan <jlan@engr.sgi.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Garzik [Wed, 6 Feb 2008 09:36:11 +0000 (01:36 -0800)]
riscom8: fix SMP brokenness
After analyzing the elements that save_flags/cli/sti/restore_flags were
protecting, convert their usages to a global spinlock (the easiest and
most obvious next-step). There were some usages of flags being
intentionally cached, because the code already knew the state of
interrupts. These have been taken into account.
This allows us to remove CONFIG_BROKEN_ON_SMP. Completely untested.
[akpm@linux-foundation.org: use DEFINE_SPINLOCK] Signed-off-by: Jeff Garzik <jgarzik@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Yan Zheng [Wed, 6 Feb 2008 09:36:09 +0000 (01:36 -0800)]
A potential bug in inotify_user.c
Following comment is at fs/inotify_user.c:287
/* coalescing: drop this event if it is a dupe of the previous */
I think the previous event in the comment should be the last event in the
link list. But inotify_dev_get_event return the first event in the list.
In addition, it doesn't check whether the list is empty
Signed-off-by: Yan Zheng<yanzheng@21cn.com> Acked-by: Robert Love <rlove@rlove.org> Cc: John McCutchan <ttb@tentacle.dhs.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jan Engelhardt [Wed, 6 Feb 2008 09:36:08 +0000 (01:36 -0800)]
fs/fat/: refine chmod checks
Prohibit mode changes in non-quiet mode that cannot be stored reliably with
the on-disk format.
Suppose a vfat filesystem is mounted with umask=0 and [not-quiet]. Then
all files will have mode 0777. Trying to change the owner will fail,
because fat does not know about owners or groups. chmod 0770, on the other
hand, will succeed, even though fat does not know about the permission
triplet [user/group/other].
So this patch changes fat's not-quiet behavior so that only UNIX modes are
accepted that can be mapped lossless between the fat disk format and the
local system. There is only one attribute, and that is the readonly
attribute, which is mapped to the UNIX write permission bit(s). chmod 0555
is therefore valid (taking away the +w bits <=> setting the readonly
attribute). Since chmod 0775 and chmod 0755 is an ambiguous case as to
whether to set or clear the readonly bit, these modes are also denied.
In quiet mode, chmod and chown will continue to "succeed" as they did
before, meaning that a subsequent stat() will temporarily return the new
mode as long as the inode is not reread from disk, and chown will silently
do nothing, not even return the new uid/gid in stat().
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de> Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Borislav Petkov [Wed, 6 Feb 2008 01:57:54 +0000 (02:57 +0100)]
ide-tape: cleanup the remaining codestyle issues
... thus decreasing checkpatch.pl errors to 0.
Bart:
- remove needless function prototypes while at it
- remove needless parentheses while at it
- add missing KERN_ level to ide_tape_probe()
- other minor fixups
Borislav Petkov [Wed, 6 Feb 2008 01:57:52 +0000 (02:57 +0100)]
ide-tape: struct idetape_tape_t: remove unused members
- last_frame_position: only being written to once
- firmware_revision, product_id, vendor_id: used once, remove from struct
idetape_tape_t and deal with them locally
- firmware_revision_num: only written to once
- tape_still_time_begin: completely unused
- tape_still_time: never written to; remove corresponding code chunk
- uncontrolled_last_pipeline_head: only once written to
- blocks_in_buffer: only written to
Borislav Petkov [Wed, 6 Feb 2008 01:57:52 +0000 (02:57 +0100)]
ide-tape: remove unreachable code chunk
tape->speed_control is set to 1 in idetape_setup(), but, in calculate_speeds()
its value is tested for being 0, 1, or 2. Remove the if-branches where
tape->speed_control != 1 since they are never executed. Also, rename
calculate_speeds() by adding driver's prefix as is with the other function
names.
Borislav Petkov [Wed, 6 Feb 2008 01:57:51 +0000 (02:57 +0100)]
ide-tape: refactor the debug logging facility
Teach the debug logging macro to differentiate between log levels based on the
type of debug level enabled specifically instead of a threshold-based one.
Thus, convert tape->debug_level to a bitmask that is written to over /proc.
Also,
- cleanup and simplify the debug macro thus removing a lot of code lines,
- get rid of unused debug levels,
- adjust the loglevel at several places where it was simply missing (e.g.
idetape_chrdev_open())
- move the tape ptr initialization up in idetape_chrdev_open() so that we can
use it in the debug_log macro earlier in the function.
* Replace incorrect CONFIG_BLK_DEV_IDE #ifdef in
check_media_bay() by CONFIG_MAC_FLOPPY one.
* Replace incorrect CONFIG_BLK_DEV_IDE #ifdef-s by
CONFIG_BLK_DEV_IDE_PMAC ones.
* check_media_bay() is used only by drivers/block/swim3.c
so make this function available only if CONFIG_MAC_FLOPPY
is defined.
* check_media_bay_by_base() and media_bay_set_ide_infos()
are used only by drivers/ide/ppc/pmac.c so so make these
functions available only if CONFIG_MAC_FLOPPY is defined.
v2:
* Remove ifdefs from function prototypes. (Andrew Morton)
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
On Tuesday 05 February 2008, Linus Torvalds wrote:
>
> On Sat, 2 Feb 2008, Bartlomiej Zolnierkiewicz wrote:
> >
> > * next part of IDE probing code re-organization saga
> > Â (that would be me)
>
> This seems to cause very irritating and bogus messages for me:
>
> Â Â Â Â Â Â Probing IDE interface ide0...
> Â Â Â Â Â Â Probing IDE interface ide1...
> Â Â Â Â Â Â ide2: I/O resource 0x0-0x7 not free.
> Â Â Â Â Â Â ide2: ports already in use, skipping probe
> Â Â Â Â Â Â ide3: I/O resource 0x0-0x7 not free.
> Â Â Â Â Â Â ide3: ports already in use, skipping probe
> Â Â Â Â Â Â ide4: I/O resource 0x0-0x7 not free.
> Â Â Â Â Â Â ide4: ports already in use, skipping probe
> Â Â Â Â Â Â ide5: I/O resource 0x0-0x7 not free.
> Â Â Â Â Â Â ide5: ports already in use, skipping probe
> Â Â Â Â Â Â ide6: I/O resource 0x0-0x7 not free.
> Â Â Â Â Â Â ide6: ports already in use, skipping probe
> Â Â Â Â Â Â ide7: I/O resource 0x0-0x7 not free.
> Â Â Â Â Â Â ide7: ports already in use, skipping probe
> Â Â Â Â Â Â ide8: I/O resource 0x0-0x7 not free.
> Â Â Â Â Â Â ide8: ports already in use, skipping probe
> Â Â Â Â Â Â ide9: I/O resource 0x0-0x7 not free.
> Â Â Â Â Â Â ide9: ports already in use, skipping probe
>
> and that's just totally bogus. It shouldn't even request that region,
> since it's not been allocated!
The commit 139ddfcab50e5eabcc88341c8743a990ac1be6a2 ("ide: move handling of
I/O resources out of ide_probe_port()") changed the ordering of hwif->noprobe
check vs ide_hwif_request_regions() call (so that we now reserve I/O regions
before checking for hwif->noprobe). However ide-generic host driver depended
on hwif->noprobe to be set for skipping probing of empty ide_hwifs[] slots.
Fix it by passing only indexes of non-empty slots to ide_device_add_all()
from ide_generic_init().
Hugh Dickins [Tue, 5 Feb 2008 22:26:01 +0000 (22:26 +0000)]
stop c_p_a corrupting the pds
When change_page_attr splits a large page on x86_32 (without PAE), it is
currently corrupting every process's page directory: fix that by removing
the thinko which passes down a physical instead of a virtual address.
Linus Torvalds [Tue, 5 Feb 2008 18:24:52 +0000 (10:24 -0800)]
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6:
[IA64] make pfm_get_task work with virtual pids
[IA64] honor notify_die() returning NOTIFY_STOP
[IA64] remove dead code: __cpu_{down,die} from !HOTPLUG_CPU
[IA64] Appoint kvm/ia64 Maintainers
[IA64] ia64_set_psr should use srlz.i
[IA64] Export three symbols for module use
[IA64] mca style cleanup
[IA64] sn_hwperf semaphore to mutex
[IA64] generalize attribute of fsyscall_gtod_data
[IA64] efi.c Add /* never reached */ annotation
[IA64] efi.c Spelling/punctuation fixes
[IA64] Make efi.c mostly fit in 80 columns
[IA64] aliasing-test: fix gcc warnings on non-ia64
[IA64] Slim-down __clear_bit_unlock
[IA64] Fix the order of atomic operations in restore_previous_kprobes on ia64
[IA64] constify function pointer tables
[IA64] fix userspace compile error in gcc_intrin.h
Linus Torvalds [Tue, 5 Feb 2008 18:11:02 +0000 (10:11 -0800)]
Merge branch 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6
* 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6:
[S390] dcss: Initialize workqueue before using it.
[S390] Remove BUILD_BUG_ON() in vmem code.
[S390] sclp_tty/sclp_vt220: Fix scheduling while atomic
[S390] dasd: fix panic caused by alias device offline
[S390] dasd: add ifcc handling
[S390] latencytop s390 support.
[S390] Implement ext2_find_next_bit.
[S390] Cleanup & optimize bitops.
[S390] Define GENERIC_LOCKBREAK.
[S390] console: allow vt220 console to be the only console
[S390] Fix couple of section mismatches.
[S390] Fix smp_call_function_mask semantics.
[S390] Fix linker script.
[S390] DEBUG_PAGEALLOC support for s390.
[S390] cio: Add shutdown callback for ccwgroup.
[S390] cio: Update documentation.
[S390] cio: Clean up chsc response code handling.
[S390] cio: make sense id procedure work with partial hardware response
Linus Torvalds [Tue, 5 Feb 2008 17:54:10 +0000 (09:54 -0800)]
Merge branch 'agp-patches' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/agp-2.6
* 'agp-patches' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/agp-2.6:
agp: remove flush_agp_mappings calls from new flush handling code
intel-agp: introduce IS_I915 and do some cleanups..
[intel_agp] fix name for G35 chipset
intel-agp: fixup resource handling in flush code.
intel-agp: add new chipset ID
agp: remove unnecessary pci_dev_put
agp: remove uid comparison as security check
fix AGP warning
agp/intel: Add chipset flushing support for i8xx chipsets.
intel-agp: add chipset flushing support
agp: add chipset flushing support to AGP interface
Linus Torvalds [Tue, 5 Feb 2008 17:52:46 +0000 (09:52 -0800)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband:
RDMA/nes: Add a driver for NetEffect RNICs
IB/mthca: Return proper error codes from mthca_fmr_alloc()
IB: Avoid marking __devinitdata as const
IB/mlx4: Actually print out the driver version
IB/ib_mthca: Pre-link receive WQEs in Tavor mode
IB/mthca: Remove checks for srq->first_free < 0
IB/fmr_pool: Allocate page list for pool FMRs only when caching enabled
IB/srp: Retry stale connections
mlx4_core: Don't read reserved fields in mlx4_QUERY_ADAPTER()
IB/mthca: Don't read reserved fields in mthca_QUERY_ADAPTER()
IPoIB: Remove a misleading debug print
IPoIB: Handle bonding failover race for connected neighbours too
IB/mthca: Fix and simplify page size calculation in mthca_reg_phys_mr()
IB/ehca: Add PMA support
IB/ehca: Update sma_attr also in case of disruptive config change
IB/ehca: Prevent sending UD packets to QP0
IB/cm: Add interim support for routed paths
mlx4_core: Fix more section mismatches
Jeff Dike [Tue, 5 Feb 2008 06:31:29 +0000 (22:31 -0800)]
uml: make mconsole_stack namespace-aware
Also fixed the include syntax while I was there.
Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:29 +0000 (22:31 -0800)]
uml: redo the calculation of NR_syscalls
Redo the calculation of NR_syscalls since that disappeared from i386 and
use a similar mechanism on x86_64.
We now figure out the size of the system call table in arch code and stick
that in syscall_table_size. arch/um/kernel/skas/syscall.c defines
NR_syscalls in terms of that since its the only thing that needs to know
how many system calls there are.
The old mechananism that was used on x86_64 is gone.
arch/um/include/sysdep-i386/syscalls.h got some formatting since I was
looking at it.
Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:28 +0000 (22:31 -0800)]
uml: defconfig tweaks
Tweak the UML defconfig -
we probably don't need 256 old-style ptys - this slows down udev
noticably
enable hostfs
disable slab debugging - another noticable performance hit
Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Daniel Walker [Tue, 5 Feb 2008 06:31:27 +0000 (22:31 -0800)]
uml: port mutex conversion
The port_sem is already used as a mutex since it's using DECLARE_MUTEX(), but
the underlying construct is still a semaphore .. This patch switches it over
to a struct mutex.
Signed-off-by: Daniel Walker <dwalker@mvista.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Daniel Walker [Tue, 5 Feb 2008 06:31:27 +0000 (22:31 -0800)]
uml: mconsole mutex conversion
The plug_mem_mutex is already used as a mutex since it's using
DECLARE_MUTEX(), but the underlying construct is still a semaphore .. This
patch switches it over to a struct mutex.
Signed-off-by: Daniel Walker <dwalker@mvista.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Daniel Walker [Tue, 5 Feb 2008 06:31:26 +0000 (22:31 -0800)]
uml: LDT mutex conversion
The ldt.semaphore conforms to the new struct mutex requirments, so I converted
it to use the new API and changed the name.
Signed-off-by: Daniel Walker <dwalker@mvista.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:25 +0000 (22:31 -0800)]
uml: use of a public MAC is a warning, not an error
Downgrade one of the MAC validity checks. If it's one that could be possibly
assigned to a physical NIC, then nothing will break. So, emit a warning in
this case, but keep the requested MAC.
Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This patch takes care of a problem with the stopping code.
The function inside the while condition returns 0 to signify a problem. A
problem could be for example a bad command or a bad version of the mconsole
client. A bad command would terminate the stopping loop and resume the
kernel. This is a problem.
A better solution is to make the loop infinite and don't leave it until we are
explicitly told to.
Signed-off-by: Karol Swietlicki <magotari@gmail.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:24 +0000 (22:31 -0800)]
uml: remove map_cb
John Reiser noticed that a physical memory region was being mapped twice.
This patch fixes that, and it inlines the responsible function, as that had
only one caller.
Cc: John Reiser <jreiser@BitWagon.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
WANG Cong [Tue, 5 Feb 2008 06:31:23 +0000 (22:31 -0800)]
uml: remove TOPDIR
TOPDIR is obsolete, use srctree instead. This patch removes TOPDIR from all
UML Makefiles.
Cc: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:22 +0000 (22:31 -0800)]
uml: remove unused fields from mm_context
The 3-level page table fixes forgot to remove a couple now-unused fields from
struct mm_context.
Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:22 +0000 (22:31 -0800)]
uml: move register initialization
Calling init_registers inside the skas3 checking causes mysterious crashes if
it doesn't happen because the skas3 checking is bypassed. This patch moves it
to os_early_checks.
Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:21 +0000 (22:31 -0800)]
uml: add newlines to printks
Some printks were missing newlines.
Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:20 +0000 (22:31 -0800)]
uml: style fixes in arch/um/sys-x86_64
Style fixes in arch/um/sys-x86_64:
updated copyrights
CodingStyle fixes
added severities to printks which needed them
A bunch of functions in sys-*/ptrace_user.c turn out to be unused, so they and
their declarations are gone.
Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:19 +0000 (22:31 -0800)]
uml: add back CONFIG_HZ
avoid-overflows-in-kernel-timec.patch makes CONFIG_HZ necessary for a
successful build. UML lacks a definition, so this patch adds one. It also
changes the hard-wired definition of HZ to CONFIG_HZ.
Note: this patch is a good idea even in the absence of hpa's time fixes.
Cc: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:19 +0000 (22:31 -0800)]
uml: DEBUG_SHIRQ fixes
A couple more DEBUG_SHIRQ fixes.
The previous mconsole blocking fix exposed the lack of O_NONBLOCK on the
mconsole socket.
Also, winch_interrupt started crashing because it is called at irq free time
and it tries to dereference tty->driver_data, which has already been set to
NULL.
I added some error cleanup in mconsole_init while I was there.
Cc: "Karol Swietlicki" <magotari@gmail.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:18 +0000 (22:31 -0800)]
uml: remove fakehd
The fakehd switch lost its implementation at some point. Since no one is
screaming for it, we might as well remove it.
Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:18 +0000 (22:31 -0800)]
uml: implement O_APPEND
The .a flags in openflags never had an implementation.
Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:17 +0000 (22:31 -0800)]
uml: SMP locking commentary
Add some more commentary about various pieces of global data not needing
locking.
Also got rid of unmap_physmem since that is no longer used.
Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:16 +0000 (22:31 -0800)]
uml: remove init_irq_signals
init_irq_signals doesn't need to be called from the context of a new process.
It initializes handlers, which are useless in process context. With that call
gone, init_irq_signals has only one caller, so it can be inlined into
init_new_thread_signals.
Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:16 +0000 (22:31 -0800)]
uml: signal handling tidying
This patch tidies the signal handling code slightly.
pending is renamed to signals_pending for symmetry with signals_enabled.
remove_sigstack was unused, so can be deleted.
The value of change_sig was never used, so it is now void and the
return value is not calculated any more.
Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:14 +0000 (22:31 -0800)]
uml: style fixes in arch/um/kernel
Joe Perches noticed some printks in smp.c that needed fixing.
While I was in there, I did the usual tidying in arch/um/kernel, which
should be fairly style-clean at this point:
copyright updates
emacs formatting comments removal
include tidying
style fixes
Cc: Joe Perches <joe@perches.com> Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:13 +0000 (22:31 -0800)]
uml: clean up sig_handler_common_skas
sig_handler_common_skas needs significant modernization, starting with
its name and storage class.
There is no need to hide the true type of the sigcontext pointer, so
the void * dummy parameter can be replaced with a sigcontext *sc.
The array of uml_pt_regs structs used in the page fault case are gone,
replaced by a local variable. This is also used in the non-segfault
case instead of the copy in the task_struct. Since it's local, the
special handling of the is_user flag can go away.
There hasn't been any special treatment of SIGUSR1 in ages, so the
line that enables it can be deleted.
The special treatment of SIGSEGV similarly goes away, but to
compensate, SA_NODEFER is added to sa_mask when registering a signal
handler.
Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:12 +0000 (22:31 -0800)]
uml: move sig_handler_common_skas
This patch moves sig_handler_common_skas from
arch/um/os-Linux/skas/trap.c to its only caller in
arch/um/os-Linux/signal.c. trap.c is now empty, so it can be removed.
This is code movement only - the significant cleanup needed here is
done in the next patch.
Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:12 +0000 (22:31 -0800)]
uml: don't allow processes to call into stub
Kill a process that tries to branch into a stub and execute a system
call. There are no security implications here - a system call in a
stub is treated the same as a system call anywhere else. But if a
process is trying to branch into a stub, either it is trying something
nasty or it has gone haywire, so it's a good idea to get rid of it in
either case.
Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:11 +0000 (22:31 -0800)]
uml: get rid of syscall counters
Get rid of some syscall counters which haven't been useful in ages.
Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:10 +0000 (22:31 -0800)]
uml: don't kill pid 0
A bit of defensive programming - during development, it ocassionally
happens that a call to init_new_context is missed, resulting in
context holding a host pid of zero. When that address space is torn
down, destroy_context does a kill(0), which instantly kills the whole
UML without any errors whatsoever.
This patch add a check for pids less than 2, to also catch 1 and
negative pids.
Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:10 +0000 (22:31 -0800)]
uml: tidy helper code
Style fixes to arch/um/os/helper.c and tidying up the breakpoint fix a
bit.
helper.c gets all the usual style fixes -
updated copyright
all printks get severities
Also -
errval changes to err in helper_child
fixed an obsolete comment
run_helper was killing a child process which is guaranteed to
be dead or dying anyway
Removed the nohang and pname arguments from helper_wait and fixed the
declaration and callers. nohang was used only in the slirp driver and
I don't think it was needed. I think pname was a bit of overkill in
putting out an error message when something goes wrong.
Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Dike [Tue, 5 Feb 2008 06:31:09 +0000 (22:31 -0800)]
uml: use barrier() instead of mb()
signals_enabled and pending have requirements on the order in which they are
modified. This used to be done by declaring them volatile and putting an mb()
where the ordering requirements were in effect.
After getting a better (I hope) understanding of how to do this correctly, the
volatile declarations are gone and the mb()'s replaced by barrier()'s.
One of the mb()'s was deleted because I see no problematic writes that could
be re-ordered past that point.
Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>