1. 03 6月, 2021 1 次提交
  2. 01 5月, 2021 2 次提交
  3. 28 4月, 2021 1 次提交
  4. 20 4月, 2021 2 次提交
  5. 09 4月, 2021 1 次提交
    • S
      cfi: add __cficanonical · ff301ceb
      Sami Tolvanen 提交于
      With CONFIG_CFI_CLANG, the compiler replaces a function address taken
      in C code with the address of a local jump table entry, which passes
      runtime indirect call checks. However, the compiler won't replace
      addresses taken in assembly code, which will result in a CFI failure
      if we later jump to such an address in instrumented C code. The code
      generated for the non-canonical jump table looks this:
      
        <noncanonical.cfi_jt>: /* In C, &noncanonical points here */
      	jmp noncanonical
        ...
        <noncanonical>:        /* function body */
      	...
      
      This change adds the __cficanonical attribute, which tells the
      compiler to use a canonical jump table for the function instead. This
      means the compiler will rename the actual function to <function>.cfi
      and points the original symbol to the jump table entry instead:
      
        <canonical>:           /* jump table entry */
      	jmp canonical.cfi
        ...
        <canonical.cfi>:       /* function body */
      	...
      
      As a result, the address taken in assembly, or other non-instrumented
      code always points to the jump table and therefore, can be used for
      indirect calls in instrumented code without tripping CFI checks.
      Signed-off-by: NSami Tolvanen <samitolvanen@google.com>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Acked-by: Bjorn Helgaas <bhelgaas@google.com>   # pci.h
      Tested-by: NNathan Chancellor <nathan@kernel.org>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Link: https://lore.kernel.org/r/20210408182843.1754385-3-samitolvanen@google.com
      ff301ceb
  6. 04 4月, 2021 1 次提交
    • L
      PCI/IOV: Add sysfs MSI-X vector assignment interface · c3d5c2d9
      Leon Romanovsky 提交于
      A typical cloud provider SR-IOV use case is to create many VFs for use by
      guest VMs. The VFs may not be assigned to a VM until a customer requests a
      VM of a certain size, e.g., number of CPUs. A VF may need MSI-X vectors
      proportional to the number of CPUs in the VM, but there is no standard way
      to change the number of MSI-X vectors supported by a VF.
      
      Some Mellanox ConnectX devices support dynamic assignment of MSI-X vectors
      to SR-IOV VFs. This can be done by the PF driver after VFs are enabled,
      and it can be done without affecting VFs that are already in use. The
      hardware supports a limited pool of MSI-X vectors that can be assigned to
      the PF or to individual VFs.  This is device-specific behavior that
      requires support in the PF driver.
      
      Add a read-only "sriov_vf_total_msix" sysfs file for the PF and a writable
      "sriov_vf_msix_count" file for each VF. Management software may use these
      to learn how many MSI-X vectors are available and to dynamically assign
      them to VFs before the VFs are passed through to a VM.
      
      If the PF driver implements the ->sriov_get_vf_total_msix() callback,
      "sriov_vf_total_msix" contains the total number of MSI-X vectors available
      for distribution among VFs.
      
      If no driver is bound to the VF, writing "N" to "sriov_vf_msix_count" uses
      the PF driver ->sriov_set_msix_vec_count() callback to assign "N" MSI-X
      vectors to the VF.  When a VF driver subsequently reads the MSI-X Message
      Control register, it will see the new Table Size "N".
      
      Link: https://lore.kernel.org/linux-pci/20210314124256.70253-2-leon@kernel.orgAcked-by: NBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: NLeon Romanovsky <leonro@nvidia.com>
      c3d5c2d9
  7. 01 4月, 2021 1 次提交
  8. 17 3月, 2021 1 次提交
  9. 15 1月, 2021 3 次提交
  10. 09 12月, 2020 1 次提交
  11. 06 12月, 2020 1 次提交
  12. 05 12月, 2020 4 次提交
  13. 21 11月, 2020 1 次提交
  14. 17 10月, 2020 1 次提交
  15. 30 9月, 2020 2 次提交
  16. 22 9月, 2020 1 次提交
  17. 07 9月, 2020 1 次提交
  18. 04 8月, 2020 1 次提交
  19. 30 7月, 2020 1 次提交
  20. 11 7月, 2020 2 次提交
  21. 08 7月, 2020 1 次提交
  22. 01 7月, 2020 1 次提交
  23. 02 6月, 2020 1 次提交
  24. 22 5月, 2020 1 次提交
  25. 20 5月, 2020 1 次提交
  26. 15 5月, 2020 1 次提交
  27. 12 5月, 2020 1 次提交
    • G
      PCI: Replace zero-length array with flexible-array · 914a1951
      Gustavo A. R. Silva 提交于
      The current codebase makes use of the zero-length array language extension
      to the C90 standard, but the preferred mechanism to declare variable-length
      types such as these as a flexible array member [1][2], introduced in C99:
      
        struct foo {
          int stuff;
          struct boo array[];
        };
      
      By making use of the mechanism above, we will get a compiler warning in
      case the flexible array does not occur last in the structure, which will
      help us prevent some kind of undefined behavior bugs from being
      inadvertently introduced[3] to the codebase from now on.
      
      Also, notice that dynamic memory allocations won't be affected by this
      change:
      
        Flexible array members have incomplete type, and so the sizeof operator
        may not be applied. As a quirk of the original implementation of
        zero-length arrays, sizeof evaluates to zero. [1]
      
      sizeof(flexible-array-member) triggers a warning because flexible array
      members have incomplete type [1]. There are some instances of code in which
      the sizeof() operator is being incorrectly/erroneously applied to
      zero-length arrays, and the result is zero. Such instances may be hiding
      some bugs. So, this work (flexible-array member conversions) will also help
      to get completely rid of those sorts of issues.
      
      This issue was found with the help of Coccinelle.
      
      [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
      [2] https://github.com/KSPP/linux/issues/21
      [3] commit 76497732 ("cxgb3/l2t: Fix undefined behaviour")
      
      Link: https://lore.kernel.org/r/20200507190544.GA15633@embeddedorSigned-off-by: NGustavo A. R. Silva <gustavoars@kernel.org>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      914a1951
  28. 30 3月, 2020 2 次提交
    • I
      PCI: Add support for root bus sizing · 2c8d5a2d
      Ivan Kokshaysky 提交于
      In certain cases we should be able to enumerate IO and MEM ranges of all
      PCI devices installed in the system, and then set respective host bridge
      apertures basing on calculated size and alignment.  Particularly when
      firmware is broken and fails to assign bridge windows properly, like on
      Alpha UP1500 platform.
      
      Actually, almost everything is already in place, and required changes are
      minimal:
      
      - add "size_windows" flag to struct pci_host_bridge: when set, it
        instructs __pci_bus_size_bridges() to continue with the root bus;
      - in the __pci_bus_size_bridges() path: add checks for bus->self,
        as it can legitimately be null for the root bus.
      
      Link: https://lore.kernel.org/r/20200314194355.GA12510@mail.rc.ruTested-by: NMatt Turner <mattst88@gmail.com>
      Signed-off-by: NIvan Kokshaysky <ink@jurassic.park.msu.ru>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      2c8d5a2d
    • M
      PCI: Use ioremap(), not phys_to_virt() for platform ROM · 72e0ef0e
      Mikel Rychliski 提交于
      On some EFI systems, the video BIOS is provided by the EFI firmware.  The
      boot stub code stores the physical address of the ROM image in pdev->rom.
      Currently we attempt to access this pointer using phys_to_virt(), which
      doesn't work with CONFIG_HIGHMEM.
      
      On these systems, attempting to load the radeon module on a x86_32 kernel
      can result in the following:
      
        BUG: unable to handle page fault for address: 3e8ed03c
        #PF: supervisor read access in kernel mode
        #PF: error_code(0x0000) - not-present page
        *pde = 00000000
        Oops: 0000 [#1] PREEMPT SMP
        CPU: 0 PID: 317 Comm: systemd-udevd Not tainted 5.6.0-rc3-next-20200228 #2
        Hardware name: Apple Computer, Inc. MacPro1,1/Mac-F4208DC8, BIOS     MP11.88Z.005C.B08.0707021221 07/02/07
        EIP: radeon_get_bios+0x5ed/0xe50 [radeon]
        Code: 00 00 84 c0 0f 85 12 fd ff ff c7 87 64 01 00 00 00 00 00 00 8b 47 08 8b 55 b0 e8 1e 83 e1 d6 85 c0 74 1a 8b 55 c0 85 d2 74 13 <80> 38 55 75 0e 80 78 01 aa 0f 84 a4 03 00 00 8d 74 26 00 68 dc 06
        EAX: 3e8ed03c EBX: 00000000 ECX: 3e8ed03c EDX: 00010000
        ESI: 00040000 EDI: eec04000 EBP: eef3fc60 ESP: eef3fbe0
        DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00010206
        CR0: 80050033 CR2: 3e8ed03c CR3: 2ec77000 CR4: 000006d0
        Call Trace:
         r520_init+0x26/0x240 [radeon]
         radeon_device_init+0x533/0xa50 [radeon]
         radeon_driver_load_kms+0x80/0x220 [radeon]
         drm_dev_register+0xa7/0x180 [drm]
         radeon_pci_probe+0x10f/0x1a0 [radeon]
         pci_device_probe+0xd4/0x140
      
      Fix the issue by updating all drivers which can access a platform provided
      ROM. Instead of calling the helper function pci_platform_rom() which uses
      phys_to_virt(), call ioremap() directly on the pdev->rom.
      
      radeon_read_platform_bios() previously directly accessed an __iomem
      pointer. Avoid this by calling memcpy_fromio() instead of kmemdup().
      
      pci_platform_rom() now has no remaining callers, so remove it.
      
      Link: https://lore.kernel.org/r/20200319021623.5426-1-mikel@mikelr.comSigned-off-by: NMikel Rychliski <mikel@mikelr.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NAlex Deucher <alexander.deucher@amd.com>
      72e0ef0e
  29. 29 3月, 2020 2 次提交