On Tue, Dec 29, 2015 at 01:34:49AM -0500, Jeff King wrote:
> 2. We have some unaligned memory accesses that presumably work OK on
> x86, but would blow up on ARM or other platforms (I didn't test).
>
> The latter looks like it's in the untracked cache code (Duy and
> Christian cc'd). Running t7063 gets me this:
>
> dir.c:2631:45: runtime error: member access within misaligned address
> 0x7f19806ff185 for type 'const struct ondisk_untracked_cache', which requires
> 4 byte alignment
> 0x7f19806ff185: note: pointer points here
> 31 33 29 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 00 00 00 00 00 00 00 00
> ^
I took a brief look at fixing this, and it may actually be a false
positive, as well (in a manner of speaking; if the compiler thinks it is
undefined behavior, it may still be worth fixing so we don't fall prey
to some optimizations-gone-wild).
The line in question is:
load_sha1_stat(&uc->ss_info_exclude, &ouc->info_exclude_stat,
ouc->info_exclude_sha1);
where "ouc" is the on-disk data cast to a struct. So we definitely
generate an unaligned pointer, but then we only access its contents via
get_be32(), which handles alignment. So it might actually be OK. I
dunno.
-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html