Skip to content

libfdt: eliminate UB pointer validation

Jan Beulich xen-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2libfdt: Fix undefined behaviour in fdt_offset_ptr()xen/common/libfdt/fdt.c+7 -61 reply
2/2libfdt: fix undefined behaviour in _fdt_splice()xen/common/libfdt/fdt_rw.c+6 -51 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchJulien Grall
1/2A-b
2/2A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [Xen-devel] [PATCH 0/2] libfdt: eliminate UB pointer validation

The other day, in the context of what is now cf38b4926e2b ("xmalloc:
guard against integer overflow"), Andrew had suggested to look into using gcc's __builtin_*_overflow(). The functions don't lend themselves to be used there with the logic currently in place (albeit we may still want to consider adjustments there), but I then went on to see whether we have any other overflow checks wanting conversion. One thing I noticed was that for unsigned integer arithmetic the compiler normally does fine recognizing the intent without using the builtins. And while I didn't to spot any signed integer overflow checks (which likely would have been UB anyway), I did spot two in libfdt. After figuring out where exactly that code was taken from, I spotted a fix for one of the two in the upstream repo, and I submitted a fix for the other one there first. Here are the backports thereof, as I don't myself want to get into the business of bumping the libfdt version in our repo.

1: Fix undefined behaviour in fdt_offset_ptr()
2: fix undefined behaviour in _fdt_splice()

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel