1. 17 7月, 2014 1 次提交
  2. 04 6月, 2014 1 次提交
    • M
      ima: audit log files opened with O_DIRECT flag · f9b2a735
      Mimi Zohar 提交于
      Files are measured or appraised based on the IMA policy.  When a
      file, in policy, is opened with the O_DIRECT flag, a deadlock
      occurs.
      
      The first attempt at resolving this lockdep temporarily removed the
      O_DIRECT flag and restored it, after calculating the hash.  The
      second attempt introduced the O_DIRECT_HAVELOCK flag. Based on this
      flag, do_blockdev_direct_IO() would skip taking the i_mutex a second
      time.  The third attempt, by Dmitry Kasatkin, resolves the i_mutex
      locking issue, by re-introducing the IMA mutex, but uncovered
      another problem.  Reading a file with O_DIRECT flag set, writes
      directly to userspace pages.  A second patch allocates a user-space
      like memory.  This works for all IMA hooks, except ima_file_free(),
      which is called on __fput() to recalculate the file hash.
      
      Until this last issue is addressed, do not 'collect' the
      measurement for measuring, appraising, or auditing files opened
      with the O_DIRECT flag set.  Based on policy, permit or deny file
      access.  This patch defines a new IMA policy rule option named
      'permit_directio'.  Policy rules could be defined, based on LSM
      or other criteria, to permit specific applications to open files
      with the O_DIRECT flag set.
      
      Changelog v1:
      - permit or deny file access based IMA policy rules
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Acked-by: NDmitry Kasatkin <d.kasatkin@samsung.com>
      Cc: <stable@vger.kernel.org>
      f9b2a735
  3. 03 6月, 2014 1 次提交
  4. 29 5月, 2014 1 次提交
    • A
      PCI: Introduce new device binding path using pci_dev.driver_override · 782a985d
      Alex Williamson 提交于
      The driver_override field allows us to specify the driver for a device
      rather than relying on the driver to provide a positive match of the
      device.  This shortcuts the existing process of looking up the vendor and
      device ID, adding them to the driver new_id, binding the device, then
      removing the ID, but it also provides a couple advantages.
      
      First, the above existing process allows the driver to bind to any device
      matching the new_id for the window where it's enabled.  This is often not
      desired, such as the case of trying to bind a single device to a meta
      driver like pci-stub or vfio-pci.  Using driver_override we can do this
      deterministically using:
      
        echo pci-stub > /sys/bus/pci/devices/0000:03:00.0/driver_override
        echo 0000:03:00.0 > /sys/bus/pci/devices/0000:03:00.0/driver/unbind
        echo 0000:03:00.0 > /sys/bus/pci/drivers_probe
      
      Previously we could not invoke drivers_probe after adding a device to
      new_id for a driver as we get non-deterministic behavior whether the driver
      we intend or the standard driver will claim the device.  Now it becomes a
      deterministic process, only the driver matching driver_override will probe
      the device.
      
      To return the device to the standard driver, we simply clear the
      driver_override and reprobe the device:
      
        echo > /sys/bus/pci/devices/0000:03:00.0/driver_override
        echo 0000:03:00.0 > /sys/bus/pci/devices/0000:03:00.0/driver/unbind
        echo 0000:03:00.0 > /sys/bus/pci/drivers_probe
      
      Another advantage to this approach is that we can specify a driver override
      to force a specific binding or prevent any binding.  For instance when an
      IOMMU group is exposed to userspace through VFIO we require that all
      devices within that group are owned by VFIO.  However, devices can be
      hot-added into an IOMMU group, in which case we want to prevent the device
      from binding to any driver (override driver = "none") or perhaps have it
      automatically bind to vfio-pci.  With driver_override it's a simple matter
      for this field to be set internally when the device is first discovered to
      prevent driver matches.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: NAlexander Graf <agraf@suse.de>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      782a985d
  5. 28 5月, 2014 1 次提交
  6. 26 5月, 2014 4 次提交
  7. 24 5月, 2014 1 次提交
  8. 14 5月, 2014 3 次提交
    • A
      usb: gadget: configfs: OS Extended Properties descriptors support · 7419485f
      Andrzej Pietrasiewicz 提交于
      Add handling of OS Extended Properties descriptors from configfs interface.
      One kind of "OS Descriptors" are "Extended Properties" descriptors, which
      need to be specified per interface or per group of interfaces described
      by an IAD. This patch adds support for creating subdirectories
      in interface.<n> directory located in the function's directory.
      Names of subdirectories created become names of properties.
      Each property contains two attributes: "type" and "data".
      The type can be a numeric value 1..7 while data is a blob interpreted
      depending on the type specified.
      The types are:
      1 - unicode string
      2 - unicode string with environment variables
      3 - binary
      4 - little-endian 32-bit
      5 - big-endian 32-bit
      6 - unicode string with a symbolic link
      7 - multiple unicode strings
      Signed-off-by: NAndrzej Pietrasiewicz <andrzej.p@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      7419485f
    • A
      usb: gadget: configfs: OS Extended Compatibility descriptors support · da424314
      Andrzej Pietrasiewicz 提交于
      Add handling of OS Extended Compatibility descriptors from configfs interface.
      Hosts which expect the "OS Descriptors" ask only for configurations @ index 0,
      but linux-based USB devices can provide more than one configuration.
      This patch adds marking one of gadget's configurations the configuration
      to be reported at index 0, regardless of the actual sequence of usb_add_config
      invocations used for adding the configurations. The configuration is selected
      by creating a symbolic link pointing to it from the "os_desc" directory
      located at the top of a gadget's directory hierarchy.
      
      One kind of "OS Descriptors" are "Extended Compatibility Descriptors",
      which need to be specified per interface. This patch adds interface.<n>
      directory in function's configfs directory to represent each interface
      defined by the function. Each interface's directory contains two attributes:
      "compatible_id" and "sub_compatible_id", which represent 8-byte
      strings to be reported to the host as the "Compatible ID" and "Sub Compatible
      ID".
      Signed-off-by: NAndrzej Pietrasiewicz <andrzej.p@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      da424314
    • A
      usb: gadget: configfs: OS String support · 87213d38
      Andrzej Pietrasiewicz 提交于
      Add handling of OS String extension from the configfs interface.
      A directory "os_desc" is added at the top level of a gadget's
      directories hierarchy. In the "os_desc" directory there are
      three attributes: "use", "b_vendor_code" and "qw_sign".
      If "use" contains "0" the OS string is not reported to the host.
      "b_vendor_code" contains a one-byte value which is used
      for custom per-device and per-interface requests.
      "qw_sign" contains an identifier to be reported as the "OS String"
      proper.
      Signed-off-by: NAndrzej Pietrasiewicz <andrzej.p@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      87213d38
  9. 03 5月, 2014 3 次提交
  10. 01 5月, 2014 1 次提交
  11. 30 4月, 2014 1 次提交
  12. 26 4月, 2014 2 次提交
  13. 25 4月, 2014 1 次提交
  14. 15 4月, 2014 3 次提交
    • V
      HID: thingm: refactor blink(1) support · f70ed8a6
      Vivien Didelot 提交于
      This patch refactors the way the thingm driver registers a blink(1) LED.
      In order to make the driver simpler and more standard, drop the "rgb"
      sysfs attribute and create one instance of LED class per RGB channel.
      
      Actually, the name of the LED class instance registered for a blink(1)
      device is "blink1::ABCD", where ABCD is the last 4 chars of the serial
      number. The driver now registers 3 instances per RGB chip, named
      "thingmX:{red,green,blue}:ledY" where X is the hidraw minor number and Y
      is the RGB chip number (as seen by the firmware).
      
      This patch also uses work queues to defer calls with the device, which
      now allows triggers to work as expected with this LED device.
      
      Also remove the brightness structure field and the brightness_get
      backend, as it is already handled by the LED class, and changes the
      prefix of functions and structures to thingm_ to match the driver name.
      Signed-off-by: NVivien Didelot <vivien.didelot@savoirfairelinux.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      f70ed8a6
    • V
      HID: thingm: remove the "fade" sysfs attribute · aee114fd
      Vivien Didelot 提交于
      As for the "play" sysfs attribute, remove this other non-standard
      attribute, so the driver only implements what is required to switch the
      LED on and off. Thus, a fade time won't be ideal for some fast-changing
      triggers.
      Signed-off-by: NVivien Didelot <vivien.didelot@savoirfairelinux.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      aee114fd
    • V
      HID: thingm: remove the "play" sysfs attribute · 21200ad1
      Vivien Didelot 提交于
      When the thingm driver registers an instance of LED class, it creates a
      "play" sysfs attribute for this blink(1) specific feature.
      
      Since this feature is not specific to the RGB chip but to the HID device
      itself, let's remove this attribute from the LED instance and only
      implement what is useful to switch on and off the LED.
      
      This feature is still easily accessible through hidraw.
      Signed-off-by: NVivien Didelot <vivien.didelot@savoirfairelinux.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      21200ad1
  15. 08 4月, 2014 3 次提交
    • S
      zram: make compression algorithm selection possible · e46b8a03
      Sergey Senozhatsky 提交于
      Add and document `comp_algorithm' device attribute.  This attribute allows
      to show supported compression and currently selected compression
      algorithms:
      
      	cat /sys/block/zram0/comp_algorithm
      	[lzo] lz4
      
      and change selected compression algorithm:
      	echo lzo > /sys/block/zram0/comp_algorithm
      Signed-off-by: NSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Acked-by: NMinchan Kim <minchan@kernel.org>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e46b8a03
    • S
      zram: add multi stream functionality · beca3ec7
      Sergey Senozhatsky 提交于
      Existing zram (zcomp) implementation has only one compression stream
      (buffer and algorithm private part), so in order to prevent data
      corruption only one write (compress operation) can use this compression
      stream, forcing all concurrent write operations to wait for stream lock
      to be released.  This patch changes zcomp to keep a compression streams
      list of user-defined size (via sysfs device attr).  Each write operation
      still exclusively holds compression stream, the difference is that we
      can have N write operations (depending on size of streams list)
      executing in parallel.  See TEST section later in commit message for
      performance data.
      
      Introduce struct zcomp_strm_multi and a set of functions to manage
      zcomp_strm stream access.  zcomp_strm_multi has a list of idle
      zcomp_strm structs, spinlock to protect idle list and wait queue, making
      it possible to perform parallel compressions.
      
      The following set of functions added:
      - zcomp_strm_multi_find()/zcomp_strm_multi_release()
        find and release a compression stream, implement required locking
      - zcomp_strm_multi_create()/zcomp_strm_multi_destroy()
        create and destroy zcomp_strm_multi
      
      zcomp ->strm_find() and ->strm_release() callbacks are set during
      initialisation to zcomp_strm_multi_find()/zcomp_strm_multi_release()
      correspondingly.
      
      Each time zcomp issues a zcomp_strm_multi_find() call, the following set
      of operations performed:
      
      - spin lock strm_lock
      - if idle list is not empty, remove zcomp_strm from idle list, spin
        unlock and return zcomp stream pointer to caller
      - if idle list is empty, current adds itself to wait queue. it will be
        awaken by zcomp_strm_multi_release() caller.
      
      zcomp_strm_multi_release():
      - spin lock strm_lock
      - add zcomp stream to idle list
      - spin unlock, wake up sleeper
      
      Minchan Kim reported that spinlock-based locking scheme has demonstrated
      a severe perfomance regression for single compression stream case,
      comparing to mutex-based (see https://lkml.org/lkml/2014/2/18/16)
      
      base                      spinlock                    mutex
      
      ==Initial write           ==Initial write             ==Initial  write
      records:  5               records:  5                 records:   5
      avg:      1642424.35      avg:      699610.40         avg:       1655583.71
      std:      39890.95(2.43%) std:      232014.19(33.16%) std:       52293.96
      max:      1690170.94      max:      1163473.45        max:       1697164.75
      min:      1568669.52      min:      573429.88         min:       1553410.23
      ==Rewrite                 ==Rewrite                   ==Rewrite
      records:  5               records:  5                 records:   5
      avg:      1611775.39      avg:      501406.64         avg:       1684419.11
      std:      17144.58(1.06%) std:      15354.41(3.06%)   std:       18367.42
      max:      1641800.95      max:      531356.78         max:       1706445.84
      min:      1593515.27      min:      488817.78         min:       1655335.73
      
      When only one compression stream available, mutex with spin on owner
      tends to perform much better than frequent wait_event()/wake_up().  This
      is why single stream implemented as a special case with mutex locking.
      
      Introduce and document zram device attribute max_comp_streams.  This
      attr shows and stores current zcomp's max number of zcomp streams
      (max_strm).  Extend zcomp's zcomp_create() with `max_strm' parameter.
      `max_strm' limits the number of zcomp_strm structs in compression
      backend's idle list (max_comp_streams).
      
      max_comp_streams used during initialisation as follows:
      -- passing to zcomp_create() max_strm equals to 1 will initialise zcomp
      using single compression stream zcomp_strm_single (mutex-based locking).
      -- passing to zcomp_create() max_strm greater than 1 will initialise zcomp
      using multi compression stream zcomp_strm_multi (spinlock-based locking).
      
      default max_comp_streams value is 1, meaning that zram with single stream
      will be initialised.
      
      Later patch will introduce configuration knob to change max_comp_streams
      on already initialised and used zcomp.
      
      TEST
      iozone -t 3 -R -r 16K -s 60M -I +Z
      
             test           base       1 strm (mutex)     3 strm (spinlock)
      -----------------------------------------------------------------------
       Initial write      589286.78       583518.39          718011.05
             Rewrite      604837.97       596776.38         1515125.72
        Random write      584120.11       595714.58         1388850.25
              Pwrite      535731.17       541117.38          739295.27
              Fwrite     1418083.88      1478612.72         1484927.06
      
      Usage example:
      set max_comp_streams to 4
              echo 4 > /sys/block/zram0/max_comp_streams
      
      show current max_comp_streams (default value is 1).
              cat /sys/block/zram0/max_comp_streams
      Signed-off-by: NSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Acked-by: NMinchan Kim <minchan@kernel.org>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      beca3ec7
    • S
      zram: document failed_reads, failed_writes stats · 8dd1d324
      Sergey Senozhatsky 提交于
      Document `failed_reads' and `failed_writes' device attributes.
      Remove info about `discard' - there is no such zram attr.
      Signed-off-by: NSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8dd1d324
  16. 07 4月, 2014 1 次提交
  17. 01 4月, 2014 1 次提交
  18. 31 3月, 2014 1 次提交
    • R
      Use 'E' instead of 'X' for unsigned module taint flag. · 57673c2b
      Rusty Russell 提交于
      Takashi Iwai <tiwai@suse.de> says:
      > The letter 'X' has been already used for SUSE kernels for very long
      > time, to indicate the external supported modules.  Can the new flag be
      > changed to another letter for avoiding conflict...?
      > (BTW, we also use 'N' for "no support", too.)
      
      Note: this code should be cleaned up, so we don't have such maps in
      three places!
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      57673c2b
  19. 24 3月, 2014 2 次提交
  20. 22 3月, 2014 2 次提交
  21. 20 3月, 2014 2 次提交
    • J
      f2fs: add missing documentation for dir_level · 91796825
      Jaegeuk Kim 提交于
      This patch adds missing dir_level documentation.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      91796825
    • J
      f2fs: throttle the memory footprint with a sysfs entry · cdfc41c1
      Jaegeuk Kim 提交于
      This patch introduces ram_thresh, a sysfs entry, which controls the memory
      footprint used by the free nid list and the nat cache.
      
      Previously, the free nid list was controlled by MAX_FREE_NIDS, while the nat
      cache was managed by NM_WOUT_THRESHOLD.
      However, this approach cannot be applied dynamically according to the system.
      
      So, this patch adds ram_thresh that users can specify the threshold, which is
      in order of 1 / 1024.
      For example, if the total ram size is 4GB and the value is set to 10 by default,
      f2fs tries to control the number of free nids and nat caches not to consume over
      10 * (4GB / 1024) = 10MB.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      cdfc41c1
  22. 17 3月, 2014 2 次提交
  23. 16 3月, 2014 1 次提交
  24. 13 3月, 2014 1 次提交
    • M
      Fix: module signature vs tracepoints: add new TAINT_UNSIGNED_MODULE · 66cc69e3
      Mathieu Desnoyers 提交于
      Users have reported being unable to trace non-signed modules loaded
      within a kernel supporting module signature.
      
      This is caused by tracepoint.c:tracepoint_module_coming() refusing to
      take into account tracepoints sitting within force-loaded modules
      (TAINT_FORCED_MODULE). The reason for this check, in the first place, is
      that a force-loaded module may have a struct module incompatible with
      the layout expected by the kernel, and can thus cause a kernel crash
      upon forced load of that module on a kernel with CONFIG_TRACEPOINTS=y.
      
      Tracepoints, however, specifically accept TAINT_OOT_MODULE and
      TAINT_CRAP, since those modules do not lead to the "very likely system
      crash" issue cited above for force-loaded modules.
      
      With kernels having CONFIG_MODULE_SIG=y (signed modules), a non-signed
      module is tainted re-using the TAINT_FORCED_MODULE taint flag.
      Unfortunately, this means that Tracepoints treat that module as a
      force-loaded module, and thus silently refuse to consider any tracepoint
      within this module.
      
      Since an unsigned module does not fit within the "very likely system
      crash" category of tainting, add a new TAINT_UNSIGNED_MODULE taint flag
      to specifically address this taint behavior, and accept those modules
      within Tracepoints. We use the letter 'X' as a taint flag character for
      a module being loaded that doesn't know how to sign its name (proposed
      by Steven Rostedt).
      
      Also add the missing 'O' entry to trace event show_module_flags() list
      for the sake of completeness.
      Signed-off-by: NMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      NAKed-by: NIngo Molnar <mingo@redhat.com>
      CC: Thomas Gleixner <tglx@linutronix.de>
      CC: David Howells <dhowells@redhat.com>
      CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      66cc69e3