* [PATCH 0/7] fixes for fsck.cramfs and other things
@ 2018-01-23 15:59 Ruediger Meier
2018-01-23 15:59 ` [PATCH 1/7] Revert "fsck.cramfs: Fix bus error on broken file system." Ruediger Meier
` (7 more replies)
0 siblings, 8 replies; 13+ messages in thread
From: Ruediger Meier @ 2018-01-23 15:59 UTC (permalink / raw)
To: util-linux
From: Ruediger Meier <ruediger.meier@ga-group.nl>
Ruediger Meier (6):
Revert "fsck.cramfs: Fix bus error on broken file system."
fsck.cramfs: fix crash when superblock size is too small
tests: rewrite fsck-bad-header
fsck.cramfs: fix error message
tests: fix fincore/count KNOWN_FAIL
rfkill: provide RFKILL_TYPE_FM if undefined
root (1):
tests: suppress warning for old sync(1)
disk-utils/fsck.cramfs.c | 20 +++---
sys-utils/rfkill.c | 5 ++
tests/expected/cramfs/fsck-bad-header | 2 -
tests/expected/cramfs/fsck-bad-header-nopad-4K-be | 29 +++++++++
tests/expected/cramfs/fsck-bad-header-nopad-4K-le | 29 +++++++++
tests/expected/cramfs/fsck-bad-header-pad-4K-be | 29 +++++++++
tests/expected/cramfs/fsck-bad-header-pad-4K-le | 29 +++++++++
tests/expected/cramfs/fsck-bad-header-pad-64K-be | 29 +++++++++
tests/expected/cramfs/fsck-bad-header-pad-64K-le | 29 +++++++++
tests/functions.sh | 4 +-
tests/ts/cramfs/fsck-bad-header | 76 +++++++++++++++++++++--
tests/ts/fincore/count | 7 +--
12 files changed, 266 insertions(+), 22 deletions(-)
delete mode 100644 tests/expected/cramfs/fsck-bad-header
create mode 100644 tests/expected/cramfs/fsck-bad-header-nopad-4K-be
create mode 100644 tests/expected/cramfs/fsck-bad-header-nopad-4K-le
create mode 100644 tests/expected/cramfs/fsck-bad-header-pad-4K-be
create mode 100644 tests/expected/cramfs/fsck-bad-header-pad-4K-le
create mode 100644 tests/expected/cramfs/fsck-bad-header-pad-64K-be
create mode 100644 tests/expected/cramfs/fsck-bad-header-pad-64K-le
--
2.13.6
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/7] Revert "fsck.cramfs: Fix bus error on broken file system."
2018-01-23 15:59 [PATCH 0/7] fixes for fsck.cramfs and other things Ruediger Meier
@ 2018-01-23 15:59 ` Ruediger Meier
2018-01-23 15:59 ` [PATCH 2/7] fsck.cramfs: fix crash when superblock size is too small Ruediger Meier
` (6 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Ruediger Meier @ 2018-01-23 15:59 UTC (permalink / raw)
To: util-linux; +Cc: Tobias Stoeckmann
From: Ruediger Meier <ruediger.meier@ga-group.nl>
This reverts commit 7cb962c77015e9383b53eeb22ce732cb5216bbc3.
It can't be right that we mmap (start + super.size) bytes from a file
which is usually only super.size bytes large. The patch "fixed" a
problem when super.size is bad but now it fails for the correct case:
$ mkdir -p root/subdir
$ ./mkfs.cramfs -p root cramfs
$ ./fsck.cramfs cramfs
Bus error (core dumped)
We will fix the original problem later.
CC: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
disk-utils/fsck.cramfs.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/disk-utils/fsck.cramfs.c b/disk-utils/fsck.cramfs.c
index b2a3cc153..50c7d33b9 100644
--- a/disk-utils/fsck.cramfs.c
+++ b/disk-utils/fsck.cramfs.c
@@ -220,24 +220,23 @@ static void test_crc(int start)
crc = crc32(0L, NULL, 0);
buf =
- mmap(NULL, start + super.size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
+ mmap(NULL, super.size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
if (buf == MAP_FAILED) {
buf =
- mmap(NULL, start + super.size, PROT_READ | PROT_WRITE,
+ mmap(NULL, super.size, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (buf != MAP_FAILED) {
- if (lseek(fd, start, SEEK_SET) == (off_t) -1)
+ if (lseek(fd, 0, SEEK_SET) == (off_t) -1)
err(FSCK_EX_ERROR, _("seek on %s failed"), filename);
- if (read(fd, (unsigned char *) buf + start, super.size) !=
- (ssize_t) super.size)
+ if (read(fd, buf, super.size) != (ssize_t) super.size)
err(FSCK_EX_ERROR, _("cannot read %s"), filename);
}
}
if (buf != MAP_FAILED) {
((struct cramfs_super *)((unsigned char *) buf + start))->fsid.crc =
crc32(0L, NULL, 0);
- crc = crc32(crc, (unsigned char *) buf + start, super.size);
- munmap(buf, start + super.size);
+ crc = crc32(crc, (unsigned char *) buf + start, super.size - start);
+ munmap(buf, super.size);
} else {
int retval;
size_t length = 0;
--
2.13.6
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/7] fsck.cramfs: fix crash when superblock size is too small
2018-01-23 15:59 [PATCH 0/7] fixes for fsck.cramfs and other things Ruediger Meier
2018-01-23 15:59 ` [PATCH 1/7] Revert "fsck.cramfs: Fix bus error on broken file system." Ruediger Meier
@ 2018-01-23 15:59 ` Ruediger Meier
2018-01-23 19:41 ` Tobias Stöckmann
2018-01-23 15:59 ` [PATCH 3/7] tests: rewrite fsck-bad-header Ruediger Meier
` (5 subsequent siblings)
7 siblings, 1 reply; 13+ messages in thread
From: Ruediger Meier @ 2018-01-23 15:59 UTC (permalink / raw)
To: util-linux; +Cc: Tobias Stoeckmann
From: Ruediger Meier <ruediger.meier@ga-group.nl>
This hopefully fixes the original problem addressed by the reverted
patch 7cb962c7.
The bug was introduced by myself in
f991dbd3 "fsck.cramfs: allow smaller superblock sizes"
CC: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
disk-utils/fsck.cramfs.c | 2 +-
| 3 +--
| 2 +-
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/disk-utils/fsck.cramfs.c b/disk-utils/fsck.cramfs.c
index 50c7d33b9..820816b14 100644
--- a/disk-utils/fsck.cramfs.c
+++ b/disk-utils/fsck.cramfs.c
@@ -192,7 +192,7 @@ static void test_super(int *start, size_t * length)
errx(FSCK_EX_ERROR, _("unsupported filesystem features"));
/* What are valid superblock sizes? */
- if (super.size < sizeof(struct cramfs_super))
+ if (super.size < *start + sizeof(struct cramfs_super))
errx(FSCK_EX_UNCORRECTED, _("superblock size (%d) too small"),
super.size);
--git a/tests/expected/cramfs/fsck-bad-header b/tests/expected/cramfs/fsck-bad-header
index ade8a9c3a..41c2c125e 100644
--- a/tests/expected/cramfs/fsck-bad-header
+++ b/tests/expected/cramfs/fsck-bad-header
@@ -1,2 +1 @@
-fsck.cramfs: file extends past end of filesystem
-fsck.cramfs: crc error
+fsck.cramfs: superblock size (76) too small
--git a/tests/ts/cramfs/fsck-bad-header b/tests/ts/cramfs/fsck-bad-header
index 8d5309c35..add388577 100755
--- a/tests/ts/cramfs/fsck-bad-header
+++ b/tests/ts/cramfs/fsck-bad-header
@@ -16,7 +16,7 @@
# GNU General Public License for more details.
#
TS_TOPDIR="${0%/*}/../.."
-TS_DESC="fsck endianness"
+TS_DESC="fsck bad header"
. $TS_TOPDIR/functions.sh
ts_init "$*"
--
2.13.6
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/7] tests: rewrite fsck-bad-header
2018-01-23 15:59 [PATCH 0/7] fixes for fsck.cramfs and other things Ruediger Meier
2018-01-23 15:59 ` [PATCH 1/7] Revert "fsck.cramfs: Fix bus error on broken file system." Ruediger Meier
2018-01-23 15:59 ` [PATCH 2/7] fsck.cramfs: fix crash when superblock size is too small Ruediger Meier
@ 2018-01-23 15:59 ` Ruediger Meier
2018-01-23 15:59 ` [PATCH 4/7] fsck.cramfs: fix error message Ruediger Meier
` (4 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Ruediger Meier @ 2018-01-23 15:59 UTC (permalink / raw)
To: util-linux
From: Ruediger Meier <ruediger.meier@ga-group.nl>
Fix test for systems with pagesize != 4096
Loop over many combinations of sizes, endianness and blocksizes.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
| 1 -
| 29 +++++++++
| 29 +++++++++
| 29 +++++++++
| 29 +++++++++
| 29 +++++++++
| 29 +++++++++
| 74 +++++++++++++++++++++--
8 files changed, 243 insertions(+), 6 deletions(-)
delete mode 100644 tests/expected/cramfs/fsck-bad-header
create mode 100644 tests/expected/cramfs/fsck-bad-header-nopad-4K-be
create mode 100644 tests/expected/cramfs/fsck-bad-header-nopad-4K-le
create mode 100644 tests/expected/cramfs/fsck-bad-header-pad-4K-be
create mode 100644 tests/expected/cramfs/fsck-bad-header-pad-4K-le
create mode 100644 tests/expected/cramfs/fsck-bad-header-pad-64K-be
create mode 100644 tests/expected/cramfs/fsck-bad-header-pad-64K-le
diff --git a/tests/expected/cramfs/fsck-bad-header b/tests/expected/cramfs/fsck-bad-header
deleted file mode 100644
index 41c2c125e..000000000
--- a/tests/expected/cramfs/fsck-bad-header
+++ /dev/null
@@ -1 +0,0 @@
-fsck.cramfs: superblock size (76) too small
--git a/tests/expected/cramfs/fsck-bad-header-nopad-4K-be b/tests/expected/cramfs/fsck-bad-header-nopad-4K-be
new file mode 100644
index 000000000..397d1ba29
--- /dev/null
+++ b/tests/expected/cramfs/fsck-bad-header-nopad-4K-be
@@ -0,0 +1,29 @@
+## size: 0
+fsck.cramfs: superblock size (0) too small
+ret: 4
+
+## size: 75
+fsck.cramfs: superblock size (75) too small
+ret: 4
+
+## size: 76
+fsck.cramfs: file extends past end of filesystem
+fsck.cramfs: crc error
+ret: 4
+
+## size: 4095
+fsck.cramfs: file extends past end of filesystem
+fsck.cramfs: crc error
+ret: 4
+
+## size: 4096
+ret: 0
+
+## size: 4097
+fsck.cramfs: file length too short
+ret: 4
+
+## size: 4294967295
+fsck.cramfs: file length too short
+ret: 4
+
--git a/tests/expected/cramfs/fsck-bad-header-nopad-4K-le b/tests/expected/cramfs/fsck-bad-header-nopad-4K-le
new file mode 100644
index 000000000..397d1ba29
--- /dev/null
+++ b/tests/expected/cramfs/fsck-bad-header-nopad-4K-le
@@ -0,0 +1,29 @@
+## size: 0
+fsck.cramfs: superblock size (0) too small
+ret: 4
+
+## size: 75
+fsck.cramfs: superblock size (75) too small
+ret: 4
+
+## size: 76
+fsck.cramfs: file extends past end of filesystem
+fsck.cramfs: crc error
+ret: 4
+
+## size: 4095
+fsck.cramfs: file extends past end of filesystem
+fsck.cramfs: crc error
+ret: 4
+
+## size: 4096
+ret: 0
+
+## size: 4097
+fsck.cramfs: file length too short
+ret: 4
+
+## size: 4294967295
+fsck.cramfs: file length too short
+ret: 4
+
--git a/tests/expected/cramfs/fsck-bad-header-pad-4K-be b/tests/expected/cramfs/fsck-bad-header-pad-4K-be
new file mode 100644
index 000000000..8e2316183
--- /dev/null
+++ b/tests/expected/cramfs/fsck-bad-header-pad-4K-be
@@ -0,0 +1,29 @@
+## size: 76
+fsck.cramfs: superblock size (76) too small
+ret: 4
+
+## size: 587
+fsck.cramfs: superblock size (587) too small
+ret: 4
+
+## size: 588
+fsck.cramfs: file extends past end of filesystem
+fsck.cramfs: crc error
+ret: 4
+
+## size: 4095
+fsck.cramfs: file extends past end of filesystem
+fsck.cramfs: crc error
+ret: 4
+
+## size: 4096
+ret: 0
+
+## size: 4097
+fsck.cramfs: file length too short
+ret: 4
+
+## size: 4294967295
+fsck.cramfs: file length too short
+ret: 4
+
--git a/tests/expected/cramfs/fsck-bad-header-pad-4K-le b/tests/expected/cramfs/fsck-bad-header-pad-4K-le
new file mode 100644
index 000000000..8e2316183
--- /dev/null
+++ b/tests/expected/cramfs/fsck-bad-header-pad-4K-le
@@ -0,0 +1,29 @@
+## size: 76
+fsck.cramfs: superblock size (76) too small
+ret: 4
+
+## size: 587
+fsck.cramfs: superblock size (587) too small
+ret: 4
+
+## size: 588
+fsck.cramfs: file extends past end of filesystem
+fsck.cramfs: crc error
+ret: 4
+
+## size: 4095
+fsck.cramfs: file extends past end of filesystem
+fsck.cramfs: crc error
+ret: 4
+
+## size: 4096
+ret: 0
+
+## size: 4097
+fsck.cramfs: file length too short
+ret: 4
+
+## size: 4294967295
+fsck.cramfs: file length too short
+ret: 4
+
--git a/tests/expected/cramfs/fsck-bad-header-pad-64K-be b/tests/expected/cramfs/fsck-bad-header-pad-64K-be
new file mode 100644
index 000000000..15d4ff190
--- /dev/null
+++ b/tests/expected/cramfs/fsck-bad-header-pad-64K-be
@@ -0,0 +1,29 @@
+## size: 76
+fsck.cramfs: superblock size (76) too small
+ret: 4
+
+## size: 587
+fsck.cramfs: superblock size (587) too small
+ret: 4
+
+## size: 588
+fsck.cramfs: file extends past end of filesystem
+fsck.cramfs: crc error
+ret: 4
+
+## size: 65535
+fsck.cramfs: file extends past end of filesystem
+fsck.cramfs: crc error
+ret: 4
+
+## size: 65536
+ret: 0
+
+## size: 65537
+fsck.cramfs: file length too short
+ret: 4
+
+## size: 4294967295
+fsck.cramfs: file length too short
+ret: 4
+
--git a/tests/expected/cramfs/fsck-bad-header-pad-64K-le b/tests/expected/cramfs/fsck-bad-header-pad-64K-le
new file mode 100644
index 000000000..15d4ff190
--- /dev/null
+++ b/tests/expected/cramfs/fsck-bad-header-pad-64K-le
@@ -0,0 +1,29 @@
+## size: 76
+fsck.cramfs: superblock size (76) too small
+ret: 4
+
+## size: 587
+fsck.cramfs: superblock size (587) too small
+ret: 4
+
+## size: 588
+fsck.cramfs: file extends past end of filesystem
+fsck.cramfs: crc error
+ret: 4
+
+## size: 65535
+fsck.cramfs: file extends past end of filesystem
+fsck.cramfs: crc error
+ret: 4
+
+## size: 65536
+ret: 0
+
+## size: 65537
+fsck.cramfs: file length too short
+ret: 4
+
+## size: 4294967295
+fsck.cramfs: file length too short
+ret: 4
+
--git a/tests/ts/cramfs/fsck-bad-header b/tests/ts/cramfs/fsck-bad-header
index add388577..c71782bde 100755
--- a/tests/ts/cramfs/fsck-bad-header
+++ b/tests/ts/cramfs/fsck-bad-header
@@ -25,14 +25,78 @@ ts_check_test_command "$TS_CMD_MKCRAMFS"
ts_check_test_command "$TS_CMD_FSCKCRAMFS"
ts_check_prog "dd"
-IMAGE_SOURCE="$TS_OUTDIR/${TS_TESTNAME}-data/root"
+function num2binary()
+{
+ local num=$1
+ local endian=$2
+
+ test "$num" -ge 0 -a "$num" -le 4294967295 || return 1
+ test "$endian" = "be" -o "$endian" = "le" || return 1
+
+ # how to do that easier?
+ if test "$endian" = "be"; then
+ echo -en "$(printf "%08x" "$1" | sed 's/\(..\)/\\x\1/g')"
+ else
+ echo -en "$(printf "%08x" "$1" | sed 's/^\(..\)\(..\)\(..\)\(..\)$/\\x\4\\x\3\\x\2\\x\1/')"
+ fi
+}
+
+function fsck_loop_sizes()
+{
+ local endian=$1 # be, le
+ local seek=$2 # 4 for nopad, 516 for pad
+ shift 2 # the rest are sizes to loop over
+
+ for size in "$@"; do
+ ts_log "## size: $size"
+ cp -a "$IMAGE_FILE" "$IMAGE_FILE.tmp"
+ num2binary "$size" $endian |
+ dd of="$IMAGE_FILE.tmp" bs=1 seek="$seek" count=4 conv=notrunc &> /dev/null
+ $TS_CMD_FSCKCRAMFS "$IMAGE_FILE.tmp" >> $TS_OUTPUT 2>&1
+ ts_log "ret: $?
+"
+ done
+ rm -f "$IMAGE_FILE"
+}
+
+
+IMAGE_SOURCE="$TS_OUTDIR/${TS_TESTNAME}-data"
IMAGE_FILE="$TS_OUTDIR/${TS_TESTNAME}-cramfs.img"
mkdir -p "${IMAGE_SOURCE}/subdir" &> /dev/null
-$TS_CMD_MKCRAMFS -p -N big $IMAGE_SOURCE $IMAGE_FILE &> /dev/null
-echo -ne \\00\\x4c |
- dd of=$IMAGE_FILE bs=1 seek=518 count=2 conv=notrunc &> /dev/null
-$TS_CMD_FSCKCRAMFS $IMAGE_FILE >> $TS_OUTPUT 2>&1
+
+ts_init_subtest "nopad-4K-be"
+$TS_CMD_MKCRAMFS -N big -b 4096 $IMAGE_SOURCE $IMAGE_FILE &> /dev/null
+fsck_loop_sizes be 4 0 75 76 4095 4096 4097 4294967295
+rm -f "$IMAGE_FILE"
+ts_finalize_subtest
+
+ts_init_subtest "nopad-4K-le"
+$TS_CMD_MKCRAMFS -N little -b 4096 $IMAGE_SOURCE $IMAGE_FILE &> /dev/null
+fsck_loop_sizes le 4 0 75 76 4095 4096 4097 4294967295
+ts_finalize_subtest
+
+ts_init_subtest "pad-4K-be"
+$TS_CMD_MKCRAMFS -p -N big -b 4096 $IMAGE_SOURCE $IMAGE_FILE &> /dev/null
+fsck_loop_sizes be 516 76 587 588 4095 4096 4097 4294967295
+ts_finalize_subtest
+
+ts_init_subtest "pad-4K-le"
+$TS_CMD_MKCRAMFS -p -N little -b 4096 $IMAGE_SOURCE $IMAGE_FILE &> /dev/null
+fsck_loop_sizes le 516 76 587 588 4095 4096 4097 4294967295
+ts_finalize_subtest
+
+ts_init_subtest "pad-64K-be"
+$TS_CMD_MKCRAMFS -p -N big -b 65536 $IMAGE_SOURCE $IMAGE_FILE &> /dev/null
+fsck_loop_sizes be 516 76 587 588 65535 65536 65537 4294967295
+ts_finalize_subtest
+
+ts_init_subtest "pad-64K-le"
+$TS_CMD_MKCRAMFS -p -N little -b 65536 $IMAGE_SOURCE $IMAGE_FILE &> /dev/null
+fsck_loop_sizes le 516 76 587 588 65535 65536 65537 4294967295
+ts_finalize_subtest
+
+rm -rf "$IMAGE_SOURCE" "$IMAGE_FILE.tmp"
ts_finalize
--
2.13.6
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/7] fsck.cramfs: fix error message
2018-01-23 15:59 [PATCH 0/7] fixes for fsck.cramfs and other things Ruediger Meier
` (2 preceding siblings ...)
2018-01-23 15:59 ` [PATCH 3/7] tests: rewrite fsck-bad-header Ruediger Meier
@ 2018-01-23 15:59 ` Ruediger Meier
2018-01-23 15:59 ` [PATCH 5/7] tests: suppress warning for old sync(1) Ruediger Meier
` (3 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Ruediger Meier @ 2018-01-23 15:59 UTC (permalink / raw)
To: util-linux
From: Ruediger Meier <ruediger.meier@ga-group.nl>
errno is invalid in case that we just read(3) too short.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
disk-utils/fsck.cramfs.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/disk-utils/fsck.cramfs.c b/disk-utils/fsck.cramfs.c
index 820816b14..2a4f75a8c 100644
--- a/disk-utils/fsck.cramfs.c
+++ b/disk-utils/fsck.cramfs.c
@@ -226,10 +226,15 @@ static void test_crc(int start)
mmap(NULL, super.size, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (buf != MAP_FAILED) {
+ ssize_t tmp;
if (lseek(fd, 0, SEEK_SET) == (off_t) -1)
err(FSCK_EX_ERROR, _("seek on %s failed"), filename);
- if (read(fd, buf, super.size) != (ssize_t) super.size)
+ tmp = read(fd, buf, super.size);
+ if (tmp < 0)
err(FSCK_EX_ERROR, _("cannot read %s"), filename);
+ if (tmp != (ssize_t) super.size)
+ errx(FSCK_EX_ERROR, _("failed to read %"PRIu32" bytes from file %s"),
+ super.size, filename);
}
}
if (buf != MAP_FAILED) {
--
2.13.6
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 5/7] tests: suppress warning for old sync(1)
2018-01-23 15:59 [PATCH 0/7] fixes for fsck.cramfs and other things Ruediger Meier
` (3 preceding siblings ...)
2018-01-23 15:59 ` [PATCH 4/7] fsck.cramfs: fix error message Ruediger Meier
@ 2018-01-23 15:59 ` Ruediger Meier
2018-01-23 15:59 ` [PATCH 6/7] tests: fix fincore/count KNOWN_FAIL Ruediger Meier
` (2 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Ruediger Meier @ 2018-01-23 15:59 UTC (permalink / raw)
To: util-linux
From: root <root@adsiz>
Old sync(1) prints a warning which looks ugly among our
test output: "sync: ignoring all arguments"
Seen on travis, Ubuntu <= 14.04 (Trusty).
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
tests/functions.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/functions.sh b/tests/functions.sh
index ef11a893e..d1c97e0b6 100644
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -635,7 +635,7 @@ function ts_fstab_open {
function ts_fstab_close {
echo "# -->" >> /etc/fstab
- sync /etc/fstab
+ sync /etc/fstab 2>/dev/null
}
function ts_fstab_addline {
@@ -669,7 +669,7 @@ function ts_fstab_clean {
s/# <!-- util-linux.*-->//;
/^$/d" /etc/fstab
- sync /etc/fstab
+ sync /etc/fstab 2>/dev/null
ts_unlock "fstab"
}
--
2.13.6
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 6/7] tests: fix fincore/count KNOWN_FAIL
2018-01-23 15:59 [PATCH 0/7] fixes for fsck.cramfs and other things Ruediger Meier
` (4 preceding siblings ...)
2018-01-23 15:59 ` [PATCH 5/7] tests: suppress warning for old sync(1) Ruediger Meier
@ 2018-01-23 15:59 ` Ruediger Meier
2018-01-23 15:59 ` [PATCH 7/7] rfkill: provide RFKILL_TYPE_FM if undefined Ruediger Meier
2018-01-24 12:16 ` [PATCH 0/7] fixes for fsck.cramfs and other things Karel Zak
7 siblings, 0 replies; 13+ messages in thread
From: Ruediger Meier @ 2018-01-23 15:59 UTC (permalink / raw)
To: util-linux
From: Ruediger Meier <ruediger.meier@ga-group.nl>
It has to be set after calling ts_init.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
tests/ts/fincore/count | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/tests/ts/fincore/count b/tests/ts/fincore/count
index c2dff7e34..46700a32e 100755
--- a/tests/ts/fincore/count
+++ b/tests/ts/fincore/count
@@ -3,15 +3,14 @@
TS_TOPDIR="${0%/*}/../.."
TS_DESC="count file contents in core"
-# Send patch if you know how to keep it portable and robust. Thanks.
-TS_KNOWN_FAIL="yes"
-
-
. $TS_TOPDIR/functions.sh
ts_init "$*"
ts_check_test_command "$TS_HELPER_SYSINFO"
+# Send patch if you know how to keep it portable and robust. Thanks.
+TS_KNOWN_FAIL="yes"
+
function header
{
echo "[" "$1" "]"
--
2.13.6
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 7/7] rfkill: provide RFKILL_TYPE_FM if undefined
2018-01-23 15:59 [PATCH 0/7] fixes for fsck.cramfs and other things Ruediger Meier
` (5 preceding siblings ...)
2018-01-23 15:59 ` [PATCH 6/7] tests: fix fincore/count KNOWN_FAIL Ruediger Meier
@ 2018-01-23 15:59 ` Ruediger Meier
2018-01-24 12:16 ` [PATCH 0/7] fixes for fsck.cramfs and other things Karel Zak
7 siblings, 0 replies; 13+ messages in thread
From: Ruediger Meier @ 2018-01-23 15:59 UTC (permalink / raw)
To: util-linux
From: Ruediger Meier <ruediger.meier@ga-group.nl>
As discussed last year it's nice to be compatible to 2.6.32
https://www.spinics.net/lists/util-linux-ng/msg13963.html
BTW also re-define NUM_RFKILL_TYPES if needed, although we are
not really using it.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
sys-utils/rfkill.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sys-utils/rfkill.c b/sys-utils/rfkill.c
index 75804ad41..031fe436f 100644
--- a/sys-utils/rfkill.c
+++ b/sys-utils/rfkill.c
@@ -45,7 +45,12 @@
* year 2009 (2.6.33) or older.
*/
#ifndef RFKILL_TYPE_NFC
+# ifndef RFKILL_TYPE_FM
+# define RFKILL_TYPE_FM RFKILL_TYPE_GPS + 1
+# endif
# define RFKILL_TYPE_NFC RFKILL_TYPE_FM + 1
+# undef NUM_RFKILL_TYPES
+# define NUM_RFKILL_TYPES RFKILL_TYPE_NFC + 1
#endif
struct rfkill_type_str {
--
2.13.6
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 2/7] fsck.cramfs: fix crash when superblock size is too small
2018-01-23 15:59 ` [PATCH 2/7] fsck.cramfs: fix crash when superblock size is too small Ruediger Meier
@ 2018-01-23 19:41 ` Tobias Stöckmann
2018-01-24 14:41 ` Ruediger Meier
0 siblings, 1 reply; 13+ messages in thread
From: Tobias Stöckmann @ 2018-01-23 19:41 UTC (permalink / raw)
To: Ruediger Meier, util-linux
> This hopefully fixes the original problem addressed by the reverted
> patch 7cb962c7.
It does.
> /* What are valid superblock sizes? */
> - if (super.size < sizeof(struct cramfs_super))
> + if (super.size < *start + sizeof(struct cramfs_super))
And this is a more elegant (and working) solution. I was not sure how
much adjustment this if-statement can handle due to the comment.
Thanks and sorry for the regression,
Tobias
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/7] fixes for fsck.cramfs and other things
2018-01-23 15:59 [PATCH 0/7] fixes for fsck.cramfs and other things Ruediger Meier
` (6 preceding siblings ...)
2018-01-23 15:59 ` [PATCH 7/7] rfkill: provide RFKILL_TYPE_FM if undefined Ruediger Meier
@ 2018-01-24 12:16 ` Karel Zak
2018-01-24 14:47 ` Ruediger Meier
7 siblings, 1 reply; 13+ messages in thread
From: Karel Zak @ 2018-01-24 12:16 UTC (permalink / raw)
To: Ruediger Meier; +Cc: util-linux
On Tue, Jan 23, 2018 at 04:59:21PM +0100, Ruediger Meier wrote:
> From: Ruediger Meier <ruediger.meier@ga-group.nl>
>
> Ruediger Meier (6):
> Revert "fsck.cramfs: Fix bus error on broken file system."
> fsck.cramfs: fix crash when superblock size is too small
> tests: rewrite fsck-bad-header
Nice.
> fsck.cramfs: fix error message
> tests: fix fincore/count KNOWN_FAIL
> rfkill: provide RFKILL_TYPE_FM if undefined
Applied, thanks!
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/7] fsck.cramfs: fix crash when superblock size is too small
2018-01-23 19:41 ` Tobias Stöckmann
@ 2018-01-24 14:41 ` Ruediger Meier
0 siblings, 0 replies; 13+ messages in thread
From: Ruediger Meier @ 2018-01-24 14:41 UTC (permalink / raw)
To: Tobias Stc3b6ckmann; +Cc: util-linux
On Tuesday 23 January 2018, Tobias Stc3b6ckmann wrote:
> > This hopefully fixes the original problem addressed by the reverted
> > patch 7cb962c7.
>
> It does.
>
> > /* What are valid superblock sizes? */
> > - if (super.size < sizeof(struct cramfs_super))
> > + if (super.size < *start + sizeof(struct cramfs_super))
>
> And this is a more elegant (and working) solution. I was not sure how
> much adjustment this if-statement can handle due to the comment.
The comment is a bit stupid. Actually super.size should be a multiple of
PAGE_SIZE of the running kernel to be able to mount it on the current
system. I've relaxed this requirement to be able to fsck a cramfs from
other systems. This is IMO a nice feature because in real life cramfs
will be created often on cross-compiler hosts to be deployed to another
embedded system. Though maybe we should add a warning like "This image
is not mountable on the current system".
>
> Thanks and sorry for the regression,
All fine, you discovered a bug I made. :)
> Tobias
> --
> To unsubscribe from this list: send the line "unsubscribe util-linux"
> in the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/7] fixes for fsck.cramfs and other things
2018-01-24 12:16 ` [PATCH 0/7] fixes for fsck.cramfs and other things Karel Zak
@ 2018-01-24 14:47 ` Ruediger Meier
2018-01-30 10:50 ` Karel Zak
0 siblings, 1 reply; 13+ messages in thread
From: Ruediger Meier @ 2018-01-24 14:47 UTC (permalink / raw)
To: Karel Zak; +Cc: util-linux
On Wednesday 24 January 2018, Karel Zak wrote:
> On Tue, Jan 23, 2018 at 04:59:21PM +0100, Ruediger Meier wrote:
> > From: Ruediger Meier <ruediger.meier@ga-group.nl>
> >
> > Ruediger Meier (6):
> > Revert "fsck.cramfs: Fix bus error on broken file system."
> > fsck.cramfs: fix crash when superblock size is too small
> > tests: rewrite fsck-bad-header
>
> Nice.
>
> > fsck.cramfs: fix error message
BTW while we are at this. I wonder why we have 3 different ways
(fallbacks) in fsck.cramfs.c test_crc() how to read the image.
1. mmap
2. read into anonymous mmap
3. read blockwise
Does anybody knows why is this and whether we still need all these
fallbacks?
cu,
Rudi
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/7] fixes for fsck.cramfs and other things
2018-01-24 14:47 ` Ruediger Meier
@ 2018-01-30 10:50 ` Karel Zak
0 siblings, 0 replies; 13+ messages in thread
From: Karel Zak @ 2018-01-30 10:50 UTC (permalink / raw)
To: Ruediger Meier; +Cc: util-linux
On Wed, Jan 24, 2018 at 03:47:57PM +0100, Ruediger Meier wrote:
> On Wednesday 24 January 2018, Karel Zak wrote:
> > On Tue, Jan 23, 2018 at 04:59:21PM +0100, Ruediger Meier wrote:
> > > From: Ruediger Meier <ruediger.meier@ga-group.nl>
> > >
> > > Ruediger Meier (6):
> > > Revert "fsck.cramfs: Fix bus error on broken file system."
> > > fsck.cramfs: fix crash when superblock size is too small
> > > tests: rewrite fsck-bad-header
> >
> > Nice.
> >
> > > fsck.cramfs: fix error message
>
> BTW while we are at this. I wonder why we have 3 different ways
> (fallbacks) in fsck.cramfs.c test_crc() how to read the image.
>
> 1. mmap
> 2. read into anonymous mmap
> 3. read blockwise
>
> Does anybody knows why is this and whether we still need all these
> fallbacks?
The question is why we need mmap at all here;-)
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2018-01-30 10:50 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-23 15:59 [PATCH 0/7] fixes for fsck.cramfs and other things Ruediger Meier
2018-01-23 15:59 ` [PATCH 1/7] Revert "fsck.cramfs: Fix bus error on broken file system." Ruediger Meier
2018-01-23 15:59 ` [PATCH 2/7] fsck.cramfs: fix crash when superblock size is too small Ruediger Meier
2018-01-23 19:41 ` Tobias Stöckmann
2018-01-24 14:41 ` Ruediger Meier
2018-01-23 15:59 ` [PATCH 3/7] tests: rewrite fsck-bad-header Ruediger Meier
2018-01-23 15:59 ` [PATCH 4/7] fsck.cramfs: fix error message Ruediger Meier
2018-01-23 15:59 ` [PATCH 5/7] tests: suppress warning for old sync(1) Ruediger Meier
2018-01-23 15:59 ` [PATCH 6/7] tests: fix fincore/count KNOWN_FAIL Ruediger Meier
2018-01-23 15:59 ` [PATCH 7/7] rfkill: provide RFKILL_TYPE_FM if undefined Ruediger Meier
2018-01-24 12:16 ` [PATCH 0/7] fixes for fsck.cramfs and other things Karel Zak
2018-01-24 14:47 ` Ruediger Meier
2018-01-30 10:50 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).