1. 28 10月, 2010 1 次提交
  2. 27 10月, 2010 20 次提交
    • L
      Merge branch 'ima-memory-use-fixes' · f9ba5375
      Linus Torvalds 提交于
      * ima-memory-use-fixes:
        IMA: fix the ToMToU logic
        IMA: explicit IMA i_flag to remove global lock on inode_delete
        IMA: drop refcnt from ima_iint_cache since it isn't needed
        IMA: only allocate iint when needed
        IMA: move read counter into struct inode
        IMA: use i_writecount rather than a private counter
        IMA: use inode->i_lock to protect read and write counters
        IMA: convert internal flags from long to char
        IMA: use unsigned int instead of long for counters
        IMA: drop the inode opencount since it isn't needed for operation
        IMA: use rbtree instead of radix tree for inode information cache
      f9ba5375
    • E
      IMA: fix the ToMToU logic · bade72d6
      Eric Paris 提交于
      Current logic looks like this:
      
              rc = ima_must_measure(NULL, inode, MAY_READ, FILE_CHECK);
              if (rc < 0)
                      goto out;
      
              if (mode & FMODE_WRITE) {
                      if (inode->i_readcount)
                              send_tomtou = true;
                      goto out;
              }
      
              if (atomic_read(&inode->i_writecount) > 0)
                      send_writers = true;
      
      Lets assume we have a policy which states that all files opened for read
      by root must be measured.
      
      Lets assume the file has permissions 777.
      
      Lets assume that root has the given file open for read.
      
      Lets assume that a non-root process opens the file write.
      
      The non-root process will get to ima_counts_get() and will check the
      ima_must_measure().  Since it is not supposed to measure it will goto
      out.
      
      We should check the i_readcount no matter what since we might be causing
      a ToMToU voilation!
      
      This is close to correct, but still not quite perfect.  The situation
      could have been that root, which was interested in the mesurement opened
      and closed the file and another process which is not interested in the
      measurement is the one holding the i_readcount ATM.  This is just overly
      strict on ToMToU violations, which is better than not strict enough...
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Acked-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      bade72d6
    • E
      IMA: explicit IMA i_flag to remove global lock on inode_delete · 196f5181
      Eric Paris 提交于
      Currently for every removed inode IMA must take a global lock and search
      the IMA rbtree looking for an associated integrity structure.  Instead
      we explicitly mark an inode when we add an integrity structure so we
      only have to take the global lock and do the removal if it exists.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Acked-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      196f5181
    • E
      IMA: drop refcnt from ima_iint_cache since it isn't needed · 64c62f06
      Eric Paris 提交于
      Since finding a struct ima_iint_cache requires a valid struct inode, and
      the struct ima_iint_cache is supposed to have the same lifetime as a
      struct inode (technically they die together but don't need to be created
      at the same time) we don't have to worry about the ima_iint_cache
      outliving or dieing before the inode.  So the refcnt isn't useful.  Just
      get rid of it and free the structure when the inode is freed.
      Signed-off-by: NEric Paris <eapris@redhat.com>
      Acked-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      64c62f06
    • E
      IMA: only allocate iint when needed · bc7d2a3e
      Eric Paris 提交于
      IMA always allocates an integrity structure to hold information about
      every inode, but only needed this structure to track the number of
      readers and writers currently accessing a given inode.  Since that
      information was moved into struct inode instead of the integrity struct
      this patch stops allocating the integrity stucture until it is needed.
      Thus greatly reducing memory usage.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Acked-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      bc7d2a3e
    • E
      IMA: move read counter into struct inode · a178d202
      Eric Paris 提交于
      IMA currently allocated an inode integrity structure for every inode in
      core.  This stucture is about 120 bytes long.  Most files however
      (especially on a system which doesn't make use of IMA) will never need
      any of this space.  The problem is that if IMA is enabled we need to
      know information about the number of readers and the number of writers
      for every inode on the box.  At the moment we collect that information
      in the per inode iint structure and waste the rest of the space.  This
      patch moves those counters into the struct inode so we can eventually
      stop allocating an IMA integrity structure except when absolutely
      needed.
      
      This patch does the minimum needed to move the location of the data.
      Further cleanups, especially the location of counter updates, may still
      be possible.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Acked-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a178d202
    • E
      IMA: use i_writecount rather than a private counter · b9593d30
      Eric Paris 提交于
      IMA tracks the number of struct files which are holding a given inode
      readonly and the number which are holding the inode write or r/w.  It
      needs this information so when a new reader or writer comes in it can
      tell if this new file will be able to invalidate results it already made
      about existing files.
      
      aka if a task is holding a struct file open RO, IMA measured the file
      and recorded those measurements and then a task opens the file RW IMA
      needs to note in the logs that the old measurement may not be correct.
      It's called a "Time of Measure Time of Use" (ToMToU) issue.  The same is
      true is a RO file is opened to an inode which has an open writer.  We
      cannot, with any validity, measure the file in question since it could
      be changing.
      
      This patch attempts to use the i_writecount field to track writers.  The
      i_writecount field actually embeds more information in it's value than
      IMA needs but it should work for our purposes and allow us to shrink the
      struct inode even more.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Acked-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b9593d30
    • E
      IMA: use inode->i_lock to protect read and write counters · ad16ad00
      Eric Paris 提交于
      Currently IMA used the iint->mutex to protect the i_readcount and
      i_writecount.  This patch uses the inode->i_lock since we are going to
      start using in inode objects and that is the most appropriate lock.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Acked-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ad16ad00
    • E
      IMA: convert internal flags from long to char · 15aac676
      Eric Paris 提交于
      The IMA flags is an unsigned long but there is only 1 flag defined.
      Lets save a little space and make it a char.  This packs nicely next to
      the array of u8's.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Acked-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      15aac676
    • E
      IMA: use unsigned int instead of long for counters · 497f3233
      Eric Paris 提交于
      Currently IMA uses 2 longs in struct inode.  To save space (and as it
      seems impossible to overflow 32 bits) we switch these to unsigned int.
      The switch to unsigned does require slightly different checks for
      underflow, but it isn't complex.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Acked-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      497f3233
    • E
      IMA: drop the inode opencount since it isn't needed for operation · b575156d
      Eric Paris 提交于
      The opencount was used to help debugging to make sure that everything
      which created a struct file also correctly made the IMA calls.  Since we
      moved all of that into the VFS this isn't as necessary.  We should be
      able to get the same amount of debugging out of just the reader and
      write count.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Acked-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b575156d
    • E
      IMA: use rbtree instead of radix tree for inode information cache · 85491641
      Eric Paris 提交于
      The IMA code needs to store the number of tasks which have an open fd
      granting permission to write a file even when IMA is not in use.  It
      needs this information in order to be enabled at a later point in time
      without losing it's integrity garantees.
      
      At the moment that means we store a little bit of data about every inode
      in a cache.  We use a radix tree key'd on the inode's memory address.
      Dave Chinner pointed out that a radix tree is a terrible data structure
      for such a sparse key space.  This patch switches to using an rbtree
      which should be more efficient.
      
      Bug report from Dave:
      
       "I just noticed that slabtop was reporting an awfully high usage of
        radix tree nodes:
      
         OBJS ACTIVE  USE OBJ SIZE  SLABS OBJ/SLAB CACHE SIZE NAME
        4200331 2778082  66%    0.55K 144839       29   2317424K radix_tree_node
        2321500 2060290  88%    1.00K  72581       32   2322592K xfs_inode
        2235648 2069791  92%    0.12K  69864       32    279456K iint_cache
      
        That is, 2.7M radix tree nodes are allocated, and the cache itself is
        consuming 2.3GB of RAM.  I know that the XFS inodei caches are indexed
        by radix tree node, but for 2 million cached inodes that would mean a
        density of 1 inode per radix tree node, which for a system with 16M
        inodes in the filsystems is an impossibly low density.  The worst I've
        seen in a production system like kernel.org is about 20-25% density,
        which would mean about 150-200k radix tree nodes for that many inodes.
        So it's not the inode cache.
      
        So I looked up what the iint_cache was.  It appears to used for
        storing per-inode IMA information, and uses a radix tree for indexing.
        It uses the *address* of the struct inode as the indexing key.  That
        means the key space is extremely sparse - for XFS the struct inode
        addresses are approximately 1000 bytes apart, which means the closest
        the radix tree index keys get is ~1000.  Which means that there is a
        single entry per radix tree leaf node, so the radix tree is using
        roughly 550 bytes for every 120byte structure being cached.  For the
        above example, it's probably wasting close to 1GB of RAM...."
      Reported-by: NDave Chinner <david@fromorbit.com>
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Acked-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      85491641
    • L
      Merge git://git.infradead.org/battery-2.6 · 45352bbf
      Linus Torvalds 提交于
      * git://git.infradead.org/battery-2.6:
        power_supply: Makefile cleanup
        bq27x00_battery: Add missing kfree(di->bus) in bq27x00_battery_remove()
        power_supply: Introduce maximum current property
        power_supply: Add types for USB chargers
        ds2782_battery: Fix units
        power_supply: Add driver for TWL4030/TPS65950 BCI charger
        bq20z75: Add support for more power supply properties
        wm831x_power: Add missing kfree(wm831x_power) in wm831x_power_remove()
        jz4740-battery: Add missing kfree(jz_battery) in jz_battery_remove()
        ds2760_battery: Add missing kfree(di) in ds2760_battery_remove()
        olpc_battery: Fix endian neutral breakage for s16 values
        ds2760_battery: Fix W1 and W1_SLAVE_DS2760 dependency
        pcf50633-charger: Add missing sysfs_remove_group()
        power_supply: Add driver for TI BQ20Z75 gas gauge IC
        wm831x_power: Remove duplicate chg mask
        omap: rx51: Add support for USB chargers
        power_supply: Add isp1704 charger detection driver
      45352bbf
    • L
      Merge branch 'linux_next' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/i7core · da62aa69
      Linus Torvalds 提交于
      * 'linux_next' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/i7core: (34 commits)
        i7core_edac: return -ENODEV when devices were already probed
        i7core_edac: properly terminate pci_dev_table
        i7core_edac: Avoid PCI refcount to reach zero on successive load/reload
        i7core_edac: Fix refcount error at PCI devices
        i7core_edac: it is safe to i7core_unregister_mci() when mci=NULL
        i7core_edac: Fix an oops at i7core probe
        i7core_edac: Remove unused member channels in i7core_pvt
        i7core_edac: Remove unused arg csrow from get_dimm_config
        i7core_edac: Reduce args of i7core_register_mci
        i7core_edac: Introduce i7core_unregister_mci
        i7core_edac: Use saved pointers
        i7core_edac: Check probe counter in i7core_remove
        i7core_edac: Call pci_dev_put() when alloc_i7core_dev()  failed
        i7core_edac: Fix error path of i7core_register_mci
        i7core_edac: Fix order of lines in i7core_register_mci
        i7core_edac: Always do get/put for all devices
        i7core_edac: Introduce i7core_pci_ctl_create/release
        i7core_edac: Introduce free_i7core_dev
        i7core_edac: Introduce alloc_i7core_dev
        i7core_edac: Reduce args of i7core_get_onedevice
        ...
      da62aa69
    • L
      Merge branch 'hwpoison' of git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-mce-2.6 · f1ebdd60
      Linus Torvalds 提交于
      * 'hwpoison' of git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-mce-2.6: (22 commits)
        Add _addr_lsb field to ia64 siginfo
        Fix migration.c compilation on s390
        HWPOISON: Remove retry loop for try_to_unmap
        HWPOISON: Turn addr_valid from bitfield into char
        HWPOISON: Disable DEBUG by default
        HWPOISON: Convert pr_debugs to pr_info
        HWPOISON: Improve comments in memory-failure.c
        x86: HWPOISON: Report correct address granuality for huge hwpoison faults
        Encode huge page size for VM_FAULT_HWPOISON errors
        Fix build error with !CONFIG_MIGRATION
        hugepage: move is_hugepage_on_freelist inside ifdef to avoid warning
        Clean up __page_set_anon_rmap
        HWPOISON, hugetlb: fix unpoison for hugepage
        HWPOISON, hugetlb: soft offlining for hugepage
        HWPOSION, hugetlb: recover from free hugepage error when !MF_COUNT_INCREASED
        hugetlb: move refcounting in hugepage allocation inside hugetlb_lock
        HWPOISON, hugetlb: add free check to dequeue_hwpoison_huge_page()
        hugetlb: hugepage migration core
        hugetlb: redefine hugepage copy functions
        hugetlb: add allocate function for hugepage migration
        ...
      f1ebdd60
    • L
      Merge branch 'for_linus' of git://github.com/at91linux/linux-2.6-at91 · f99d0553
      Linus Torvalds 提交于
      * 'for_linus' of git://github.com/at91linux/linux-2.6-at91:
        AT91: rtc: enable built-in RTC in Kconfig for at91sam9g45 family
        at91/atmel-mci: inclusion of sd/mmc driver in at91sam9g45 chip and board
        AT91: pm: make sure that r0 is 0 when dealing with cache operations
        AT91: pm: use plain cpu_do_idle() for "wait for interrupt"
        AT91: reset: extend alternate reset procedure to several chips
        AT91: reset routine cleanup, remove not needed icache flush
        AT91: trivial: align comment of at91sam9g20_reset with one more tab
        AT91: Fix AT91SAM9G20 reset as per the errata in the data sheet
        AT91: add board support for Pcontrol_G20
      f99d0553
    • L
      Merge branch 'for-linus' of git://gitorious.org/linux-omap-dss2/linux · 2c518959
      Linus Torvalds 提交于
      * 'for-linus' of git://gitorious.org/linux-omap-dss2/linux:
        OMAP: DSS2: don't power off a panel twice
        OMAP: DSS2: OMAPFB: Allow usage of def_vrfb only for omap2,3
        OMAP: DSS2: OMAPFB: make VRFB depends on OMAP2,3
        OMAP: DSS2: OMAPFB: Allow FB_OMAP2 to build without VRFB
        arm/omap: simplify conditional
        OMAP: DSS2: DSI: Remove extra iounmap in error path
        OMAP: DSS2: Use dss_features framework on DSS2 code
        OMAP: DSS2: Introduce dss_features files
        video/omap: remove mux.h include
        ARM: omap/fb: move get_fbmem_region() to .init.text
        ARM: omap/fb: move omapfb_reserve_sram to .init.text
        ARM: omap/fb: move omap_init_fb to .init.text
        OMAP: DSS2: OMAPFB: swap front and back porches for both hsync and vsync
        OMAP: DSS2: make filter coefficient tables human readable
        OMAP: DSS2: Add SPI dependency to Kconfig of ACX565AKM panel
      2c518959
    • L
      Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq · 4f687603
      Linus Torvalds 提交于
      * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq:
        [CPUFREQ]: x86, cpufreq: Mark longrun_get_policy with __cpuinit.
        [CPUFREQ] add sampling_down_factor tunable to improve ondemand performance
        [CPUFREQ] arch/x86/kernel/cpu/cpufreq: Fix unsigned return type
        [CPUFREQ] drivers/cpufreq: Adjust confusing if indentation
      4f687603
    • L
      Merge branch 'for-2.6.37' of git://linux-nfs.org/~bfields/linux · 4390110f
      Linus Torvalds 提交于
      * 'for-2.6.37' of git://linux-nfs.org/~bfields/linux: (99 commits)
        svcrpc: svc_tcp_sendto XPT_DEAD check is redundant
        svcrpc: no need for XPT_DEAD check in svc_xprt_enqueue
        svcrpc: assume svc_delete_xprt() called only once
        svcrpc: never clear XPT_BUSY on dead xprt
        nfsd4: fix connection allocation in sequence()
        nfsd4: only require krb5 principal for NFSv4.0 callbacks
        nfsd4: move minorversion to client
        nfsd4: delay session removal till free_client
        nfsd4: separate callback change and callback probe
        nfsd4: callback program number is per-session
        nfsd4: track backchannel connections
        nfsd4: confirm only on succesful create_session
        nfsd4: make backchannel sequence number per-session
        nfsd4: use client pointer to backchannel session
        nfsd4: move callback setup into session init code
        nfsd4: don't cache seq_misordered replies
        SUNRPC: Properly initialize sock_xprt.srcaddr in all cases
        SUNRPC: Use conventional switch statement when reclassifying sockets
        sunrpc/xprtrdma: clean up workqueue usage
        sunrpc: Turn list_for_each-s into the ..._entry-s
        ...
      
      Fix up trivial conflicts (two different deprecation notices added in
      separate branches) in Documentation/feature-removal-schedule.txt
      4390110f
    • L
      Merge branch 'nfs-for-2.6.37' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6 · a4dd8dce
      Linus Torvalds 提交于
      * 'nfs-for-2.6.37' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6:
        net/sunrpc: Use static const char arrays
        nfs4: fix channel attribute sanity-checks
        NFSv4.1: Use more sensible names for 'initialize_mountpoint'
        NFSv4.1: pnfs: filelayout: add driver's LAYOUTGET and GETDEVICEINFO infrastructure
        NFSv4.1: pnfs: add LAYOUTGET and GETDEVICEINFO infrastructure
        NFS: client needs to maintain list of inodes with active layouts
        NFS: create and destroy inode's layout cache
        NFSv4.1: pnfs: filelayout: introduce minimal file layout driver
        NFSv4.1: pnfs: full mount/umount infrastructure
        NFS: set layout driver
        NFS: ask for layouttypes during v4 fsinfo call
        NFS: change stateid to be a union
        NFSv4.1: pnfsd, pnfs: protocol level pnfs constants
        SUNRPC: define xdr_decode_opaque_fixed
        NFSD: remove duplicate NFS4_STATEID_SIZE
      a4dd8dce
  3. 26 10月, 2010 19 次提交