Merge branch 'master' into next
authorJames Morris <jmorris@namei.org>
Fri, 6 Feb 2009 00:01:45 +0000 (11:01 +1100)
committerJames Morris <jmorris@namei.org>
Fri, 6 Feb 2009 00:01:45 +0000 (11:01 +1100)
Conflicts:
fs/namei.c

Manually merged per:

diff --cc fs/namei.c
index 734f2b5,bbc15c2..0000000
--- a/fs/namei.c
+++ b/fs/namei.c
@@@ -860,9 -848,8 +849,10 @@@ static int __link_path_walk(const char
   nd->flags |= LOOKUP_CONTINUE;
   err = exec_permission_lite(inode);
   if (err == -EAGAIN)
-  err = vfs_permission(nd, MAY_EXEC);
+  err = inode_permission(nd->path.dentry->d_inode,
+         MAY_EXEC);
 + if (!err)
 + err = ima_path_check(&nd->path, MAY_EXEC);
    if (err)
   break;

@@@ -1525,14 -1506,9 +1509,14 @@@ int may_open(struct path *path, int acc
   flag &= ~O_TRUNC;
   }

-  error = vfs_permission(nd, acc_mode);
+  error = inode_permission(inode, acc_mode);
   if (error)
   return error;
 +
-  error = ima_path_check(&nd->path,
++ error = ima_path_check(path,
 +        acc_mode & (MAY_READ | MAY_WRITE | MAY_EXEC));
 + if (error)
 + return error;
   /*
    * An append-only file must be opened in append mode for writing.
    */

Signed-off-by: James Morris <jmorris@namei.org>
12 files changed:
1  2 
Documentation/kernel-parameters.txt
MAINTAINERS
fs/exec.c
fs/file_table.c
fs/inode.c
fs/namei.c
include/linux/audit.h
ipc/shm.c
mm/mmap.c
mm/shmem.c
security/Kconfig
security/inode.c

@@@ -44,7 -44,6 +44,7 @@@ parameter is applicable
        FB      The frame buffer device is enabled.
        HW      Appropriate hardware is enabled.
        IA-64   IA-64 architecture is enabled.
 +      IMA     Integrity measurement architecture is enabled.
        IOSCHED More than one I/O scheduler is enabled.
        IP_PNP  IP DHCP, BOOTP, or RARP is enabled.
        ISAPNP  ISA PnP code is enabled.
@@@ -92,6 -91,7 +92,7 @@@
        SUSPEND System suspend states are enabled.
        FTRACE  Function tracing enabled.
        TS      Appropriate touchscreen support is enabled.
+       UMS     USB Mass Storage support is enabled.
        USB     USB support is enabled.
        USBHID  USB Human Interface Device support is enabled.
        V4L     Video For Linux support is enabled.
@@@ -141,6 -141,7 +142,7 @@@ and is between 256 and 4096 characters
                        ht -- run only enough ACPI to enable Hyper Threading
                        strict -- Be less tolerant of platforms that are not
                                strictly ACPI specification compliant.
+                       rsdt -- prefer RSDT over (default) XSDT
  
                        See also Documentation/power/pm.txt, pci=noacpi
  
                        default: 0
  
        acpi_sleep=     [HW,ACPI] Sleep options
-                       Format: { s3_bios, s3_mode, s3_beep, s4_nohwsig, old_ordering }
-                       See Documentation/power/video.txt for s3_bios and s3_mode.
+                       Format: { s3_bios, s3_mode, s3_beep, s4_nohwsig,
+                                 old_ordering, s4_nonvs }
+                       See Documentation/power/video.txt for information on
+                       s3_bios and s3_mode.
                        s3_beep is for debugging; it makes the PC's speaker beep
                        as soon as the kernel's real-mode entry point is called.
                        s4_nohwsig prevents ACPI hardware signature from being
                        used during resume from hibernation.
                        old_ordering causes the ACPI 1.0 ordering of the _PTS
-                       control method, wrt putting devices into low power
-                       states, to be enforced (the ACPI 2.0 ordering of _PTS is
-                       used by default).
+                       control method, with respect to putting devices into
+                       low power states, to be enforced (the ACPI 2.0 ordering
+                       of _PTS is used by default).
+                       s4_nonvs prevents the kernel from saving/restoring the
+                       ACPI NVS memory during hibernation.
  
        acpi_sci=       [HW,ACPI] ACPI System Control Interrupt trigger mode
                        Format: { level | edge | high | low }
        acpi_skip_timer_override [HW,ACPI]
                        Recognize and ignore IRQ0/pin2 Interrupt Override.
                        For broken nForce2 BIOS resulting in XT-PIC timer.
-       acpi_use_timer_override [HW,ACPI}
+       acpi_use_timer_override [HW,ACPI]
                        Use timer override. For some broken Nvidia NF5 boards
                        that require a timer override, but don't have
                        HPET
  
        clearcpuid=BITNUM [X86]
                        Disable CPUID feature X for the kernel. See
-                       include/asm-x86/cpufeature.h for the valid bit numbers.
-                       Note the Linux specific bits are not necessarily
+                       arch/x86/include/asm/cpufeature.h for the valid bit
+                       numbers. Note the Linux specific bits are not necessarily
                        stable over kernel options, but the vendor specific
                        ones should be.
                        Also note that user programs calling CPUID directly
                        not work reliably with all consoles, but is known
                        to work with serial and VGA consoles.
  
+       coredump_filter=
+                       [KNL] Change the default value for
+                       /proc/<pid>/coredump_filter.
+                       See also Documentation/filesystems/proc.txt.
        cpcihp_generic= [HW,PCI] Generic port I/O CompactPCI driver
                        Format:
                        <first_slot>,<last_slot>,<port>,<enum_bit>[,<debug>]
                        a memory unit (amount[KMG]). See also
                        Documentation/kdump/kdump.txt for a example.
  
-       cs4232=         [HW,OSS]
-                       Format: <io>,<irq>,<dma>,<dma2>,<mpuio>,<mpuirq>
        cs89x0_dma=     [HW,NET]
                        Format: <dma>
  
                        Default value is 0.
                        Value can be changed at runtime via /selinux/enforce.
  
-       es1371=         [HW,OSS]
-                       Format: <spdif>,[<nomix>,[<amplifier>]]
-                       See also header of sound/oss/es1371.c.
        ether=          [HW,NET] Ethernet cards parameters
                        This option is obsoleted by the "netdev=" option, which
                        has equivalent usage. See its documentation for details.
  
        hlt             [BUGS=ARM,SH]
  
-       hvc_iucv=       [S390] Number of z/VM IUCV Hypervisor console (HVC)
-                              back-ends. Valid parameters: 0..8
+       hvc_iucv=       [S390] Number of z/VM IUCV hypervisor console (HVC)
+                              terminal devices. Valid values: 0..8
  
        i8042.debug     [HW] Toggle i8042 debug mode
        i8042.direct    [HW] Put keyboard port into non-translated mode
                        See Documentation/ide/ide.txt.
  
        idle=           [X86]
-                       Format: idle=poll or idle=mwait, idle=halt, idle=nomwait
-                       Poll forces a polling idle loop that can slightly improves the performance
-                       of waking up a idle CPU, but will use a lot of power and make the system
-                       run hot. Not recommended.
-                       idle=mwait. On systems which support MONITOR/MWAIT but the kernel chose
-                       to not use it because it doesn't save as much power as a normal idle
-                       loop use the MONITOR/MWAIT idle loop anyways. Performance should be the same
-                       as idle=poll.
-                       idle=halt. Halt is forced to be used for CPU idle.
+                       Format: idle=poll, idle=mwait, idle=halt, idle=nomwait
+                       Poll forces a polling idle loop that can slightly
+                       improve the performance of waking up a idle CPU, but
+                       will use a lot of power and make the system run hot.
+                       Not recommended.
+                       idle=mwait: On systems which support MONITOR/MWAIT but
+                       the kernel chose to not use it because it doesn't save
+                       as much power as a normal idle loop, use the
+                       MONITOR/MWAIT idle loop anyways. Performance should be
+                       the same as idle=poll.
+                       idle=halt: Halt is forced to be used for CPU idle.
                        In such case C2/C3 won't be used again.
-                       idle=nomwait. Disable mwait for CPU C-states
+                       idle=nomwait: Disable mwait for CPU C-states
  
        ide-pci-generic.all-generic-ide [HW] (E)IDE subsystem
                        Claim all unknown PCI IDE storage controllers.
        ihash_entries=  [KNL]
                        Set number of hash buckets for inode cache.
  
 +      ima_audit=      [IMA]
 +                      Format: { "0" | "1" }
 +                      0 -- integrity auditing messages. (Default)
 +                      1 -- enable informational integrity auditing messages.
 +
 +      ima_hash=       [IMA]
 +                      Formt: { "sha1" | "md5" }
 +                      default: "sha1"
 +
        in2000=         [HW,SCSI]
                        See header of drivers/scsi/in2000.c.
  
  
        inttest=        [IA64]
  
+       iomem=          Disable strict checking of access to MMIO memory
+               strict  regions from userspace.
+               relaxed
        iommu=          [x86]
                off
                force
        lapic           [X86-32,APIC] Enable the local APIC even if BIOS
                        disabled it.
  
-       lapic_timer_c2_ok       [X86-32,x86-64,APIC] trust the local apic timer in
-                       C2 power state.
+       lapic_timer_c2_ok       [X86-32,x86-64,APIC] trust the local apic timer
+                       in C2 power state.
  
        libata.dma=     [LIBATA] DMA control
                        libata.dma=0      Disable all PATA and SATA DMA
                        If there are multiple matching configurations changing
                        the same attribute, the last one is used.
  
+       lmb=debug       [KNL] Enable lmb debug messages.
        load_ramdisk=   [RAM] List of ramdisks to load from floppy
                        See Documentation/blockdev/ramdisk.txt.
  
  
        nosoftlockup    [KNL] Disable the soft-lockup detector.
  
+       noswapaccount   [KNL] Disable accounting of swap in memory resource
+                       controller. (See Documentation/controllers/memory.txt)
        nosync          [HW,M68K] Disables sync negotiation for all devices.
  
        notsc           [BUGS=X86-32] Disable Time Stamp Counter
  
        nr_uarts=       [SERIAL] maximum number of UARTs to be registered.
  
+       ohci1394_dma=early      [HW] enable debugging via the ohci1394 driver.
+                       See Documentation/debugging-via-ohci1394.txt for more
+                       info.
        olpc_ec_timeout= [OLPC] ms delay when issuing EC commands
                        Rather than timing out after 20 ms if an EC
                        command is not properly ACKed, override the length
                        autoconfiguration.
                        Ranges are in pairs (memory base and size).
  
-       dynamic_printk
-                       Enables pr_debug()/dev_dbg() calls if
-                       CONFIG_DYNAMIC_PRINTK_DEBUG has been enabled. These can also
-                       be switched on/off via <debugfs>/dynamic_printk/modules
+       dynamic_printk  Enables pr_debug()/dev_dbg() calls if
+                       CONFIG_DYNAMIC_PRINTK_DEBUG has been enabled.
+                       These can also be switched on/off via
+                       <debugfs>/dynamic_printk/modules
  
        print-fatal-signals=
                        [KNL] debug: print fatal signals
  
        reboot=         [BUGS=X86-32,BUGS=ARM,BUGS=IA-64] Rebooting mode
                        Format: <reboot_mode>[,<reboot_mode2>[,...]]
-                       See arch/*/kernel/reboot.c or arch/*/kernel/process.c                   
+                       See arch/*/kernel/reboot.c or arch/*/kernel/process.c
  
        relax_domain_level=
                        [KNL, SMP] Set scheduler's default relax_domain_level.
  
        thermal.psv=    [HW,ACPI]
                        -1: disable all passive trip points
-                       <degrees C>: override all passive trip points to this value
+                       <degrees C>: override all passive trip points to this
+                       value
  
        thermal.tzp=    [HW,ACPI]
                        Specify global default ACPI thermal zone polling rate
        usbhid.mousepoll=
                        [USBHID] The interval which mice are to be polled at.
  
+       usb-storage.delay_use=
+                       [UMS] The delay in seconds before a new device is
+                       scanned for Logical Units (default 5).
+       usb-storage.quirks=
+                       [UMS] A list of quirks entries to supplement or
+                       override the built-in unusual_devs list.  List
+                       entries are separated by commas.  Each entry has
+                       the form VID:PID:Flags where VID and PID are Vendor
+                       and Product ID values (4-digit hex numbers) and
+                       Flags is a set of characters, each corresponding
+                       to a common usb-storage quirk flag as follows:
+                               a = SANE_SENSE (collect more than 18 bytes
+                                       of sense data);
+                               c = FIX_CAPACITY (decrease the reported
+                                       device capacity by one sector);
+                               h = CAPACITY_HEURISTICS (decrease the
+                                       reported device capacity by one
+                                       sector if the number is odd);
+                               i = IGNORE_DEVICE (don't bind to this
+                                       device);
+                               l = NOT_LOCKABLE (don't try to lock and
+                                       unlock ejectable media);
+                               m = MAX_SECTORS_64 (don't transfer more
+                                       than 64 sectors = 32 KB at a time);
+                               o = CAPACITY_OK (accept the capacity
+                                       reported by the device);
+                               r = IGNORE_RESIDUE (the device reports
+                                       bogus residue values);
+                               s = SINGLE_LUN (the device has only one
+                                       Logical Unit);
+                               w = NO_WP_DETECT (don't test whether the
+                                       medium is write-protected).
+                       Example: quirks=0419:aaf5:rl,0421:0433:rc
        add_efi_memmap  [EFI; x86-32,X86-64] Include EFI memory map in
                        kernel's map of available physical RAM.
  
                        Format:
                        <irq>,<irq_mask>,<io>,<full_duplex>,<do_sound>,<lockup_hack>[,<irq2>[,<irq3>[,<irq4>]]]
  
-       norandmaps      Don't use address space randomization
-                       Equivalent to echo 0 > /proc/sys/kernel/randomize_va_space
+       norandmaps      Don't use address space randomization.  Equivalent to
+                       echo 0 > /proc/sys/kernel/randomize_va_space
  
  ______________________________________________________________________
  
diff --combined MAINTAINERS
@@@ -616,7 -616,7 +616,7 @@@ M: mkpetch@internode.on.ne
  S:    Maintained
  
  ARM/TOSA MACHINE SUPPORT
- P:    Dmitry Baryshkov
+ P:    Dmitry Eremin-Solenikov
  M:    dbaryshkov@gmail.com
  P:    Dirk Opfer
  M:    dirk@opfer-online.de
@@@ -911,7 -911,7 +911,7 @@@ S: Maintaine
  BLACKFIN ARCHITECTURE
  P:    Bryan Wu
  M:    cooloney@kernel.org
- L:    uclinux-dist-devel@blackfin.uclinux.org (subscribers-only)
+ L:    uclinux-dist-devel@blackfin.uclinux.org
  W:    http://blackfin.uclinux.org
  S:    Supported
  
@@@ -1024,16 -1024,17 +1024,17 @@@ S:   Maintaine
  BTTV VIDEO4LINUX DRIVER
  P:    Mauro Carvalho Chehab
  M:    mchehab@infradead.org
M:    v4l-dvb-maintainer@linuxtv.org
L:    linux-media@vger.kernel.org
  L:    video4linux-list@redhat.com
  W:    http://linuxtv.org
- T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git
+ T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
  S:    Maintained
  
  CAFE CMOS INTEGRATED CAMERA CONTROLLER DRIVER
  P:    Jonathan Corbet
  M:    corbet@lwn.net
- L:    video4linux-list@redhat.com
+ L:    linux-media@vger.kernel.org
+ T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
  S:    Maintained
  
  CALGARY x86-64 IOMMU
@@@ -1092,11 -1093,8 +1093,8 @@@ S:     Maintaine
  
  CHECKPATCH
  P:    Andy Whitcroft
- M:    apw@shadowen.org
- P:    Randy Dunlap
- M:    rdunlap@xenotime.net
- P:    Joel Schopp
- M:    jschopp@austin.ibm.com
+ M:    apw@canonical.com
+ L:    linux-kernel@vger.kernel.org
  S:    Supported
  
  CISCO 10G ETHERNET DRIVER
@@@ -1264,7 -1262,8 +1262,8 @@@ P:      Hans Verkuil, Andy Wall
  M:    hverkuil@xs4all.nl, awalls@radix.net
  L:    ivtv-devel@ivtvdriver.org
  L:    ivtv-users@ivtvdriver.org
- L:    video4linux-list@redhat.com
+ L:    linux-media@vger.kernel.org
+ T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
  W:    http://linuxtv.org
  S:    Maintained
  
@@@ -1361,6 -1360,11 +1360,11 @@@ P:    Maciej W. Rozyck
  M:    macro@linux-mips.org
  S:    Maintained
  
+ DELL LAPTOP DRIVER
+ P:    Matthew Garrett
+ M:    mjg59@srcf.ucam.org
+ S:    Maintained
  DELL LAPTOP SMM DRIVER
  P:    Massimo Dal Zotto
  M:    dz@debian.org
@@@ -1490,10 -1494,10 +1494,10 @@@ S:   Maintaine
  
  DVB SUBSYSTEM AND DRIVERS
  P:    LinuxTV.org Project
- M:    v4l-dvb-maintainer@linuxtv.org
+ M:    linux-media@vger.kernel.org
  L:    linux-dvb@linuxtv.org (subscription required)
  W:    http://linuxtv.org/
- T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git
+ T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
  S:    Maintained
  
  DZ DECSTATION DZ11 SERIAL DRIVER
@@@ -1577,6 -1581,13 +1581,13 @@@ L:    bluesmoke-devel@lists.sourceforge.ne
  W:    bluesmoke.sourceforge.net
  S:    Maintained
  
+ EDAC-I5400
+ P:    Mauro Carvalho Chehab
+ M:    mchehab@redhat.com
+ L:    bluesmoke-devel@lists.sourceforge.net
+ W:    bluesmoke.sourceforge.net
+ S:    Maintained
  EDAC-I82975X
  P:    Ranganathan Desikan
  P:    Arvind R.
@@@ -1810,6 -1821,14 +1821,14 @@@ M:    hch@infradead.or
  W:    ftp://ftp.openlinux.org/pub/people/hch/vxfs
  S:    Maintained
  
+ FREEZER
+ P:    Pavel Machek
+ M:    pavel@suse.cz
+ P:    Rafael J. Wysocki
+ M:    rjw@sisk.pl
+ L:    linux-pm@lists.linux-foundation.org
+ S:    Supported
  FTRACE
  P:    Steven Rostedt
  M:    rostedt@goodmis.org
@@@ -1885,32 -1904,37 +1904,37 @@@ S:   Maintaine
  GSPCA FINEPIX SUBDRIVER
  P:    Frank Zago
  M:    frank@zago.net
- L:    video4linux-list@redhat.com
+ L:    linux-media@vger.kernel.org
+ T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
  S:    Maintained
  
  GSPCA M5602 SUBDRIVER
  P:    Erik Andren
  M:    erik.andren@gmail.com
- L:    video4linux-list@redhat.com
+ L:    linux-media@vger.kernel.org
+ T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
  S:    Maintained
  
  GSPCA PAC207 SONIXB SUBDRIVER
  P:    Hans de Goede
  M:    hdegoede@redhat.com
- L:    video4linux-list@redhat.com
+ L:    linux-media@vger.kernel.org
+ T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
  S:    Maintained
  
  GSPCA T613 SUBDRIVER
  P:    Leandro Costantino
  M:    lcostantino@gmail.com
- L:    video4linux-list@redhat.com
+ L:    linux-media@vger.kernel.org
+ T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
  S:    Maintained
  
  GSPCA USB WEBCAM DRIVER
  P:    Jean-Francois Moine
  M:    moinejf@free.fr
  W:    http://moinejf.free.fr
- L:    video4linux-list@redhat.com
+ L:    linux-media@vger.kernel.org
+ T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
  S:    Maintained
  
  HARDWARE MONITORING
@@@ -2049,6 -2073,12 +2073,12 @@@ M:    mikulas@artax.karlin.mff.cuni.c
  W:    http://artax.karlin.mff.cuni.cz/~mikulas/vyplody/hpfs/index-e.cgi
  S:    Maintained
  
+ HSO   3G Modem Driver (hso.c)
+ P:    Denis Joseph Barrow
+ M:    d.barow@option.com
+ W:    http://www.pharscape.org
+ S:    Maintained
  HTCPEN TOUCHSCREEN DRIVER
  P:    Pau Oliva Fora
  M:    pof@eslack.org
@@@ -2072,7 -2102,8 +2102,8 @@@ M:      khali@linux-fr.or
  P:    Ben Dooks (embedded platforms)
  M:    ben-linux@fluff.org
  L:    linux-i2c@vger.kernel.org
- T:    quilt http://khali.linux-fr.org/devel/linux-2.6/jdelvare-i2c/
+ W:    http://i2c.wiki.kernel.org/
+ T:    quilt kernel.org/pub/linux/kernel/people/jdelvare/linux-2.6/jdelvare-i2c/
  S:    Maintained
  
  I2C-TINY-USB DRIVER
@@@ -2146,11 -2177,6 +2177,6 @@@ M:     Gadi Oxman <gadio@netvision.net.il
  L:    linux-kernel@vger.kernel.org
  S:    Maintained
  
- IDE-SCSI DRIVER
- L:    linux-ide@vger.kernel.org
- L:    linux-scsi@vger.kernel.org
- S:    Orphan
  IDLE-I7300
  P:    Andy Henroid
  M:    andrew.d.henroid@intel.com
@@@ -2175,11 -2201,6 +2201,11 @@@ M:    stefanr@s5r6.in-berlin.d
  L:    linux1394-devel@lists.sourceforge.net
  S:    Maintained
  
 +INTEGRITY MEASUREMENT ARCHITECTURE (IMA)
 +P:    Mimi Zohar
 +M:    zohar@us.ibm.com
 +S:    Supported
 +
  IMS TWINTURBO FRAMEBUFFER DRIVER
  L:    linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
  S:    Orphan
@@@ -2191,7 -2212,7 +2217,7 @@@ P:      Sean Heft
  M:    sean.hefty@intel.com
  P:    Hal Rosenstock
  M:    hal.rosenstock@gmail.com
- L:    general@lists.openfabrics.org
+ L:    general@lists.openfabrics.org (moderated for non-subscribers)
  W:    http://www.openib.org/
  T:    git kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git
  S:    Supported
@@@ -2312,6 -2333,14 +2338,14 @@@ W:    http://lists.sourceforge.net/mailman
  W:    http://ipw2200.sourceforge.net
  S:    Supported
  
+ INTEL WIRELESS WIMAX CONNECTION 2400
+ P:    Inaky Perez-Gonzalez
+ M:    inaky.perez-gonzalez@intel.com
+ M:    linux-wimax@intel.com
+ L:    wimax@linuxwimax.org
+ S:    Supported
+ W:    http://linuxwimax.org
  INTEL WIRELESS WIFI LINK (iwlwifi)
  P:    Zhu Yi
  M:    yi.zhu@intel.com
@@@ -2436,7 -2465,8 +2470,8 @@@ P:      Hans Verkui
  M:    hverkuil@xs4all.nl
  L:    ivtv-devel@ivtvdriver.org
  L:    ivtv-users@ivtvdriver.org
- L:    video4linux-list@redhat.com
+ L:    linux-media@vger.kernel.org
+ T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
  W:    http://www.ivtvdriver.org
  S:    Maintained
  
@@@ -2546,8 -2576,6 +2581,6 @@@ W:      http://kvm.qumranet.co
  S:    Supported
  
  KERNEL VIRTUAL MACHINE For Itanium (KVM/IA64)
- P:    Anthony Xu
- M:    anthony.xu@intel.com
  P:    Xiantao Zhang
  M:    xiantao.zhang@intel.com
  L:    kvm-ia64@vger.kernel.org
@@@ -2640,13 -2668,13 +2673,13 @@@ W:   http://www.hansenpartnership.com/voy
  S:    Maintained
  
  LINUX FOR POWERPC (32-BIT AND 64-BIT)
- P:    Paul Mackerras
- M:    paulus@samba.org
  P:    Benjamin Herrenschmidt
  M:    benh@kernel.crashing.org
+ P:    Paul Mackerras
+ M:    paulus@samba.org
  W:    http://www.penguinppc.org/
  L:    linuxppc-dev@ozlabs.org
- T:    git kernel.org:/pub/scm/linux/kernel/git/paulus/powerpc.git
+ T:    git kernel.org:/pub/scm/linux/kernel/git/benh/powerpc.git
  S:    Supported
  
  LINUX FOR POWER MACINTOSH
@@@ -2808,8 -2836,6 +2841,6 @@@ S:      Maintaine
  MAC80211
  P:    Johannes Berg
  M:    johannes@sipsolutions.net
- P:    Michael Wu
- M:    flamingice@sourmilk.net
  L:    linux-wireless@vger.kernel.org
  W:    http://linuxwireless.org/
  T:    git kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.git
@@@ -2991,6 -3017,7 +3022,7 @@@ MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CO
  P:    Felipe Balbi
  M:    felipe.balbi@nokia.com
  L:    linux-usb@vger.kernel.org
+ T:    git gitorious.org:/musb/mainline.git
  S:    Maintained
  
  MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE)
@@@ -3197,7 -3224,8 +3229,8 @@@ S:      Maintaine
  OMNIVISION OV7670 SENSOR DRIVER
  P:    Jonathan Corbet
  M:    corbet@lwn.net
- L:    video4linux-list@redhat.com
+ L:    linux-media@vger.kernel.org
+ T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
  S:    Maintained
  
  ONENAND FLASH DRIVER
@@@ -3475,12 -3503,19 +3508,19 @@@ L:   linuxppc-dev@ozlabs.or
  L:    cbe-oss-dev@ozlabs.org
  S:    Supported
  
+ PS3VRAM DRIVER
+ P:    Jim Paris
+ M:    jim@jtan.com
+ L:    cbe-oss-dev@ozlabs.org
+ S:    Maintained
  PVRUSB2 VIDEO4LINUX DRIVER
  P:    Mike Isely
  M:    isely@pobox.com
  L:    pvrusb2@isely.net       (subscribers-only)
- L:    video4linux-list@redhat.com
+ L:    linux-media@vger.kernel.org
  W:    http://www.isely.net/pvrusb2/
+ T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
  S:    Maintained
  
  PXA2xx/PXA3xx SUPPORT
@@@ -3700,6 -3735,8 +3740,8 @@@ S:      Supporte
  SAA7146 VIDEO4LINUX-2 DRIVER
  P:    Michael Hunold
  M:    michael@mihu.de
+ L:    linux-media@vger.kernel.org
+ T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
  W:    http://www.mihu.de/linux/saa7146
  S:    Maintained
  
@@@ -3788,7 -3825,6 +3830,7 @@@ M:      jmorris@namei.or
  L:    linux-kernel@vger.kernel.org
  L:    linux-security-module@vger.kernel.org (suggested Cc:)
  T:    git kernel.org:pub/scm/linux/kernel/git/jmorris/security-testing-2.6.git
 +W:    http://security.wiki.kernel.org/
  S:    Supported
  
  SECURITY CONTACT
@@@ -3964,7 -4000,8 +4006,8 @@@ S:      Maintaine
  SOC-CAMERA V4L2 SUBSYSTEM
  P:    Guennadi Liakhovetski
  M:    g.liakhovetski@gmx.de
- L:    video4linux-list@redhat.com
+ L:    linux-media@vger.kernel.org
+ T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
  S:    Maintained
  
  SOEKRIS NET48XX LED SUPPORT
@@@ -4022,10 -4059,12 +4065,12 @@@ L:   alsa-devel@alsa-project.org (subscri
  W:    http://alsa-project.org/main/index.php/ASoC
  S:    Supported
  
- SPARC (sparc32)
- P:    William L. Irwin
- M:    wli@holomorphy.com
+ SPARC + UltraSPARC (sparc/sparc64)
+ P:    David S. Miller
+ M:    davem@davemloft.net
  L:    sparclinux@vger.kernel.org
+ T:    git kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6.git
+ T:    git kernel.org:/pub/scm/linux/kernel/git/davem/sparc-next-2.6.git
  S:    Maintained
  
  SPECIALIX IO8+ MULTIPORT SERIAL CARD DRIVER
@@@ -4056,6 -4095,13 +4101,13 @@@ L:    cbe-oss-dev@ozlabs.or
  W:    http://www.ibm.com/developerworks/power/cell/
  S:    Supported
  
+ SQUASHFS FILE SYSTEM
+ P:    Phillip Lougher
+ M:    phillip@lougher.demon.co.uk
+ L:    squashfs-devel@lists.sourceforge.net (subscribers-only)
+ W:    http://squashfs.org.uk
+ S:    Maintained
  SRM (Alpha) environment access
  P:    Jan-Benedict Glaw
  M:    jbglaw@lug-owl.de
@@@ -4237,9 -4283,10 +4289,10 @@@ L:    tpmdd-devel@lists.sourceforge.net (m
  S:    Maintained
  
  TRIVIAL PATCHES
- P:    Jesper Juhl
+ P:    Jiri Kosina
  M:    trivial@kernel.org
  L:    linux-kernel@vger.kernel.org
+ T:    git kernel.org:/pub/scm/linux/kernel/git/jikos/trivial.git
  S:    Maintained
  
  TTY LAYER
@@@ -4309,13 -4356,6 +4362,6 @@@ M:     dushistov@mail.r
  L:    linux-kernel@vger.kernel.org
  S:    Maintained
  
- UltraSPARC (sparc64)
- P:    David S. Miller
- M:    davem@davemloft.net
- L:    sparclinux@vger.kernel.org
- T:    git kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6.git
- S:    Maintained
  ULTRA-WIDEBAND (UWB) SUBSYSTEM:
  P:    David Vrabel
  M:    david.vrabel@csr.com
@@@ -4387,7 -4427,8 +4433,8 @@@ USB ET61X[12]51 DRIVE
  P:    Luca Risolia
  M:    luca.risolia@studio.unibo.it
  L:    linux-usb@vger.kernel.org
- L:    video4linux-list@redhat.com
+ L:    linux-media@vger.kernel.org
+ T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
  W:    http://www.linux-projects.org
  S:    Maintained
  
@@@ -4536,7 -4577,8 +4583,8 @@@ USB SN9C1xx DRIVE
  P:    Luca Risolia
  M:    luca.risolia@studio.unibo.it
  L:    linux-usb@vger.kernel.org
- L:    video4linux-list@redhat.com
+ L:    linux-media@vger.kernel.org
+ T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
  W:    http://www.linux-projects.org
  S:    Maintained
  
@@@ -4565,7 -4607,8 +4613,8 @@@ USB VIDEO CLAS
  P:    Laurent Pinchart
  M:    laurent.pinchart@skynet.be
  L:    linux-uvc-devel@lists.berlios.de (subscribers-only)
- L:    video4linux-list@redhat.com
+ L:    linux-media@vger.kernel.org
+ T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
  W:    http://linux-uvc.berlios.de
  S:    Maintained
  
@@@ -4573,7 -4616,8 +4622,8 @@@ USB W996[87]CF DRIVE
  P:    Luca Risolia
  M:    luca.risolia@studio.unibo.it
  L:    linux-usb@vger.kernel.org
- L:    video4linux-list@redhat.com
+ L:    linux-media@vger.kernel.org
+ T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
  W:    http://www.linux-projects.org
  S:    Maintained
  
@@@ -4587,7 -4631,8 +4637,8 @@@ USB ZC0301 DRIVE
  P:    Luca Risolia
  M:    luca.risolia@studio.unibo.it
  L:    linux-usb@vger.kernel.org
- L:    video4linux-list@redhat.com
+ L:    linux-media@vger.kernel.org
+ T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
  W:    http://www.linux-projects.org
  S:    Maintained
  
@@@ -4602,7 -4647,8 +4653,8 @@@ USB ZR364XX DRIVE
  P:    Antoine Jacquet
  M:    royale@zerezo.com
  L:    linux-usb@vger.kernel.org
- L:    video4linux-list@redhat.com
+ L:    linux-media@vger.kernel.org
+ T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
  W:    http://royale.zerezo.com/zr364xx/
  S:    Maintained
  
@@@ -4671,10 -4717,10 +4723,10 @@@ S:   Maintaine
  VIDEO FOR LINUX (V4L)
  P:    Mauro Carvalho Chehab
  M:    mchehab@infradead.org
M:    v4l-dvb-maintainer@linuxtv.org
L:    linux-media@vger.kernel.org
  L:    video4linux-list@redhat.com
  W:    http://linuxtv.org
- T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git
+ T:    git kernel.org:/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
  S:    Maintained
  
  VLAN (802.1Q)
@@@ -4747,6 -4793,14 +4799,14 @@@ M:    zaga@fly.cc.fer.h
  L:    linux-scsi@vger.kernel.org
  S:    Maintained
  
+ WIMAX STACK
+ P:    Inaky Perez-Gonzalez
+ M:    inaky.perez-gonzalez@intel.com
+ M:    linux-wimax@intel.com
+ L:    wimax@linuxwimax.org
+ S:    Supported
+ W:    http://linuxwimax.org
  WIMEDIA LLC PROTOCOL (WLP) SUBSYSTEM
  P:    David Vrabel
  M:    david.vrabel@csr.com
@@@ -4787,6 -4841,7 +4847,7 @@@ P:      Ingo Molna
  M:    mingo@redhat.com
  P:    H. Peter Anvin
  M:    hpa@zytor.com
+ M:    x86@kernel.org
  L:    linux-kernel@vger.kernel.org
  T:    git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git
  S:    Maintained
@@@ -4802,11 -4857,11 +4863,11 @@@ S:   Supporte
  
  XFS FILESYSTEM
  P:    Silicon Graphics Inc
- P:    Tim Shimmin
+ P:    Bill O'Donnell
  M:    xfs-masters@oss.sgi.com
  L:    xfs@oss.sgi.com
  W:    http://oss.sgi.com/projects/xfs
- T:    git git://oss.sgi.com:8090/xfs/xfs-2.6.git
+ T:    git://oss.sgi.com/xfs/xfs.git
  S:    Supported
  
  XILINX SYSTEMACE DRIVER
diff --combined fs/exec.c
+++ b/fs/exec.c
  #include <linux/proc_fs.h>
  #include <linux/mount.h>
  #include <linux/security.h>
 +#include <linux/ima.h>
  #include <linux/syscalls.h>
  #include <linux/tsacct_kern.h>
  #include <linux/cn_proc.h>
  #include <linux/audit.h>
  #include <linux/tracehook.h>
  #include <linux/kmod.h>
+ #include <linux/fsnotify.h>
  
  #include <asm/uaccess.h>
  #include <asm/mmu_context.h>
  #include <asm/tlb.h>
  #include "internal.h"
  
- #ifdef __alpha__
- /* for /sbin/loader handling in search_binary_handler() */
- #include <linux/a.out.h>
- #endif
  int core_uses_pid;
  char core_pattern[CORENAME_MAX_SIZE] = "core";
  int suid_dumpable = 0;
@@@ -104,7 -99,7 +100,7 @@@ static inline void put_binfmt(struct li
   *
   * Also note that we take the address to load from from the file itself.
   */
asmlinkage long sys_uselib(const char __user * library)
SYSCALL_DEFINE1(uselib, const char __user *, library)
  {
        struct file *file;
        struct nameidata nd;
        if (nd.path.mnt->mnt_flags & MNT_NOEXEC)
                goto exit;
  
-       error = vfs_permission(&nd, MAY_READ | MAY_EXEC | MAY_OPEN);
+       error = inode_permission(nd.path.dentry->d_inode,
+                                MAY_READ | MAY_EXEC | MAY_OPEN);
        if (error)
                goto exit;
 +      error = ima_path_check(&nd.path, MAY_READ | MAY_EXEC | MAY_OPEN);
 +      if (error)
 +              goto exit;
  
        file = nameidata_to_filp(&nd, O_RDONLY|O_LARGEFILE);
        error = PTR_ERR(file);
        if (IS_ERR(file))
                goto out;
  
+       fsnotify_open(file->f_path.dentry);
        error = -ENOEXEC;
        if(file->f_op) {
                struct linux_binfmt * fmt;
@@@ -237,13 -232,13 +236,13 @@@ static void flush_arg_page(struct linux
  
  static int __bprm_mm_init(struct linux_binprm *bprm)
  {
-       int err = -ENOMEM;
+       int err;
        struct vm_area_struct *vma = NULL;
        struct mm_struct *mm = bprm->mm;
  
        bprm->vma = vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
        if (!vma)
-               goto err;
+               return -ENOMEM;
  
        down_write(&mm->mmap_sem);
        vma->vm_mm = mm;
         */
        vma->vm_end = STACK_TOP_MAX;
        vma->vm_start = vma->vm_end - PAGE_SIZE;
        vma->vm_flags = VM_STACK_FLAGS;
        vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
        err = insert_vm_struct(mm, vma);
-       if (err) {
-               up_write(&mm->mmap_sem);
+       if (err)
                goto err;
-       }
  
        mm->stack_vm = mm->total_vm = 1;
        up_write(&mm->mmap_sem);
        bprm->p = vma->vm_end - sizeof(void *);
        return 0;
  err:
-       if (vma) {
-               bprm->vma = NULL;
-               kmem_cache_free(vm_area_cachep, vma);
-       }
+       up_write(&mm->mmap_sem);
+       bprm->vma = NULL;
+       kmem_cache_free(vm_area_cachep, vma);
        return err;
  }
  
@@@ -684,10 -671,7 +675,10 @@@ struct file *open_exec(const char *name
        if (nd.path.mnt->mnt_flags & MNT_NOEXEC)
                goto out_path_put;
  
-       err = vfs_permission(&nd, MAY_EXEC | MAY_OPEN);
+       err = inode_permission(nd.path.dentry->d_inode, MAY_EXEC | MAY_OPEN);
 +      if (err)
 +              goto out_path_put;
 +      err = ima_path_check(&nd.path, MAY_EXEC | MAY_OPEN);
        if (err)
                goto out_path_put;
  
        if (IS_ERR(file))
                return file;
  
+       fsnotify_open(file->f_path.dentry);
        err = deny_write_access(file);
        if (err) {
                fput(file);
@@@ -1178,45 -1164,8 +1171,11 @@@ int search_binary_handler(struct linux_
        unsigned int depth = bprm->recursion_depth;
        int try,retval;
        struct linux_binfmt *fmt;
- #ifdef __alpha__
-       /* handle /sbin/loader.. */
-       {
-           struct exec * eh = (struct exec *) bprm->buf;
-           if (!bprm->loader && eh->fh.f_magic == 0x183 &&
-               (eh->fh.f_flags & 0x3000) == 0x3000)
-           {
-               struct file * file;
-               unsigned long loader;
  
-               allow_write_access(bprm->file);
-               fput(bprm->file);
-               bprm->file = NULL;
-               loader = bprm->vma->vm_end - sizeof(void *);
-               file = open_exec("/sbin/loader");
-               retval = PTR_ERR(file);
-               if (IS_ERR(file))
-                       return retval;
-               /* Remember if the application is TASO.  */
-               bprm->taso = eh->ah.entry < 0x100000000UL;
-               bprm->file = file;
-               bprm->loader = loader;
-               retval = prepare_binprm(bprm);
-               if (retval<0)
-                       return retval;
-               /* should call search_binary_handler recursively here,
-                  but it does not matter */
-           }
-       }
- #endif
        retval = security_bprm_check(bprm);
 +      if (retval)
 +              return retval;
 +      retval = ima_bprm_check(bprm);
        if (retval)
                return retval;
  
@@@ -1737,7 -1686,7 +1696,7 @@@ int get_dumpable(struct mm_struct *mm
        return (ret >= 2) ? 2 : ret;
  }
  
int do_coredump(long signr, int exit_code, struct pt_regs * regs)
void do_coredump(long signr, int exit_code, struct pt_regs *regs)
  {
        struct core_state core_state;
        char corename[CORENAME_MAX_SIZE + 1];
  
        if (ispipe) {
                helper_argv = argv_split(GFP_KERNEL, corename+1, &helper_argc);
+               if (!helper_argv) {
+                       printk(KERN_WARNING "%s failed to allocate memory\n",
+                              __func__);
+                       goto fail_unlock;
+               }
                /* Terminate the string before the first option */
                delimit = strchr(corename, ' ');
                if (delimit)
@@@ -1888,5 -1842,5 +1852,5 @@@ fail_unlock
        put_cred(cred);
        coredump_finish(mm);
  fail:
-       return retval;
+       return;
  }
diff --combined fs/file_table.c
@@@ -13,7 -13,6 +13,7 @@@
  #include <linux/module.h>
  #include <linux/fs.h>
  #include <linux/security.h>
 +#include <linux/ima.h>
  #include <linux/eventpoll.h>
  #include <linux/rcupdate.h>
  #include <linux/mount.h>
@@@ -33,6 -32,9 +33,9 @@@ struct files_stat_struct files_stat = 
  /* public. Not pretty! */
  __cacheline_aligned_in_smp DEFINE_SPINLOCK(files_lock);
  
+ /* SLAB cache for file structures */
+ static struct kmem_cache *filp_cachep __read_mostly;
  static struct percpu_counter nr_files __cacheline_aligned_in_smp;
  
  static inline void file_free_rcu(struct rcu_head *head)
@@@ -277,7 -279,6 +280,7 @@@ void __fput(struct file *file
        if (file->f_op && file->f_op->release)
                file->f_op->release(inode, file);
        security_file_free(file);
 +      ima_file_free(file);
        if (unlikely(S_ISCHR(inode->i_mode) && inode->i_cdev != NULL))
                cdev_put(inode->i_cdev);
        fops_put(file->f_op);
@@@ -399,7 -400,12 +402,12 @@@ too_bad
  void __init files_init(unsigned long mempages)
  { 
        int n; 
-       /* One file with associated inode and dcache is very roughly 1K. 
+       filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0,
+                       SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL);
+       /*
+        * One file with associated inode and dcache is very roughly 1K.
         * Per default don't use more than 10% of our memory for files. 
         */ 
  
diff --combined fs/inode.c
  #include <linux/hash.h>
  #include <linux/swap.h>
  #include <linux/security.h>
 +#include <linux/ima.h>
  #include <linux/pagemap.h>
  #include <linux/cdev.h>
  #include <linux/bootmem.h>
  #include <linux/inotify.h>
  #include <linux/mount.h>
+ #include <linux/async.h>
  
  /*
   * This is needed for the following functions:
@@@ -111,8 -111,8 +112,8 @@@ static void wake_up_inode(struct inode 
  
  /**
   * inode_init_always - perform inode structure intialisation
-  * @sb                - superblock inode belongs to.
-  * @inode     - inode to initialise
+  * @sb: superblock inode belongs to
+  * @inode: inode to initialise
   *
   * These are initializations that need to be done on every inode
   * allocation as the fields are not initialised by slab allocation.
@@@ -132,6 -132,8 +133,8 @@@ struct inode *inode_init_always(struct 
        inode->i_op = &empty_iops;
        inode->i_fop = &empty_fops;
        inode->i_nlink = 1;
+       inode->i_uid = 0;
+       inode->i_gid = 0;
        atomic_set(&inode->i_writecount, 0);
        inode->i_size = 0;
        inode->i_blocks = 0;
        inode->i_cdev = NULL;
        inode->i_rdev = 0;
        inode->dirtied_when = 0;
 -      if (security_inode_alloc(inode)) {
 -              if (inode->i_sb->s_op->destroy_inode)
 -                      inode->i_sb->s_op->destroy_inode(inode);
 -              else
 -                      kmem_cache_free(inode_cachep, (inode));
 -              return NULL;
 -      }
 +
 +      if (security_inode_alloc(inode))
 +              goto out_free_inode;
 +
 +      /* allocate and initialize an i_integrity */
 +      if (ima_inode_alloc(inode))
 +              goto out_free_security;
  
        spin_lock_init(&inode->i_lock);
        lockdep_set_class(&inode->i_lock, &sb->s_type->i_lock_key);
        mapping->a_ops = &empty_aops;
        mapping->host = inode;
        mapping->flags = 0;
-       mapping_set_gfp_mask(mapping, GFP_HIGHUSER_PAGECACHE);
+       mapping_set_gfp_mask(mapping, GFP_HIGHUSER_MOVABLE);
        mapping->assoc_mapping = NULL;
        mapping->backing_dev_info = &default_backing_dev_info;
        mapping->writeback_index = 0;
        inode->i_mapping = mapping;
  
        return inode;
 +
 +out_free_security:
 +      security_inode_free(inode);
 +out_free_inode:
 +      if (inode->i_sb->s_op->destroy_inode)
 +              inode->i_sb->s_op->destroy_inode(inode);
 +      else
 +              kmem_cache_free(inode_cachep, (inode));
 +      return NULL;
  }
  EXPORT_SYMBOL(inode_init_always);
  
@@@ -584,8 -577,8 +587,8 @@@ __inode_add_to_lists(struct super_bloc
  
  /**
   * inode_add_to_lists - add a new inode to relevant lists
-  * @sb                - superblock inode belongs to.
-  * @inode     - inode to mark in use
+  * @sb: superblock inode belongs to
+  * @inode: inode to mark in use
   *
   * When an inode is allocated it needs to be accounted for, added to the in use
   * list, the owning superblock and the inode hash. This needs to be done under
@@@ -609,7 -602,7 +612,7 @@@ EXPORT_SYMBOL_GPL(inode_add_to_lists)
   *    @sb: superblock
   *
   *    Allocates a new inode for given superblock. The default gfp_mask
-  *    for allocations related to inode->i_mapping is GFP_HIGHUSER_PAGECACHE.
+  *    for allocations related to inode->i_mapping is GFP_HIGHUSER_MOVABLE.
   *    If HIGHMEM pages are unsuitable or it is known that pages allocated
   *    for the page cache are not reclaimable or migratable,
   *    mapping_set_gfp_mask() must be called with suitable flags on the
@@@ -1042,6 -1035,65 +1045,65 @@@ struct inode *iget_locked(struct super_
  
  EXPORT_SYMBOL(iget_locked);
  
+ int insert_inode_locked(struct inode *inode)
+ {
+       struct super_block *sb = inode->i_sb;
+       ino_t ino = inode->i_ino;
+       struct hlist_head *head = inode_hashtable + hash(sb, ino);
+       struct inode *old;
+       inode->i_state |= I_LOCK|I_NEW;
+       while (1) {
+               spin_lock(&inode_lock);
+               old = find_inode_fast(sb, head, ino);
+               if (likely(!old)) {
+                       hlist_add_head(&inode->i_hash, head);
+                       spin_unlock(&inode_lock);
+                       return 0;
+               }
+               __iget(old);
+               spin_unlock(&inode_lock);
+               wait_on_inode(old);
+               if (unlikely(!hlist_unhashed(&old->i_hash))) {
+                       iput(old);
+                       return -EBUSY;
+               }
+               iput(old);
+       }
+ }
+ EXPORT_SYMBOL(insert_inode_locked);
+ int insert_inode_locked4(struct inode *inode, unsigned long hashval,
+               int (*test)(struct inode *, void *), void *data)
+ {
+       struct super_block *sb = inode->i_sb;
+       struct hlist_head *head = inode_hashtable + hash(sb, hashval);
+       struct inode *old;
+       inode->i_state |= I_LOCK|I_NEW;
+       while (1) {
+               spin_lock(&inode_lock);
+               old = find_inode(sb, head, test, data);
+               if (likely(!old)) {
+                       hlist_add_head(&inode->i_hash, head);
+                       spin_unlock(&inode_lock);
+                       return 0;
+               }
+               __iget(old);
+               spin_unlock(&inode_lock);
+               wait_on_inode(old);
+               if (unlikely(!hlist_unhashed(&old->i_hash))) {
+                       iput(old);
+                       return -EBUSY;
+               }
+               iput(old);
+       }
+ }
+ EXPORT_SYMBOL(insert_inode_locked4);
  /**
   *    __insert_inode_hash - hash an inode
   *    @inode: unhashed inode
diff --combined fs/namei.c
@@@ -24,7 -24,6 +24,7 @@@
  #include <linux/fsnotify.h>
  #include <linux/personality.h>
  #include <linux/security.h>
 +#include <linux/ima.h>
  #include <linux/syscalls.h>
  #include <linux/mount.h>
  #include <linux/audit.h>
@@@ -227,6 -226,16 +227,16 @@@ int generic_permission(struct inode *in
        return -EACCES;
  }
  
+ /**
+  * inode_permission  -  check for access rights to a given inode
+  * @inode:    inode to check permission on
+  * @mask:     right to check for (%MAY_READ, %MAY_WRITE, %MAY_EXEC)
+  *
+  * Used to check for read/write/execute permissions on an inode.
+  * We use "fsuid" for this, letting us set arbitrary permissions
+  * for filesystem access without changing the "normal" uids which
+  * are used for other things.
+  */
  int inode_permission(struct inode *inode, int mask)
  {
        int retval;
                        return -EACCES;
        }
  
-       /* Ordinary permission routines do not understand MAY_APPEND. */
-       if (inode->i_op && inode->i_op->permission)
+       if (inode->i_op->permission)
                retval = inode->i_op->permission(inode, mask);
        else
                retval = generic_permission(inode, mask, NULL);
                        mask & (MAY_READ|MAY_WRITE|MAY_EXEC|MAY_APPEND));
  }
  
- /**
-  * vfs_permission  -  check for access rights to a given path
-  * @nd:               lookup result that describes the path
-  * @mask:     right to check for (%MAY_READ, %MAY_WRITE, %MAY_EXEC)
-  *
-  * Used to check for read/write/execute permissions on a path.
-  * We use "fsuid" for this, letting us set arbitrary permissions
-  * for filesystem access without changing the "normal" uids which
-  * are used for other things.
-  */
- int vfs_permission(struct nameidata *nd, int mask)
- {
-       return inode_permission(nd->path.dentry->d_inode, mask);
- }
  /**
   * file_permission  -  check for additional access rights to a given file
   * @file:     file to check access rights for
   *
   * Note:
   *    Do not use this function in new code.  All access checks should
-  *    be done using vfs_permission().
+  *    be done using inode_permission().
   */
  int file_permission(struct file *file, int mask)
  {
@@@ -439,7 -432,7 +433,7 @@@ static int exec_permission_lite(struct 
  {
        umode_t mode = inode->i_mode;
  
-       if (inode->i_op && inode->i_op->permission)
+       if (inode->i_op->permission)
                return -EAGAIN;
  
        if (current_fsuid() == inode->i_uid)
@@@ -528,18 -521,6 +522,6 @@@ out_unlock
        return result;
  }
  
- /* SMP-safe */
- static __always_inline void
- walk_init_root(const char *name, struct nameidata *nd)
- {
-       struct fs_struct *fs = current->fs;
-       read_lock(&fs->lock);
-       nd->path = fs->root;
-       path_get(&fs->root);
-       read_unlock(&fs->lock);
- }
  /*
   * Wrapper to retry pathname resolution whenever the underlying
   * file system returns an ESTALE.
@@@ -577,9 -558,16 +559,16 @@@ static __always_inline int __vfs_follow
                goto fail;
  
        if (*link == '/') {
+               struct fs_struct *fs = current->fs;
                path_put(&nd->path);
-               walk_init_root(link, nd);
+               read_lock(&fs->lock);
+               nd->path = fs->root;
+               path_get(&fs->root);
+               read_unlock(&fs->lock);
        }
        res = link_path_walk(link, nd);
        if (nd->depth || res || nd->last_type!=LAST_NORM)
                return res;
@@@ -860,9 -848,8 +849,10 @@@ static int __link_path_walk(const char 
                nd->flags |= LOOKUP_CONTINUE;
                err = exec_permission_lite(inode);
                if (err == -EAGAIN)
-                       err = vfs_permission(nd, MAY_EXEC);
+                       err = inode_permission(nd->path.dentry->d_inode,
+                                              MAY_EXEC);
 +              if (!err)
 +                      err = ima_path_check(&nd->path, MAY_EXEC);
                if (err)
                        break;
  
                inode = next.dentry->d_inode;
                if (!inode)
                        goto out_dput;
-               err = -ENOTDIR; 
-               if (!inode->i_op)
-                       goto out_dput;
  
                if (inode->i_op->follow_link) {
                        err = do_follow_link(&next, nd);
                        inode = nd->path.dentry->d_inode;
                        if (!inode)
                                break;
-                       err = -ENOTDIR; 
-                       if (!inode->i_op)
-                               break;
                } else
                        path_to_nameidata(&next, nd);
                err = -ENOTDIR; 
@@@ -974,7 -955,7 +958,7 @@@ last_component
                        break;
                inode = next.dentry->d_inode;
                if ((lookup_flags & LOOKUP_FOLLOW)
-                   && inode && inode->i_op && inode->i_op->follow_link) {
+                   && inode && inode->i_op->follow_link) {
                        err = do_follow_link(&next, nd);
                        if (err)
                                goto return_err;
                        break;
                if (lookup_flags & LOOKUP_DIRECTORY) {
                        err = -ENOTDIR; 
-                       if (!inode->i_op || !inode->i_op->lookup)
+                       if (!inode->i_op->lookup)
                                break;
                }
                goto return_base;
@@@ -1482,7 -1463,7 +1466,7 @@@ int vfs_create(struct inode *dir, struc
        if (error)
                return error;
  
-       if (!dir->i_op || !dir->i_op->create)
+       if (!dir->i_op->create)
                return -EACCES; /* shouldn't it be ENOSYS? */
        mode &= S_IALLUGO;
        mode |= S_IFREG;
        return error;
  }
  
- int may_open(struct nameidata *nd, int acc_mode, int flag)
+ int may_open(struct path *path, int acc_mode, int flag)
  {
-       struct dentry *dentry = nd->path.dentry;
+       struct dentry *dentry = path->dentry;
        struct inode *inode = dentry->d_inode;
        int error;
  
        if (S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) {
                flag &= ~O_TRUNC;
        } else if (S_ISBLK(inode->i_mode) || S_ISCHR(inode->i_mode)) {
-               if (nd->path.mnt->mnt_flags & MNT_NODEV)
+               if (path->mnt->mnt_flags & MNT_NODEV)
                        return -EACCES;
  
                flag &= ~O_TRUNC;
        }
  
-       error = vfs_permission(nd, acc_mode);
+       error = inode_permission(inode, acc_mode);
        if (error)
                return error;
-       error = ima_path_check(&nd->path,
 +
++      error = ima_path_check(path,
 +                             acc_mode & (MAY_READ | MAY_WRITE | MAY_EXEC));
 +      if (error)
 +              return error;
        /*
         * An append-only file must be opened in append mode for writing.
         */
                 * Refuse to truncate files with mandatory locks held on them.
                 */
                error = locks_verify_locked(inode);
+               if (!error)
+                       error = security_path_truncate(path, 0,
+                                              ATTR_MTIME|ATTR_CTIME|ATTR_OPEN);
                if (!error) {
                        DQUOT_INIT(inode);
  
@@@ -1594,14 -1573,18 +1581,18 @@@ static int __open_namei_create(struct n
  
        if (!IS_POSIXACL(dir->d_inode))
                mode &= ~current->fs->umask;
+       error = security_path_mknod(&nd->path, path->dentry, mode, 0);
+       if (error)
+               goto out_unlock;
        error = vfs_create(dir->d_inode, path->dentry, mode, nd);
+ out_unlock:
        mutex_unlock(&dir->d_inode->i_mutex);
        dput(nd->path.dentry);
        nd->path.dentry = path->dentry;
        if (error)
                return error;
        /* Don't check for write permission, don't truncate */
-       return may_open(nd, 0, flag & ~O_TRUNC);
+       return may_open(&nd->path, 0, flag & ~O_TRUNC);
  }
  
  /*
@@@ -1763,7 -1746,7 +1754,7 @@@ do_last
        error = -ENOENT;
        if (!path.dentry->d_inode)
                goto exit_dput;
-       if (path.dentry->d_inode->i_op && path.dentry->d_inode->i_op->follow_link)
+       if (path.dentry->d_inode->i_op->follow_link)
                goto do_link;
  
        path_to_nameidata(&path, &nd);
@@@ -1787,7 -1770,7 +1778,7 @@@ ok
                if (error)
                        goto exit;
        }
-       error = may_open(&nd, acc_mode, flag);
+       error = may_open(&nd.path, acc_mode, flag);
        if (error) {
                if (will_write)
                        mnt_drop_write(nd.path.mnt);
@@@ -1944,7 -1927,7 +1935,7 @@@ int vfs_mknod(struct inode *dir, struc
        if ((S_ISCHR(mode) || S_ISBLK(mode)) && !capable(CAP_MKNOD))
                return -EPERM;
  
-       if (!dir->i_op || !dir->i_op->mknod)
+       if (!dir->i_op->mknod)
                return -EPERM;
  
        error = devcgroup_inode_mknod(mode, dev);
@@@ -1979,8 -1962,8 +1970,8 @@@ static int may_mknod(mode_t mode
        }
  }
  
asmlinkage long sys_mknodat(int dfd, const char __user *filename, int mode,
-                               unsigned dev)
SYSCALL_DEFINE4(mknodat, int, dfd, const char __user *, filename, int, mode,
+               unsigned, dev)
  {
        int error;
        char *tmp;
        error = mnt_want_write(nd.path.mnt);
        if (error)
                goto out_dput;
+       error = security_path_mknod(&nd.path, dentry, mode, dev);
+       if (error)
+               goto out_drop_write;
        switch (mode & S_IFMT) {
                case 0: case S_IFREG:
                        error = vfs_create(nd.path.dentry->d_inode,dentry,mode,&nd);
                        error = vfs_mknod(nd.path.dentry->d_inode,dentry,mode,0);
                        break;
        }
+ out_drop_write:
        mnt_drop_write(nd.path.mnt);
  out_dput:
        dput(dentry);
@@@ -2030,7 -2017,7 +2025,7 @@@ out_unlock
        return error;
  }
  
asmlinkage long sys_mknod(const char __user *filename, int mode, unsigned dev)
SYSCALL_DEFINE3(mknod, const char __user *, filename, int, mode, unsigned, dev)
  {
        return sys_mknodat(AT_FDCWD, filename, mode, dev);
  }
@@@ -2042,7 -2029,7 +2037,7 @@@ int vfs_mkdir(struct inode *dir, struc
        if (error)
                return error;
  
-       if (!dir->i_op || !dir->i_op->mkdir)
+       if (!dir->i_op->mkdir)
                return -EPERM;
  
        mode &= (S_IRWXUGO|S_ISVTX);
        return error;
  }
  
asmlinkage long sys_mkdirat(int dfd, const char __user *pathname, int mode)
SYSCALL_DEFINE3(mkdirat, int, dfd, const char __user *, pathname, int, mode)
  {
        int error = 0;
        char * tmp;
        error = mnt_want_write(nd.path.mnt);
        if (error)
                goto out_dput;
+       error = security_path_mkdir(&nd.path, dentry, mode);
+       if (error)
+               goto out_drop_write;
        error = vfs_mkdir(nd.path.dentry->d_inode, dentry, mode);
+ out_drop_write:
        mnt_drop_write(nd.path.mnt);
  out_dput:
        dput(dentry);
@@@ -2090,7 -2081,7 +2089,7 @@@ out_err
        return error;
  }
  
asmlinkage long sys_mkdir(const char __user *pathname, int mode)
SYSCALL_DEFINE2(mkdir, const char __user *, pathname, int, mode)
  {
        return sys_mkdirat(AT_FDCWD, pathname, mode);
  }
@@@ -2129,7 -2120,7 +2128,7 @@@ int vfs_rmdir(struct inode *dir, struc
        if (error)
                return error;
  
-       if (!dir->i_op || !dir->i_op->rmdir)
+       if (!dir->i_op->rmdir)
                return -EPERM;
  
        DQUOT_INIT(dir);
@@@ -2188,7 -2179,11 +2187,11 @@@ static long do_rmdir(int dfd, const cha
        error = mnt_want_write(nd.path.mnt);
        if (error)
                goto exit3;
+       error = security_path_rmdir(&nd.path, dentry);
+       if (error)
+               goto exit4;
        error = vfs_rmdir(nd.path.dentry->d_inode, dentry);
+ exit4:
        mnt_drop_write(nd.path.mnt);
  exit3:
        dput(dentry);
@@@ -2200,7 -2195,7 +2203,7 @@@ exit1
        return error;
  }
  
asmlinkage long sys_rmdir(const char __user *pathname)
SYSCALL_DEFINE1(rmdir, const char __user *, pathname)
  {
        return do_rmdir(AT_FDCWD, pathname);
  }
@@@ -2212,7 -2207,7 +2215,7 @@@ int vfs_unlink(struct inode *dir, struc
        if (error)
                return error;
  
-       if (!dir->i_op || !dir->i_op->unlink)
+       if (!dir->i_op->unlink)
                return -EPERM;
  
        DQUOT_INIT(dir);
@@@ -2273,7 -2268,11 +2276,11 @@@ static long do_unlinkat(int dfd, const 
                error = mnt_want_write(nd.path.mnt);
                if (error)
                        goto exit2;
+               error = security_path_unlink(&nd.path, dentry);
+               if (error)
+                       goto exit3;
                error = vfs_unlink(nd.path.dentry->d_inode, dentry);
+ exit3:
                mnt_drop_write(nd.path.mnt);
        exit2:
                dput(dentry);
@@@ -2292,7 -2291,7 +2299,7 @@@ slashes
        goto exit2;
  }
  
asmlinkage long sys_unlinkat(int dfd, const char __user *pathname, int flag)
SYSCALL_DEFINE3(unlinkat, int, dfd, const char __user *, pathname, int, flag)
  {
        if ((flag & ~AT_REMOVEDIR) != 0)
                return -EINVAL;
        return do_unlinkat(dfd, pathname);
  }
  
asmlinkage long sys_unlink(const char __user *pathname)
SYSCALL_DEFINE1(unlink, const char __user *, pathname)
  {
        return do_unlinkat(AT_FDCWD, pathname);
  }
@@@ -2315,7 -2314,7 +2322,7 @@@ int vfs_symlink(struct inode *dir, stru
        if (error)
                return error;
  
-       if (!dir->i_op || !dir->i_op->symlink)
+       if (!dir->i_op->symlink)
                return -EPERM;
  
        error = security_inode_symlink(dir, dentry, oldname);
        return error;
  }
  
asmlinkage long sys_symlinkat(const char __user *oldname,
-                             int newdfd, const char __user *newname)
SYSCALL_DEFINE3(symlinkat, const char __user *, oldname,
+               int, newdfd, const char __user *, newname)
  {
        int error;
        char *from;
        error = mnt_want_write(nd.path.mnt);
        if (error)
                goto out_dput;
+       error = security_path_symlink(&nd.path, dentry, from);
+       if (error)
+               goto out_drop_write;
        error = vfs_symlink(nd.path.dentry->d_inode, dentry, from);
+ out_drop_write:
        mnt_drop_write(nd.path.mnt);
  out_dput:
        dput(dentry);
@@@ -2367,7 -2370,7 +2378,7 @@@ out_putname
        return error;
  }
  
asmlinkage long sys_symlink(const char __user *oldname, const char __user *newname)
SYSCALL_DEFINE2(symlink, const char __user *, oldname, const char __user *, newname)
  {
        return sys_symlinkat(oldname, AT_FDCWD, newname);
  }
@@@ -2392,7 -2395,7 +2403,7 @@@ int vfs_link(struct dentry *old_dentry
         */
        if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
                return -EPERM;
-       if (!dir->i_op || !dir->i_op->link)
+       if (!dir->i_op->link)
                return -EPERM;
        if (S_ISDIR(inode->i_mode))
                return -EPERM;
   * with linux 2.0, and to avoid hard-linking to directories
   * and other special files.  --ADM
   */
- asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
-                          int newdfd, const char __user *newname,
-                          int flags)
+ SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname,
+               int, newdfd, const char __user *, newname, int, flags)
  {
        struct dentry *new_dentry;
        struct nameidata nd;
        error = mnt_want_write(nd.path.mnt);
        if (error)
                goto out_dput;
+       error = security_path_link(old_path.dentry, &nd.path, new_dentry);
+       if (error)
+               goto out_drop_write;
        error = vfs_link(old_path.dentry, nd.path.dentry->d_inode, new_dentry);
+ out_drop_write:
        mnt_drop_write(nd.path.mnt);
  out_dput:
        dput(new_dentry);
@@@ -2466,7 -2472,7 +2480,7 @@@ out
        return error;
  }
  
asmlinkage long sys_link(const char __user *oldname, const char __user *newname)
SYSCALL_DEFINE2(link, const char __user *, oldname, const char __user *, newname)
  {
        return sys_linkat(AT_FDCWD, oldname, AT_FDCWD, newname, 0);
  }
@@@ -2595,7 -2601,7 +2609,7 @@@ int vfs_rename(struct inode *old_dir, s
        if (error)
                return error;
  
-       if (!old_dir->i_op || !old_dir->i_op->rename)
+       if (!old_dir->i_op->rename)
                return -EPERM;
  
        DQUOT_INIT(old_dir);
        return error;
  }
  
asmlinkage long sys_renameat(int olddfd, const char __user *oldname,
-                            int newdfd, const char __user *newname)
SYSCALL_DEFINE4(renameat, int, olddfd, const char __user *, oldname,
+               int, newdfd, const char __user *, newname)
  {
        struct dentry *old_dir, *new_dir;
        struct dentry *old_dentry, *new_dentry;
        error = mnt_want_write(oldnd.path.mnt);
        if (error)
                goto exit5;
+       error = security_path_rename(&oldnd.path, old_dentry,
+                                    &newnd.path, new_dentry);
+       if (error)
+               goto exit6;
        error = vfs_rename(old_dir->d_inode, old_dentry,
                                   new_dir->d_inode, new_dentry);
+ exit6:
        mnt_drop_write(oldnd.path.mnt);
  exit5:
        dput(new_dentry);
@@@ -2706,7 -2717,7 +2725,7 @@@ exit
        return error;
  }
  
asmlinkage long sys_rename(const char __user *oldname, const char __user *newname)
SYSCALL_DEFINE2(rename, const char __user *, oldname, const char __user *, newname)
  {
        return sys_renameat(AT_FDCWD, oldname, AT_FDCWD, newname);
  }
@@@ -2758,13 -2769,16 +2777,16 @@@ int vfs_follow_link(struct nameidata *n
  /* get the link contents into pagecache */
  static char *page_getlink(struct dentry * dentry, struct page **ppage)
  {
-       struct page * page;
+       char *kaddr;
+       struct page *page;
        struct address_space *mapping = dentry->d_inode->i_mapping;
        page = read_mapping_page(mapping, 0, NULL);
        if (IS_ERR(page))
                return (char*)page;
        *ppage = page;
-       return kmap(page);
+       kaddr = kmap(page);
+       nd_terminate_link(kaddr, dentry->d_inode->i_size, PAGE_SIZE - 1);
+       return kaddr;
  }
  
  int page_readlink(struct dentry *dentry, char __user *buffer, int buflen)
@@@ -2796,18 -2810,23 +2818,23 @@@ void page_put_link(struct dentry *dentr
        }
  }
  
- int __page_symlink(struct inode *inode, const char *symname, int len,
-               gfp_t gfp_mask)
+ /*
+  * The nofs argument instructs pagecache_write_begin to pass AOP_FLAG_NOFS
+  */
+ int __page_symlink(struct inode *inode, const char *symname, int len, int nofs)
  {
        struct address_space *mapping = inode->i_mapping;
        struct page *page;
        void *fsdata;
        int err;
        char *kaddr;
+       unsigned int flags = AOP_FLAG_UNINTERRUPTIBLE;
+       if (nofs)
+               flags |= AOP_FLAG_NOFS;
  
  retry:
        err = pagecache_write_begin(NULL, mapping, 0, len-1,
-                               AOP_FLAG_UNINTERRUPTIBLE, &page, &fsdata);
+                               flags, &page, &fsdata);
        if (err)
                goto fail;
  
@@@ -2831,7 -2850,7 +2858,7 @@@ fail
  int page_symlink(struct inode *inode, const char *symname, int len)
  {
        return __page_symlink(inode, symname, len,
-                       mapping_gfp_mask(inode->i_mapping));
+                       !(mapping_gfp_mask(inode->i_mapping) & __GFP_FS));
  }
  
  const struct inode_operations page_symlink_inode_operations = {
@@@ -2857,7 -2876,6 +2884,6 @@@ EXPORT_SYMBOL(path_lookup)
  EXPORT_SYMBOL(kern_path);
  EXPORT_SYMBOL(vfs_path_lookup);
  EXPORT_SYMBOL(inode_permission);
- EXPORT_SYMBOL(vfs_permission);
  EXPORT_SYMBOL(file_permission);
  EXPORT_SYMBOL(unlock_rename);
  EXPORT_SYMBOL(vfs_create);
@@@ -2873,3 -2891,10 +2899,10 @@@ EXPORT_SYMBOL(vfs_symlink)
  EXPORT_SYMBOL(vfs_unlink);
  EXPORT_SYMBOL(dentry_unhash);
  EXPORT_SYMBOL(generic_readlink);
+ /* to be mentioned only in INIT_TASK */
+ struct fs_struct init_fs = {
+       .count          = ATOMIC_INIT(1),
+       .lock           = __RW_LOCK_UNLOCKED(init_fs.lock),
+       .umask          = 0022,
+ };
diff --combined include/linux/audit.h
  #define AUDIT_LAST_KERN_ANOM_MSG    1799
  #define AUDIT_ANOM_PROMISCUOUS      1700 /* Device changed promiscuous mode */
  #define AUDIT_ANOM_ABEND            1701 /* Process ended abnormally */
 +#define AUDIT_INTEGRITY_DATA      1800 /* Data integrity verification */
 +#define AUDIT_INTEGRITY_METADATA    1801 /* Metadata integrity verification */
 +#define AUDIT_INTEGRITY_STATUS            1802 /* Integrity enable status */
 +#define AUDIT_INTEGRITY_HASH      1803 /* Integrity HASH type */
 +#define AUDIT_INTEGRITY_PCR       1804 /* PCR invalidation msgs */
  
  #define AUDIT_KERNEL          2000    /* Asynchronous audit record. NOT A REQUEST. */
  
  #define AUDIT_GREATER_THAN_OR_EQUAL   (AUDIT_GREATER_THAN|AUDIT_EQUAL)
  #define AUDIT_OPERATORS                       (AUDIT_EQUAL|AUDIT_NOT_EQUAL|AUDIT_BIT_MASK)
  
+ enum {
+       Audit_equal,
+       Audit_not_equal,
+       Audit_bitmask,
+       Audit_bittest,
+       Audit_lt,
+       Audit_gt,
+       Audit_le,
+       Audit_ge,
+       Audit_bad
+ };
  /* Status symbols */
                                /* Mask values */
  #define AUDIT_STATUS_ENABLED          0x0001
@@@ -378,6 -385,8 +390,8 @@@ struct audit_krule 
        struct audit_watch      *watch; /* associated watch */
        struct audit_tree       *tree;  /* associated watched tree */
        struct list_head        rlist;  /* entry in audit_{watch,tree}.rules list */
+       struct list_head        list;   /* for AUDIT_LIST* purposes only */
+       u64                     prio;
  };
  
  struct audit_field {
@@@ -448,70 -457,56 +462,56 @@@ extern int  audit_set_loginuid(struct t
  #define audit_get_loginuid(t) ((t)->loginuid)
  #define audit_get_sessionid(t) ((t)->sessionid)
  extern void audit_log_task_context(struct audit_buffer *ab);
- extern int __audit_ipc_obj(struct kern_ipc_perm *ipcp);
- extern int __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode);
+ extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp);
+ extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode);
  extern int audit_bprm(struct linux_binprm *bprm);
- extern int audit_socketcall(int nargs, unsigned long *args);
+ extern void audit_socketcall(int nargs, unsigned long *args);
  extern int audit_sockaddr(int len, void *addr);
- extern int __audit_fd_pair(int fd1, int fd2);
+ extern void __audit_fd_pair(int fd1, int fd2);
  extern int audit_set_macxattr(const char *name);
- extern int __audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr);
- extern int __audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout);
- extern int __audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout);
- extern int __audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification);
- extern int __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
+ extern void __audit_mq_open(int oflag, mode_t mode, struct mq_attr *attr);
+ extern void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout);
+ extern void __audit_mq_notify(mqd_t mqdes, const struct sigevent *notification);
+ extern void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
  extern int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
                                  const struct cred *new,
                                  const struct cred *old);
- extern int __audit_log_capset(pid_t pid, const struct cred *new, const struct cred *old);
+ extern void __audit_log_capset(pid_t pid, const struct cred *new, const struct cred *old);
  
- static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp)
+ static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
  {
        if (unlikely(!audit_dummy_context()))
-               return __audit_ipc_obj(ipcp);
-       return 0;
- }
- static inline int audit_fd_pair(int fd1, int fd2)
- {
-       if (unlikely(!audit_dummy_context()))
-               return __audit_fd_pair(fd1, fd2);
-       return 0;
+               __audit_ipc_obj(ipcp);
  }
- static inline int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode)
+ static inline void audit_fd_pair(int fd1, int fd2)
  {
        if (unlikely(!audit_dummy_context()))
-               return __audit_ipc_set_perm(qbytes, uid, gid, mode);
-       return 0;
+               __audit_fd_pair(fd1, fd2);
  }
- static inline int audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr)
+ static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode)
  {
        if (unlikely(!audit_dummy_context()))
-               return __audit_mq_open(oflag, mode, u_attr);
-       return 0;
+               __audit_ipc_set_perm(qbytes, uid, gid, mode);
  }
- static inline int audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout)
+ static inline void audit_mq_open(int oflag, mode_t mode, struct mq_attr *attr)
  {
        if (unlikely(!audit_dummy_context()))
-               return __audit_mq_timedsend(mqdes, msg_len, msg_prio, u_abs_timeout);
-       return 0;
+               __audit_mq_open(oflag, mode, attr);
  }
- static inline int audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout)
+ static inline void audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout)
  {
        if (unlikely(!audit_dummy_context()))
-               return __audit_mq_timedreceive(mqdes, msg_len, u_msg_prio, u_abs_timeout);
-       return 0;
+               __audit_mq_sendrecv(mqdes, msg_len, msg_prio, abs_timeout);
  }
- static inline int audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification)
+ static inline void audit_mq_notify(mqd_t mqdes, const struct sigevent *notification)
  {
        if (unlikely(!audit_dummy_context()))
-               return __audit_mq_notify(mqdes, u_notification);
-       return 0;
+               __audit_mq_notify(mqdes, notification);
  }
- static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
+ static inline void audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
  {
        if (unlikely(!audit_dummy_context()))
-               return __audit_mq_getsetattr(mqdes, mqstat);
-       return 0;
+               __audit_mq_getsetattr(mqdes, mqstat);
  }
  
  static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm,
        return 0;
  }
  
- static inline int audit_log_capset(pid_t pid, const struct cred *new,
+ static inline void audit_log_capset(pid_t pid, const struct cred *new,
                                   const struct cred *old)
  {
        if (unlikely(!audit_dummy_context()))
-               return __audit_log_capset(pid, new, old);
-       return 0;
+               __audit_log_capset(pid, new, old);
  }
  
  extern int audit_n_rules;
@@@ -551,20 -545,19 +550,19 @@@ extern int audit_signals
  #define audit_get_loginuid(t) (-1)
  #define audit_get_sessionid(t) (-1)
  #define audit_log_task_context(b) do { ; } while (0)
- #define audit_ipc_obj(i) ({ 0; })
- #define audit_ipc_set_perm(q,u,g,m) ({ 0; })
+ #define audit_ipc_obj(i) ((void)0)
+ #define audit_ipc_set_perm(q,u,g,m) ((void)0)
  #define audit_bprm(p) ({ 0; })
- #define audit_socketcall(n,a) ({ 0; })
- #define audit_fd_pair(n,a) ({ 0; })
+ #define audit_socketcall(n,a) ((void)0)
+ #define audit_fd_pair(n,a) ((void)0)
  #define audit_sockaddr(len, addr) ({ 0; })
  #define audit_set_macxattr(n) do { ; } while (0)
- #define audit_mq_open(o,m,a) ({ 0; })
- #define audit_mq_timedsend(d,l,p,t) ({ 0; })
- #define audit_mq_timedreceive(d,l,p,t) ({ 0; })
- #define audit_mq_notify(d,n) ({ 0; })
- #define audit_mq_getsetattr(d,s) ({ 0; })
+ #define audit_mq_open(o,m,a) ((void)0)
+ #define audit_mq_sendrecv(d,l,p,t) ((void)0)
+ #define audit_mq_notify(d,n) ((void)0)
+ #define audit_mq_getsetattr(d,s) ((void)0)
  #define audit_log_bprm_fcaps(b, ncr, ocr) ({ 0; })
- #define audit_log_capset(pid, ncr, ocr) ({ 0; })
+ #define audit_log_capset(pid, ncr, ocr) ((void)0)
  #define audit_ptrace(t) ((void)0)
  #define audit_n_rules 0
  #define audit_signals 0
diff --combined ipc/shm.c
+++ b/ipc/shm.c
@@@ -39,7 -39,6 +39,7 @@@
  #include <linux/nsproxy.h>
  #include <linux/mount.h>
  #include <linux/ipc_namespace.h>
 +#include <linux/ima.h>
  
  #include <asm/uaccess.h>
  
@@@ -76,7 -75,7 +76,7 @@@ void shm_init_ns(struct ipc_namespace *
        ns->shm_ctlall = SHMALL;
        ns->shm_ctlmni = SHMMNI;
        ns->shm_tot = 0;
-       ipc_init_ids(&ns->ids[IPC_SHM_IDS]);
+       ipc_init_ids(&shm_ids(ns));
  }
  
  /*
@@@ -369,20 -368,19 +369,20 @@@ static int newseg(struct ipc_namespace 
                file = hugetlb_file_setup(name, size);
                shp->mlock_user = current_user();
        } else {
-               int acctflag = VM_ACCOUNT;
+               int acctflag = 0;
                /*
                 * Do not allow no accounting for OVERCOMMIT_NEVER, even
                 * if it's asked for.
                 */
                if  ((shmflg & SHM_NORESERVE) &&
                                sysctl_overcommit_memory != OVERCOMMIT_NEVER)
-                       acctflag = 0;
+                       acctflag = VM_NORESERVE;
                file = shmem_file_setup(name, size, acctflag);
        }
        error = PTR_ERR(file);
        if (IS_ERR(file))
                goto no_file;
 +      ima_shm_check(file);
  
        id = ipc_addid(&shm_ids(ns), &shp->shm_perm, ns->shm_ctlmni);
        if (id < 0) {
@@@ -442,7 -440,7 +442,7 @@@ static inline int shm_more_checks(struc
        return 0;
  }
  
asmlinkage long sys_shmget (key_t key, size_t size, int shmflg)
SYSCALL_DEFINE3(shmget, key_t, key, size_t, size, int, shmflg)
  {
        struct ipc_namespace *ns;
        struct ipc_ops shm_ops;
@@@ -567,11 -565,15 +567,15 @@@ static void shm_get_stat(struct ipc_nam
                        struct hstate *h = hstate_file(shp->shm_file);
                        *rss += pages_per_huge_page(h) * mapping->nrpages;
                } else {
+ #ifdef CONFIG_SHMEM
                        struct shmem_inode_info *info = SHMEM_I(inode);
                        spin_lock(&info->lock);
                        *rss += inode->i_mapping->nrpages;
                        *swp += info->swapped;
                        spin_unlock(&info->lock);
+ #else
+                       *rss += inode->i_mapping->nrpages;
+ #endif
                }
  
                total++;
@@@ -623,7 -625,7 +627,7 @@@ out_up
        return err;
  }
  
asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf)
SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf)
  {
        struct shmid_kernel *shp;
        int err, version;
                if (err)
                        return err;
  
-               memset(&shminfo,0,sizeof(shminfo));
+               memset(&shminfo, 0, sizeof(shminfo));
                shminfo.shmmni = shminfo.shmseg = ns->shm_ctlmni;
                shminfo.shmmax = ns->shm_ctlmax;
                shminfo.shmall = ns->shm_ctlall;
                if (err)
                        return err;
  
-               memset(&shm_info,0,sizeof(shm_info));
+               memset(&shm_info, 0, sizeof(shm_info));
                down_read(&shm_ids(ns).rw_mutex);
                shm_info.used_ids = shm_ids(ns).in_use;
                shm_get_stat (ns, &shm_info.shm_rss, &shm_info.shm_swp);
                shm_info.swap_successes = 0;
                err = ipc_get_maxid(&shm_ids(ns));
                up_read(&shm_ids(ns).rw_mutex);
-               if(copy_to_user (buf, &shm_info, sizeof(shm_info))) {
+               if (copy_to_user(buf, &shm_info, sizeof(shm_info))) {
                        err = -EFAULT;
                        goto out;
                }
                struct shmid64_ds tbuf;
                int result;
  
-               if (!buf) {
-                       err = -EFAULT;
-                       goto out;
-               }
                if (cmd == SHM_STAT) {
                        shp = shm_lock(ns, shmid);
                        if (IS_ERR(shp)) {
                        }
                        result = 0;
                }
-               err=-EACCES;
+               err = -EACCES;
                if (ipcperms (&shp->shm_perm, S_IRUGO))
                        goto out_unlock;
                err = security_shm_shmctl(shp, cmd);
                        goto out;
                }
  
-               err = audit_ipc_obj(&(shp->shm_perm));
-               if (err)
-                       goto out_unlock;
+               audit_ipc_obj(&(shp->shm_perm));
  
                if (!capable(CAP_IPC_LOCK)) {
                        uid_t euid = current_euid();
@@@ -890,7 -885,6 +887,7 @@@ long do_shmat(int shmid, char __user *s
        file = alloc_file(path.mnt, path.dentry, f_mode, &shm_file_operations);
        if (!file)
                goto out_free;
 +      ima_shm_check(file);
  
        file->private_data = sfd;
        file->f_mapping = shp->shm_file->f_mapping;
@@@ -949,7 -943,7 +946,7 @@@ out_put_dentry
        goto out_nattch;
  }
  
asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg)
SYSCALL_DEFINE3(shmat, int, shmid, char __user *, shmaddr, int, shmflg)
  {
        unsigned long ret;
        long err;
   * detach and kill segment if marked destroyed.
   * The work is done in shm_close.
   */
asmlinkage long sys_shmdt(char __user *shmaddr)
SYSCALL_DEFINE1(shmdt, char __user *, shmaddr)
  {
        struct mm_struct *mm = current->mm;
        struct vm_area_struct *vma, *next;
         */
        vma = find_vma(mm, addr);
  
+ #ifdef CONFIG_MMU
        while (vma) {
                next = vma->vm_next;
  
                vma = next;
        }
  
+ #else /* CONFIG_MMU */
+       /* under NOMMU conditions, the exact address to be destroyed must be
+        * given */
+       retval = -EINVAL;
+       if (vma->vm_start == addr && vma->vm_ops == &shm_vm_ops) {
+               do_munmap(mm, vma->vm_start, vma->vm_end - vma->vm_start);
+               retval = 0;
+       }
+ #endif
        up_write(&mm->mmap_sem);
        return retval;
  }
diff --combined mm/mmap.c
+++ b/mm/mmap.c
@@@ -3,7 -3,7 +3,7 @@@
   *
   * Written by obz.
   *
-  * Address space accounting code      <alan@redhat.com>
+  * Address space accounting code      <alan@lxorguk.ukuu.org.uk>
   */
  
  #include <linux/slab.h>
@@@ -20,7 -20,6 +20,7 @@@
  #include <linux/fs.h>
  #include <linux/personality.h>
  #include <linux/security.h>
 +#include <linux/ima.h>
  #include <linux/hugetlb.h>
  #include <linux/profile.h>
  #include <linux/module.h>
@@@ -246,7 -245,7 +246,7 @@@ static struct vm_area_struct *remove_vm
        return next;
  }
  
asmlinkage unsigned long sys_brk(unsigned long brk)
SYSCALL_DEFINE1(brk, unsigned long, brk)
  {
        unsigned long rlim, retval;
        unsigned long newbrk, oldbrk;
@@@ -414,7 -413,7 +414,7 @@@ void __vma_link_rb(struct mm_struct *mm
  
  static void __vma_link_file(struct vm_area_struct *vma)
  {
-       struct file * file;
+       struct file *file;
  
        file = vma->vm_file;
        if (file) {
@@@ -475,11 -474,10 +475,10 @@@ static void vma_link(struct mm_struct *
   * insert vm structure into list and rbtree and anon_vma,
   * but it has already been inserted into prio_tree earlier.
   */
- static void
- __insert_vm_struct(struct mm_struct * mm, struct vm_area_struct * vma)
+ static void __insert_vm_struct(struct mm_struct *mm, struct vm_area_struct *vma)
  {
-       struct vm_area_struct * __vma, * prev;
-       struct rb_node ** rb_link, * rb_parent;
+       struct vm_area_struct *__vma, *prev;
+       struct rb_node **rb_link, *rb_parent;
  
        __vma = find_vma_prepare(mm, vma->vm_start,&prev, &rb_link, &rb_parent);
        BUG_ON(__vma && __vma->vm_start < vma->vm_end);
@@@ -660,6 -658,9 +659,9 @@@ again:                     remove_next = 1 + (end > next-
        validate_mm(mm);
  }
  
+ /* Flags that can be inherited from an existing mapping when merging */
+ #define VM_MERGEABLE_FLAGS (VM_CAN_NONLINEAR)
  /*
   * If the vma has a ->close operation then the driver probably needs to release
   * per-vma resources, so we don't attempt to merge those.
  static inline int is_mergeable_vma(struct vm_area_struct *vma,
                        struct file *file, unsigned long vm_flags)
  {
-       if (vma->vm_flags != vm_flags)
+       if ((vma->vm_flags ^ vm_flags) & ~VM_MERGEABLE_FLAGS)
                return 0;
        if (vma->vm_file != file)
                return 0;
@@@ -909,7 -910,7 +911,7 @@@ void vm_stat_account(struct mm_struct *
   * The caller must hold down_write(current->mm->mmap_sem).
   */
  
- unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
+ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
                        unsigned long len, unsigned long prot,
                        unsigned long flags, unsigned long pgoff)
  {
        }
  
        error = security_file_mmap(file, reqprot, prot, flags, addr, 0);
 +      if (error)
 +              return error;
 +      error = ima_file_mmap(file, prot);
        if (error)
                return error;
  
@@@ -1092,6 -1090,15 +1094,15 @@@ int vma_wants_writenotify(struct vm_are
                mapping_cap_account_dirty(vma->vm_file->f_mapping);
  }
  
+ /*
+  * We account for memory if it's a private writeable mapping,
+  * and VM_NORESERVE wasn't set.
+  */
+ static inline int accountable_mapping(unsigned int vm_flags)
+ {
+       return (vm_flags & (VM_NORESERVE | VM_SHARED | VM_WRITE)) == VM_WRITE;
+ }
  unsigned long mmap_region(struct file *file, unsigned long addr,
                          unsigned long len, unsigned long flags,
                          unsigned int vm_flags, unsigned long pgoff,
@@@ -1119,36 -1126,32 +1130,32 @@@ munmap_back
        if (!may_expand_vm(mm, len >> PAGE_SHIFT))
                return -ENOMEM;
  
-       if (flags & MAP_NORESERVE)
+       /*
+        * Set 'VM_NORESERVE' if we should not account for the
+        * memory use of this mapping. We only honor MAP_NORESERVE
+        * if we're allowed to overcommit memory.
+        */
+       if ((flags & MAP_NORESERVE) && sysctl_overcommit_memory != OVERCOMMIT_NEVER)
+               vm_flags |= VM_NORESERVE;
+       if (!accountable)
                vm_flags |= VM_NORESERVE;
  
-       if (accountable && (!(flags & MAP_NORESERVE) ||
-                           sysctl_overcommit_memory == OVERCOMMIT_NEVER)) {
-               if (vm_flags & VM_SHARED) {
-                       /* Check memory availability in shmem_file_setup? */
-                       vm_flags |= VM_ACCOUNT;
-               } else if (vm_flags & VM_WRITE) {
-                       /*
-                        * Private writable mapping: check memory availability
-                        */
-                       charged = len >> PAGE_SHIFT;
-                       if (security_vm_enough_memory(charged))
-                               return -ENOMEM;
-                       vm_flags |= VM_ACCOUNT;
-               }
+       /*
+        * Private writable mapping: check memory availability
+        */
+       if (accountable_mapping(vm_flags)) {
+               charged = len >> PAGE_SHIFT;
+               if (security_vm_enough_memory(charged))
+                       return -ENOMEM;
+               vm_flags |= VM_ACCOUNT;
        }
  
        /*
-        * Can we just expand an old private anonymous mapping?
-        * The VM_SHARED test is necessary because shmem_zero_setup
-        * will create the file object for a shared anonymous map below.
+        * Can we just expand an old mapping?
         */
-       if (!file && !(vm_flags & VM_SHARED)) {
-               vma = vma_merge(mm, prev, addr, addr + len, vm_flags,
-                                       NULL, NULL, pgoff, NULL);
-               if (vma)
-                       goto out;
-       }
+       vma = vma_merge(mm, prev, addr, addr + len, vm_flags, NULL, file, pgoff, NULL);
+       if (vma)
+               goto out;
  
        /*
         * Determine the object being mapped and call the appropriate
                        goto free_vma;
        }
  
-       /* We set VM_ACCOUNT in a shared mapping's vm_flags, to inform
-        * shmem_zero_setup (perhaps called through /dev/zero's ->mmap)
-        * that memory reservation must be checked; but that reservation
-        * belongs to shared memory object, not to vma: so now clear it.
-        */
-       if ((vm_flags & (VM_SHARED|VM_ACCOUNT)) == (VM_SHARED|VM_ACCOUNT))
-               vma->vm_flags &= ~VM_ACCOUNT;
        /* Can addr have changed??
         *
         * Answer: Yes, several device drivers can do it in their
        if (vma_wants_writenotify(vma))
                vma->vm_page_prot = vm_get_page_prot(vm_flags & ~VM_SHARED);
  
-       if (file && vma_merge(mm, prev, addr, vma->vm_end,
-                       vma->vm_flags, NULL, file, pgoff, vma_policy(vma))) {
-               mpol_put(vma_policy(vma));
-               kmem_cache_free(vm_area_cachep, vma);
-               fput(file);
-               if (vm_flags & VM_EXECUTABLE)
-                       removed_exe_file_vma(mm);
-       } else {
-               vma_link(mm, vma, prev, rb_link, rb_parent);
-               file = vma->vm_file;
-       }
+       vma_link(mm, vma, prev, rb_link, rb_parent);
+       file = vma->vm_file;
  
        /* Once vma denies write, undo our temporary denial count */
        if (correct_wcount)
@@@ -1468,7 -1454,7 +1458,7 @@@ get_unmapped_area(struct file *file, un
  EXPORT_SYMBOL(get_unmapped_area);
  
  /* Look up the first VMA which satisfies  addr < vm_end,  NULL if none. */
- struct vm_area_struct * find_vma(struct mm_struct * mm, unsigned long addr)
+ struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr)
  {
        struct vm_area_struct *vma = NULL;
  
@@@ -1511,7 -1497,7 +1501,7 @@@ find_vma_prev(struct mm_struct *mm, uns
                        struct vm_area_struct **pprev)
  {
        struct vm_area_struct *vma = NULL, *prev = NULL;
-       struct rb_node * rb_node;
+       struct rb_node *rb_node;
        if (!mm)
                goto out;
  
@@@ -1545,7 -1531,7 +1535,7 @@@ out
   * update accounting. This is shared with both the
   * grow-up and grow-down cases.
   */
- static int acct_stack_growth(struct vm_area_struct * vma, unsigned long size, unsigned long grow)
+ static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, unsigned long grow)
  {
        struct mm_struct *mm = vma->vm_mm;
        struct rlimit *rlim = current->signal->rlim;
@@@ -1953,7 -1939,7 +1943,7 @@@ int do_munmap(struct mm_struct *mm, uns
  
  EXPORT_SYMBOL(do_munmap);
  
asmlinkage long sys_munmap(unsigned long addr, size_t len)
SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len)
  {
        int ret;
        struct mm_struct *mm = current->mm;
@@@ -2095,6 -2081,9 +2085,9 @@@ void exit_mmap(struct mm_struct *mm
        arch_exit_mmap(mm);
        mmu_notifier_release(mm);
  
+       if (!mm->mmap)  /* Can happen if dup_mmap() received an OOM */
+               return;
        if (mm->locked_vm) {
                vma = mm->mmap;
                while (vma) {
        lru_add_drain();
        flush_cache_mm(mm);
        tlb = tlb_gather_mmu(mm, 1);
-       /* Don't update_hiwater_rss(mm) here, do_exit already did */
+       /* update_hiwater_rss(mm) here? but nobody should be looking */
        /* Use -1 here to ensure all VMAs in the mm are unmapped */
        end = unmap_vmas(&tlb, vma, 0, -1, &nr_accounted, NULL);
        vm_unacct_memory(nr_accounted);
@@@ -2474,3 -2463,13 +2467,13 @@@ void mm_drop_all_locks(struct mm_struc
  
        mutex_unlock(&mm_all_locks_mutex);
  }
+ /*
+  * initialise the VMA slab
+  */
+ void __init mmap_init(void)
+ {
+       vm_area_cachep = kmem_cache_create("vm_area_struct",
+                       sizeof(struct vm_area_struct), 0,
+                       SLAB_PANIC, NULL);
+ }
diff --combined mm/shmem.c
   * Copyright (c) 2004, Luke Kenneth Casson Leighton <lkcl@lkcl.net>
   * Copyright (c) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com>
   *
+  * tiny-shmem:
+  * Copyright (c) 2004, 2008 Matt Mackall <mpm@selenic.com>
+  *
   * This file is released under the GPL.
   */
  
+ #include <linux/fs.h>
+ #include <linux/init.h>
+ #include <linux/vfs.h>
+ #include <linux/mount.h>
+ #include <linux/file.h>
+ #include <linux/mm.h>
+ #include <linux/module.h>
+ #include <linux/swap.h>
+ static struct vfsmount *shm_mnt;
+ #ifdef CONFIG_SHMEM
  /*
   * This virtual memory filesystem is heavily based on the ramfs. It
   * extends ramfs by the ability to use swap and honor resource limits
   * which makes it a completely usable filesystem.
   */
  
- #include <linux/module.h>
- #include <linux/init.h>
- #include <linux/fs.h>
  #include <linux/xattr.h>
  #include <linux/exportfs.h>
  #include <linux/generic_acl.h>
- #include <linux/mm.h>
  #include <linux/mman.h>
- #include <linux/file.h>
- #include <linux/swap.h>
  #include <linux/pagemap.h>
  #include <linux/string.h>
  #include <linux/slab.h>
  #include <linux/backing-dev.h>
  #include <linux/shmem_fs.h>
- #include <linux/mount.h>
  #include <linux/writeback.h>
  #include <linux/vfs.h>
  #include <linux/blkdev.h>
@@@ -51,7 -59,6 +59,7 @@@
  #include <linux/highmem.h>
  #include <linux/seq_file.h>
  #include <linux/magic.h>
 +#include <linux/ima.h>
  
  #include <asm/uaccess.h>
  #include <asm/div64.h>
@@@ -921,7 -928,11 +929,11 @@@ found
        error = 1;
        if (!inode)
                goto out;
-       /* Precharge page using GFP_KERNEL while we can wait */
+       /*
+        * Charge page using GFP_KERNEL while we can wait.
+        * Charged back to the user(not to caller) when swap account is used.
+        * add_to_page_cache() will be called with GFP_NOWAIT.
+        */
        error = mem_cgroup_cache_charge(page, current->mm, GFP_KERNEL);
        if (error)
                goto out;
@@@ -1313,15 -1324,19 +1325,19 @@@ repeat
                } else {
                        shmem_swp_unmap(entry);
                        spin_unlock(&info->lock);
-                       unlock_page(swappage);
-                       page_cache_release(swappage);
                        if (error == -ENOMEM) {
                                /* allow reclaim from this memory cgroup */
-                               error = mem_cgroup_shrink_usage(current->mm,
+                               error = mem_cgroup_shrink_usage(swappage,
+                                                               current->mm,
                                                                gfp);
-                               if (error)
+                               if (error) {
+                                       unlock_page(swappage);
+                                       page_cache_release(swappage);
                                        goto failed;
+                               }
                        }
+                       unlock_page(swappage);
+                       page_cache_release(swappage);
                        goto repeat;
                }
        } else if (sgp == SGP_READ && !filepage) {
  
                        /* Precharge page while we can wait, compensate after */
                        error = mem_cgroup_cache_charge(filepage, current->mm,
-                                                       gfp & ~__GFP_HIGHMEM);
+                                       GFP_KERNEL);
                        if (error) {
                                page_cache_release(filepage);
                                shmem_unacct_blocks(info->flags, 1);
@@@ -1445,7 -1460,6 +1461,6 @@@ static int shmem_fault(struct vm_area_s
        if (error)
                return ((error == -ENOMEM) ? VM_FAULT_OOM : VM_FAULT_SIGBUS);
  
-       mark_page_accessed(vmf->page);
        return ret | VM_FAULT_LOCKED;
  }
  
@@@ -2487,7 -2501,6 +2502,6 @@@ static struct file_system_type tmpfs_fs
        .get_sb         = shmem_get_sb,
        .kill_sb        = kill_litter_super,
  };
- static struct vfsmount *shm_mnt;
  
  static int __init init_tmpfs(void)
  {
@@@ -2526,7 -2539,51 +2540,51 @@@ out4
        shm_mnt = ERR_PTR(error);
        return error;
  }
- module_init(init_tmpfs)
+ #else /* !CONFIG_SHMEM */
+ /*
+  * tiny-shmem: simple shmemfs and tmpfs using ramfs code
+  *
+  * This is intended for small system where the benefits of the full
+  * shmem code (swap-backed and resource-limited) are outweighed by
+  * their complexity. On systems without swap this code should be
+  * effectively equivalent, but much lighter weight.
+  */
+ #include <linux/ramfs.h>
+ static struct file_system_type tmpfs_fs_type = {
+       .name           = "tmpfs",
+       .get_sb         = ramfs_get_sb,
+       .kill_sb        = kill_litter_super,
+ };
+ static int __init init_tmpfs(void)
+ {
+       BUG_ON(register_filesystem(&tmpfs_fs_type) != 0);
+       shm_mnt = kern_mount(&tmpfs_fs_type);
+       BUG_ON(IS_ERR(shm_mnt));
+       return 0;
+ }
+ int shmem_unuse(swp_entry_t entry, struct page *page)
+ {
+       return 0;
+ }
+ #define shmem_file_operations ramfs_file_operations
+ #define shmem_vm_ops generic_file_vm_ops
+ #define shmem_get_inode ramfs_get_inode
+ #define shmem_acct_size(a, b) 0
+ #define shmem_unacct_size(a, b) do {} while (0)
+ #define SHMEM_MAX_BYTES LLONG_MAX
+ #endif /* CONFIG_SHMEM */
+ /* common code */
  
  /**
   * shmem_file_setup - get an unlinked file living in tmpfs
@@@ -2570,12 -2627,20 +2628,20 @@@ struct file *shmem_file_setup(char *nam
        if (!inode)
                goto close_file;
  
-       SHMEM_I(inode)->flags = flags & VM_ACCOUNT;
+ #ifdef CONFIG_SHMEM
+       SHMEM_I(inode)->flags = (flags & VM_NORESERVE) ? 0 : VM_ACCOUNT;
+ #endif
        d_instantiate(dentry, inode);
        inode->i_size = size;
        inode->i_nlink = 0;     /* It is unlinked */
        init_file(file, shm_mnt, dentry, FMODE_WRITE | FMODE_READ,
-                       &shmem_file_operations);
+                 &shmem_file_operations);
+ #ifndef CONFIG_MMU
+       error = ramfs_nommu_expand_for_mapping(inode, size);
+       if (error)
+               goto close_file;
+ #endif
        return file;
  
  close_file:
@@@ -2601,10 -2666,11 +2667,12 @@@ int shmem_zero_setup(struct vm_area_str
        if (IS_ERR(file))
                return PTR_ERR(file);
  
 +      ima_shm_check(file);
        if (vma->vm_file)
                fput(vma->vm_file);
        vma->vm_file = file;
        vma->vm_ops = &shmem_vm_ops;
        return 0;
  }
+ module_init(init_tmpfs)
diff --combined security/Kconfig
@@@ -55,8 -55,7 +55,8 @@@ config SECURITYF
        bool "Enable the securityfs filesystem"
        help
          This will build the securityfs filesystem.  It is currently used by
 -        the TPM bios character driver.  It is not used by SELinux or SMACK.
 +        the TPM bios character driver and IMA, an integrity provider.  It is
 +        not used by SELinux or SMACK.
  
          If you are unsure how to answer this question, answer N.
  
@@@ -82,6 -81,15 +82,15 @@@ config SECURITY_NETWORK_XFR
          IPSec.
          If you are unsure how to answer this question, answer N.
  
+ config SECURITY_PATH
+       bool "Security hooks for pathname based access control"
+       depends on SECURITY
+       help
+         This enables the security hooks for pathname based access control.
+         If enabled, a security module can use these hooks to
+         implement pathname based access controls.
+         If you are unsure how to answer this question, answer N.
  config SECURITY_FILE_CAPABILITIES
        bool "File POSIX Capabilities"
        default n
@@@ -127,7 -135,5 +136,7 @@@ config SECURITY_DEFAULT_MMAP_MIN_ADD
  source security/selinux/Kconfig
  source security/smack/Kconfig
  
 +source security/integrity/ima/Kconfig
 +
  endmenu
  
diff --combined security/inode.c
@@@ -61,9 -61,6 +61,6 @@@ static struct inode *get_inode(struct s
  
        if (inode) {
                inode->i_mode = mode;
-               inode->i_uid = 0;
-               inode->i_gid = 0;
-               inode->i_blocks = 0;
                inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
                switch (mode & S_IFMT) {
                default:
@@@ -205,11 -202,12 +202,11 @@@ static int create_by_name(const char *n
   * This function returns a pointer to a dentry if it succeeds.  This
   * pointer must be passed to the securityfs_remove() function when the file is
   * to be removed (no automatic cleanup happens if your module is unloaded,
 - * you are responsible here).  If an error occurs, %NULL is returned.
 + * you are responsible here).  If an error occurs, the function will return
 + * the erorr value (via ERR_PTR).
   *
   * If securityfs is not enabled in the kernel, the value %-ENODEV is
 - * returned.  It is not wise to check for this value, but rather, check for
 - * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling
 - * code.
 + * returned.
   */
  struct dentry *securityfs_create_file(const char *name, mode_t mode,
                                   struct dentry *parent, void *data,