* Mon May 12 2008 Eric Sandeen <esandeen@redhat.com> 1.40.9-2

- Fix blkid swap recognition on big-endian boxes (#445786)
This commit is contained in:
Eric Sandeen 2008-05-12 18:27:27 +00:00
parent b33176797d
commit ca9d7ec3ba
2 changed files with 25 additions and 6 deletions

View File

@ -27,17 +27,33 @@ index 45885c3..a070201 100644
unsigned char *buf __BLKID_ATTR((unused)))
{
struct swap_id_block *sws;
@@ -843,6 +843,12 @@ static int probe_swap1(struct blkid_probe *probe,
@@ -843,6 +843,11 @@ static int probe_swap1(struct blkid_probe *probe,
if (!sws)
return 1;
+ /* check for wrong version or zeroed pagecount, for sanity */
+ if (!memcmp(id->bim_magic, "SWAPSPACE2", id->bim_len) &&
+ (blkid_le32(sws->sws_version) != 1 ||
+ sws->sws_lastpage == 0))
+ (sws->sws_version != 1 || sws->sws_lastpage == 0))
+ return 1;
+
/* arbitrary sanity check.. is there any garbage down there? */
if (sws->sws_pad[32] == 0 && sws->sws_pad[33] == 0) {
if (sws->sws_volume[0])
-- 1.5.4.1
--- a/lib/blkid/test_probe.in 2008-05-12 11:50:41.580983841 -0500
+++ b/lib/blkid/test_probe.in 2008-05-12 11:51:21.323436536 -0500
@@ -20,6 +20,15 @@ do
continue
fi
bunzip2 < $SRCDIR/tests/$i.img.bz2 > /tmp/test.img.$$
+ # swap is native-endian, so regenerate before testing
+ if [ "$i" == "swap0" ]; then
+ dd if=/dev/zero of=/tmp/test.img.$$ bs=1024 count=1 seek=1024
+ mkswap -v0 /tmp/test.img.$$ > /dev/null
+ elif [ "$i" == "swap1" ]; then
+ dd if=/dev/zero of=/tmp/test.img.$$ bs=1024 count=1 seek=1024
+ mkswap -v1 -L SWAP-TEST -U 8ff8e77f-8553-485e-8656-58be67a81666 /tmp/test.img.$$ >/dev/null
+ fi
+
./tst_probe /tmp/test.img.$$ > tests/$i.out
/bin/rm -f /tmp/test.img.$$ tests/$i.ok tests/$i.failed
cmp -s tests/$i.out $SRCDIR/tests/$i.results

View File

@ -4,7 +4,7 @@
Summary: Utilities for managing the second and third extended (ext2/ext3) filesystems
Name: e2fsprogs
Version: 1.40.9
Release: 1%{?dist}
Release: 2%{?dist}
# License based on upstream-modified COPYING file,
# which clearly states "V2" intent.
License: GPLv2
@ -21,7 +21,7 @@ Url: http://e2fsprogs.sourceforge.net/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: e2fsprogs-libs = %{version}-%{release}, device-mapper
BuildRequires: pkgconfig, texinfo, libselinux-devel
BuildRequires: libsepol-devel, device-mapper-devel
BuildRequires: libsepol-devel, device-mapper-devel, util-linux
%description
The e2fsprogs package contains a number of utilities for creating,
@ -281,6 +281,9 @@ fi
%dir %attr(2775, uuidd, uuidd) /var/lib/libuuid
%changelog
* Mon May 12 2008 Eric Sandeen <esandeen@redhat.com> 1.40.9-2
- Fix blkid swap recognition on big-endian boxes (#445786)
* Sun Apr 27 2008 Eric Sandeen <esandeen@redhat.com> 1.40.9-1
- New upstream version