1. 15 Jun, 2017 10 commits
    • Yasunori Goto's avatar
      tools/testing/nvdimm: fix nfit_test buffer overflow · a117699c
      Yasunori Goto authored
      The root cause of panic is the num_pm of nfit_test1 is wrong.
      Though 1 is specified for num_pm at nfit_test_init(), it must be 2,
      because nfit_test1->spa_set[] array has 2 elements.
      
      Since the array is smaller than expected, the driver breaks other area.
      (it is often the link list of devres).
      
      As a result, panic occurs like the following example.
      
          CPU: 4 PID: 2233 Comm: lt-libndctl Tainted: G           O    4.12.0-rc1+ #12
          RIP: 0010:__list_del_entry_valid+0x6c/0xa0
          Call Trace:
           release_nodes+0x76/0x260
           devres_release_all+0x3c/0x50
           device_release_driver_internal+0x159/0x200
           device_release_driver+0x12/0x20
           bus_remove_device+0xfd/0x170
           device_del+0x1e8/0x330
           platform_device_del+0x28/0x90
           platform_device_unregister+0x12/0x30
           nfit_test_exit+0x2a/0x93b [nfit_test]
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarYasunori Goto <y-goto@jp.fujitsu.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      a117699c
    • Dan Williams's avatar
      libnvdimm, label: switch to using v1.2 labels by default · 8990cdf1
      Dan Williams authored
      The rules for which version of the label specification are in effect at
      any given point in time are as follows:
      
      1/ If a DIMM has an existing / valid index block then the version
         specified is used regardless if it is a previous version.
      
      2/ By default when the kernel is initializing new index blocks the
         latest specification version (v1.2 at time of writing) is used.
      
      3/ An environment that wants to force create v1.1 label-sets must
         arrange for userspace to disable all active regions / namespaces /
         dimms and write a valid set of v1.1 index blocks to the dimms.
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      8990cdf1
    • Dan Williams's avatar
      libnvdimm, label: add address abstraction identifiers · b3fde74e
      Dan Williams authored
      Starting with v1.2 labels, 'address abstractions' can be hinted via an
      address abstraction id that implies an info-block format. The standard
      address abstraction in the specification is the v2 format of the
      Block-Translation-Table (BTT). Support for that is saved for a later
      patch, for now we add support for the Linux supported address
      abstractions BTT (v1), PFN, and DAX.
      
      The new 'holder_class' attribute for namespace devices is added for
      tooling to specify the 'abstraction_guid' to store in the namespace label.
      For v1.1 labels this field is undefined and any setting of
      'holder_class' away from the default 'none' value will only have effect
      until the driver is unloaded. Setting 'holder_class' requires that
      whatever device tries to claim the namespace must be of the specified
      class.
      
      Cc: Vishal Verma <vishal.l.verma@intel.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      b3fde74e
    • Dan Williams's avatar
      libnvdimm, label: add v1.2 label checksum support · 355d8388
      Dan Williams authored
      The v1.2 namespace label specification adds a fletcher checksum to each
      label instance. Add generation and validation support for the new field.
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      355d8388
    • Dan Williams's avatar
      libnvdimm, label: update 'nlabel' and 'position' handling for local namespaces · 3934d841
      Dan Williams authored
      The v1.2 namespace label specification requires 'nlabel' and 'position'
      to be valid for the first ("lowest dpa") label in the set. It also
      requires all non-first labels to set those fields to 0xff.
      
      Linux does not much care if these values are correct, because we can
      just trust the count of labels with the matching uuid like the v1.1
      case. However, we set them correctly in case other environments care.
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      3934d841
    • Dan Williams's avatar
      libnvdimm, label: populate 'isetcookie' for blk-aperture namespaces · 8f2bc243
      Dan Williams authored
      Starting with the v1.2 definition of namespace labels, the isetcookie
      field is populated and validated for blk-aperture namespaces. This adds
      some safety against inadvertent copying of namespace labels from one
      DIMM-device to another.
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      8f2bc243
    • Dan Williams's avatar
      libnvdimm, label: populate the type_guid property for v1.2 namespaces · faec6f8a
      Dan Williams authored
      The type_guid refers to the "Address Range Type GUID" for the region
      backing a namespace as defined the ACPI NFIT (NVDIMM Firmware Interface
      Table). This 'type' identifier specifies an access mechanism for the
      given namespace. This capability replaces the confusing usage of the
      'NSLABEL_FLAG_LOCAL' flag to indicate a block-aperture-mode namespace.
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      faec6f8a
    • Dan Williams's avatar
      libnvdimm, label: honor the lba size specified in v1.2 labels · f979b13c
      Dan Williams authored
      Previously we only honored the lba size for blk-aperture mode
      namespaces. For pmem namespaces the lba size was just assumed to be 512.
      With the new v1.2 label definition and compatibility with other
      operating environments, the ->lbasize property is now respected for pmem
      namespaces.
      
      Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      f979b13c
    • Dan Williams's avatar
      libnvdimm, label: add v1.2 interleave-set-cookie algorithm · c12c48ce
      Dan Williams authored
      The interleave-set-cookie algorithm is extended to incorporate all the
      same components that are used to generate an nvdimm unique-id. For
      backwards compatibility we still maintain the old v1.1 definition.
      Reported-by: default avatarNicholas Moulin <nicholas.w.moulin@intel.com>
      Reported-by: default avatarKaushik Kanetkar <kaushik.a.kanetkar@intel.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      c12c48ce
    • Dan Williams's avatar
      libnvdimm, label: add v1.2 nvdimm label definitions · 564e871a
      Dan Williams authored
      In support of improved interoperability between operating systems and pre-boot
      environments the Intel proposed NVDIMM Namespace Specification [1], has been
      adopted and modified to the the UEFI 2.7 NVDIMM Label Protocol [2].
      
      Update the definitions of the namespace label data structures so that the new
      format can be supported alongside the existing label format.
      
      The new specification changes the default label size to 256 bytes, so
      everywhere that relied on sizeof(struct nd_namespace_label) must now use the
      sizeof_namespace_label() helper.
      
      There should be no functional differences from these changes as the
      default is still the v1.1 128-byte format. Future patches will move the
      default to the v1.2 definition.
      
      [1]: http://pmem.io/documents/NVDIMM_Namespace_Spec.pdf
      [2]: http://www.uefi.org/sites/default/files/resources/UEFI_Spec_2_7.pdfSigned-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      564e871a
  2. 09 Jun, 2017 2 commits
  3. 08 Jun, 2017 1 commit
  4. 07 Jun, 2017 1 commit
  5. 05 Jun, 2017 26 commits