On Thu, Jul 25, 2013 at 10:12:01PM +0800, Eryu Guan wrote:
> The second btrfs command segfaults on big endian host(ppc64)
>
> btrfs subvolume snapshot /mnt/btrfs /mnt/btrfs/snap
> btrfs subvolume list -s /mnt/btrfs
>
> And ltrace shows
>
> localtime(0x10029c482d0) = 0
> strftime( <no return ...>
> --- SIGSEGV (Segmentation fault) ---
>
> The corresponding code
>
> btrfs-list.c:
> case BTRFS_LIST_OTIME:
> if (subv->otime)
> strftime(tstr, 256, "%Y-%m-%d %X",
> localtime(&subv->otime));
> else
> strcpy(tstr, "-");
> printf("%s", tstr);
> break;
>
> localtime() returned NULL then strftime() got SIGSEGV.
>
> The reason is that ri->otime.sec is stored as little endian but
> assigned to 't' without conversion.
I've sent fixes to both otime endianity and localtime crashes some days
ago and will keep them in integration branch. The reentrant variant of
localtime is safer, though the fix to otime access might be enough to
fix it.
http://www.mail-archive.com/linux-btrfs@xxxxxxxxxxxxxxx/msg25676.html
http://www.mail-archive.com/linux-btrfs@xxxxxxxxxxxxxxx/msg25677.html
david
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html