Xin LI
2010-Apr-28 18:37 UTC
[zfs-code] [PATCH] va_copy before using va_list again in spa_history::log_internal
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, Here is a patch adapted to the OpenSolaris tree. We need it when porting ZFS to FreeBSD but it seems to be useful for general consumption. Currently: - vsnprintf() will not call va_end() and the va_list passed is not defined; - subsequent vsprintf() references the passed va_list again. On FreeBSD/amd64, the latter vsprintf() would write undefined result, which tends to cause random panics. It turns out that the undefined behavior is defined in standard, so we have added a pair of va_copy() and va_end() calls and operate on the copy for the first vsnprintf(). Cheers, - -- Xin LI <delphij at delphij.net> http://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iQEcBAEBAgAGBQJL2IBlAAoJEATO+BI/yjfBkOUH+wffwvwqQQT4Y2S3dkKW1Md9 CAmBzGlQJWGlteCUTKhxD7KMIaIfaq6GoCJJg5u1XWdxxOIILDW2wjyE03zDnCLY HQJwGcbvTyc0AfiDlR/OuELDrHEAKWKE3FRQHhRjR4n8Go5k9IQCzqVvESmpDHZR tfOJmpq6hm2lMbVTasR64n9+PrSPBhimKUh0irhQoiK2tdnweazeBPBV9nqwJoqB erJDzI94I9u1whXpmJyttgVClqDzvrvK5v/wappfljbOH7tI4AQctRu2+s/eZrxr 0L0lro3+ZAeR1tYx63/CyvJcYf7NvmxT7ABfpV9rh6K14v+LyvoztrwmLtiJXEI=KTmF -----END PGP SIGNATURE----- -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: spa_history.c.diff URL: <http://mail.opensolaris.org/pipermail/zfs-code/attachments/20100428/6983f1c3/attachment.ksh>