iommu/vt-d: Remove unnecessary WARN_ON_ONCE()
PATCH 1/1 iommu/vt-d: Remove unnecessary WARN_ON_ONCE()
Address field in device TLB invalidation descriptor is qualified by the S field. If S field is zero, a single page at page address specified by address [63:12] is requested to be invalidated. If S field is set, the least significant bit in the address field with value 0b (say bit N) indicates the invalidation address range. The spec doesn't require the address [N - 1, 0] to be cleared, hence remove the unnecessary WARN_ON_ONCE().
Otherwise, the caller might set "mask = MAX_AGAW_PFN_WIDTH" in order to invalidating all the cached mappings on an endpoint, and below overflow error will be triggered.
[...]
UBSAN: Undefined behaviour in drivers/iommu/dmar.c:1354:3
shift exponent 64 is too large for 64-bit type 'long long unsigned int' [...]
--- drivers/iommu/dmar.c | 1 - 1 file changed, 1 deletion(-)
drivers/iommu/dmar.c +0 -1
@@ -1354,7 +1354,6 @@ void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 pfsid,struct qi_desc desc;if (mask) { -WARN_ON_ONCE (addr & ((1ULL << (VTD_PAGE_SHIFT + mask)) -1 )); addr |= (1ULL << (VTD_PAGE_SHIFT + mask -1 )) -1 ; desc.qw1 =QI_DEV_IOTLB_ADDR (addr) |QI_DEV_IOTLB_SIZE ; }else
Signature · 6 lines
2.17.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Joerg Roedel
maintainerQuoted 12 lines · Lu Baolu
Address field in device TLB invalidation descriptor is qualified by the S field. If S field is zero, a single page at page address specified by address [63:12] is requested to be invalidated. If S field is set, the least significant bit in the address field with value 0b (say bit N) indicates the invalidation address range. The spec doesn't require the address [N - 1, 0] to be cleared, hence remove the unnecessary
WARN_ON_ONCE().Otherwise, the caller might set "mask =
MAX_AGAW_PFN_WIDTH" in order to invalidating all the cached mappings on an endpoint, and below overflow error will be triggered.
Quoted 7 lines
[...]
UBSAN: Undefined behaviour in drivers/iommu/dmar.c:1354:3shift exponent 64 is too large for 64-bit type 'long long unsigned int' [...]
Reported-and-tested-by Frank <[email protected]>Signed-off-by Lu Baolu <[email protected]>
Does this need a Fixes and/or stable tag?
Regards,
Joerg
Hi Joerg,
Quoted 18 lines · Joerg Roedel
Quoted 17 lines · Lu Baolu
Address field in device TLB invalidation descriptor is qualified by the S field. If S field is zero, a single page at page address specified by address [63:12] is requested to be invalidated. If S field is set, the least significant bit in the address field with value 0b (say bit N) indicates the invalidation address range. The spec doesn't require the address [N - 1, 0] to be cleared, hence remove the unnecessary
WARN_ON_ONCE().Otherwise, the caller might set "mask =
MAX_AGAW_PFN_WIDTH" in order to invalidating all the cached mappings on an endpoint, and below overflow error will be triggered.[...]
UBSAN: Undefined behaviour in drivers/iommu/dmar.c:1354:3shift exponent 64 is too large for 64-bit type 'long long unsigned int' [...]
Quoted 5 lines
Quoted 2 lines
Reported-and-tested-by Frank <[email protected]>Signed-off-by Lu Baolu <[email protected]>Does this need a Fixes and/or stable tag?
This doesn't cause any errors, just an unnecessary checking of
"0 & ((1UL << 64) - 1)"
in some cases.
Quoted 4 lines
Regards,
Joerg
Best regards,
baolu
Joerg Roedel
maintainerQuoted 24 lines · Lu Baolu
Hi Joerg,
Quoted 21 lines · Joerg Roedel
Quoted 19 lines · Lu Baolu
Address field in device TLB invalidation descriptor is qualified by the S field. If S field is zero, a single page at page address specified by address [63:12] is requested to be invalidated. If S field is set, the least significant bit in the address field with value 0b (say bit N) indicates the invalidation address range. The spec doesn't require the address [N - 1, 0] to be cleared, hence remove the unnecessary
WARN_ON_ONCE().Otherwise, the caller might set "mask =
MAX_AGAW_PFN_WIDTH" in order to invalidating all the cached mappings on an endpoint, and below overflow error will be triggered.[...]
UBSAN: Undefined behaviour in drivers/iommu/dmar.c:1354:3shift exponent 64 is too large for 64-bit type 'long long unsigned int' [...]
Reported-and-tested-by Frank <[email protected]>Signed-off-by Lu Baolu <[email protected]>
Quoted 8 lines
Quoted 2 lines
Does this need a Fixes and/or stable tag?
This doesn't cause any errors, just an unnecessary checking of
"0 & ((1UL << 64) - 1)"in some cases.
Okay, applied for v5.6.