Skip to contentSkip to conversation

strace: add patch allowing compilation with kernel headers >= 2.6.32

PATCH Superseded Eric Bénard 5 participants 29 messages Jan 12, 2011 – Jan 14, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 strace: add patch allowing compilation with kernel headers >= 2.6.32

tested with kernel headers 2.6.31 & 2.6.37 : both compile fine.

---
 recipes/strace/strace_4.5.14.bb |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
recipes/strace/strace_4.5.14.bb +2 -1
index 33a44ad..395e4ee 100644
@@ -1,7 +1,7 @@
 DESCRIPTION = "strace is a system call tracing tool."
 SECTION = "console/utils"
 LICENSE = "BSD"
-PR = "r9"
+PR = "r10"
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
            file://glibc-2.5.patch \
@@ -13,6 +13,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
            file://strace-arm-no-cachectl.patch \
            file://strace-dont-include-linux-dirent-h.patch \
            file://mips-sigcontext.patch \
+           file://strace-linux-2.6.32.patch \
           "
 
 # The strace-4.5.14-avr32.patch conflicts with some other patches.
Signature · 1 line
1.6.3.3
#1 lore raw

PATCH 2/3 busybox 1.18.1: add latest fix

* httpd: send correct mtime for .gz filesmaster
* patch fetched from git as per blindvt request

---
 recipes/busybox/busybox_1.18.1.bb |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
recipes/busybox/busybox_1.18.1.bb +4 -3
index a2b4475..f337eef 100644
@@ -1,5 +1,5 @@
 require busybox_1.1x.inc
-PR = "${INC_PR}.4"
+PR = "${INC_PR}.5"
 
 SRC_URI += " \
 	file://busybox-1.18.1-hush.patch \
@@ -8,9 +8,10 @@ SRC_URI += " \
 	file://busybox-1.18.1-mkswap.patch \
 	file://busybox-1.18.1-warning.patch \
 	file://busybox-1.18.1-modprobe-small.patch \
-	file://busybox-1.18.1-tftp.patch \
+	http://git.busybox.net/busybox/patch/id=8030a1484917d5b71d5ccd1a1d28a29da7a3d7f0;apply=yes;name=bb181-01 \
 	"
 
 SRC_URI[md5sum] = "f15fe752d8b7012aa5e59f83b88ccb1c"
 SRC_URI[sha256sum] = "33eb25ea7b20c727c3af769256b21408a1ac1f927ff9f89a1f1e3767c18c9967"
-
+SRC_URI[bb181-01.md5sum] = "fe58a0e758c2581fdd2554186089b03b"
+SRC_URI[bb181-01.sha256sum] = "f776d0b4ba525c62abe5e91f1432773eca92904cdecbdf48546a9271166cd896"
Signature · 1 line
1.6.3.3
#2 lore raw

PATCH 3/3 mtd-utils: add 1.4.1

latest stable version + a fix to mkubifs.

tested to generate ubi rootfs on the host.

---
 .../mtd/mtd-utils-1.4.1/fix_heap_corruption.patch  |   95 ++++++++++++++++++++
 recipes/mtd/mtd-utils-native_1.4.1.bb              |    3 +
 recipes/mtd/mtd-utils_1.4.1.bb                     |   27 ++++++
 3 files changed, 125 insertions(+), 0 deletions(-)
 create mode 100644 recipes/mtd/mtd-utils-1.4.1/fix_heap_corruption.patch
 create mode 100644 recipes/mtd/mtd-utils-native_1.4.1.bb
 create mode 100644 recipes/mtd/mtd-utils_1.4.1.bb
recipes/mtd/mtd-utils-1.4.1/fix_heap_corruption.patch new file +95 -0
new file mode 100644
index 0000000..5ce3a53
@@ -0,0 +1,95 @@
+From d8f0ae2f26898f652ad3af4536b5d0e4db37714f Mon Sep 17 00:00:00 2001
+From: Kevin Cernekee <[email protected]>
+Date: Wed, 22 Sep 2010 16:01:59 -0700
+Subject: [PATCH] mkfs.ubifs: Fix heap corruption on LEB overrun
+
+If max_leb_cnt (-c option) is set too low, set_lprops() will corrupt
+the heap and may result in a scary looking crash:
+
+$ bin/mkfs.ubifs -U -r romfs -o ubifs.img -m 512 -e 15360 -c 39
+Error: max_leb_cnt too low (241 needed)
+*** glibc detected *** bin/mkfs.ubifs: double free or corruption (!prev): 0x088fe070 ***
+======= Backtrace: =========
+/lib32/libc.so.6(+0x6c231)[0xf75fb231]
+/lib32/libc.so.6(+0x6dab8)[0xf75fcab8]
+/lib32/libc.so.6(cfree+0x6d)[0xf75ffb9d]
+bin/mkfs.ubifs[0x804e801]
+bin/mkfs.ubifs[0x804e94b]
+bin/mkfs.ubifs[0x804e99d]
+/lib32/libc.so.6(__libc_start_main+0xe6)[0xf75a5bd6]
+bin/mkfs.ubifs(__fxstat64+0x55)[0x80491e1]
+======= Memory map: ========
+08048000-0805d000 r-xp 00000000 08:08 10012045                           /work/bin/mkfs.ubifs
+0805d000-0805e000 rwxp 00015000 08:08 10012045                           /work/bin/mkfs.ubifs
+088fe000-08945000 rwxp 00000000 00:00 0                                  [heap]
+f73e1000-f73fe000 r-xp 00000000 08:05 2228842                            /usr/lib32/libgcc_s.so.1
+f73fe000-f73ff000 r-xp 0001c000 08:05 2228842                            /usr/lib32/libgcc_s.so.1
+f73ff000-f7400000 rwxp 0001d000 08:05 2228842                            /usr/lib32/libgcc_s.so.1
+f7400000-f7421000 rwxp 00000000 00:00 0
+f7421000-f7500000 ---p 00000000 00:00 0
+f751c000-f758f000 rwxp 00000000 00:00 0
+f758f000-f76e2000 r-xp 00000000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e2000-f76e3000 ---p 00153000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e3000-f76e5000 r-xp 00153000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e5000-f76e6000 rwxp 00155000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e6000-f76e9000 rwxp 00000000 00:00 0
+f76e9000-f770d000 r-xp 00000000 08:05 426296                             /lib32/libm-2.11.1.so
+f770d000-f770e000 r-xp 00023000 08:05 426296                             /lib32/libm-2.11.1.so
+f770e000-f770f000 rwxp 00024000 08:05 426296                             /lib32/libm-2.11.1.so
+f772a000-f772c000 rwxp 00000000 00:00 0
+f772c000-f772d000 r-xp 00000000 00:00 0                                  [vdso]
+f772d000-f7749000 r-xp 00000000 08:05 6062081                            /lib32/ld-2.11.1.so
+f7749000-f774a000 r-xp 0001b000 08:05 6062081                            /lib32/ld-2.11.1.so
+f774a000-f774b000 rwxp 0001c000 08:05 6062081                            /lib32/ld-2.11.1.so
+ffb58000-ffb6d000 rwxp 00000000 00:00 0                                  [stack]
+Aborted
+
+New code aborts cleanly, and still calculates the number of LEBs
+required:
+
+$ bin/mkfs.ubifs -U -r romfs -o tmp/ubifs.img -m 512 -e 15360 -c 39
+Error: max_leb_cnt too low (241 needed)
+$ echo $?
+255
+$ bin/mkfs.ubifs -U -r romfs -o tmp/ubifs.img -m 512 -e 15360 -c 240
+Error: max_leb_cnt too low (241 needed)
+$ bin/mkfs.ubifs -U -r romfs -o tmp/ubifs.img -m 512 -e 15360 -c 241
+$
+
+Signed-off-by: Kevin Cernekee <[email protected]>
+Signed-off-by: Artem Bityutskiy <[email protected]>
+---
+ mkfs.ubifs/mkfs.ubifs.c |   10 +++++-----
+ 1 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/mkfs.ubifs/mkfs.ubifs.c b/mkfs.ubifs/mkfs.ubifs.c
+index eeb5e42..ec38f0e 100644
+--- a/mkfs.ubifs/mkfs.ubifs.c
++++ b/mkfs.ubifs/mkfs.ubifs.c
+@@ -929,9 +929,11 @@ static void set_lprops(int lnum, int offs, int flags)
+ 	dirty = c->leb_size - free - ALIGN(offs, 8);
+ 	dbg_msg(3, "LEB %d free %d dirty %d flags %d", lnum, free, dirty,
+ 		flags);
+-	c->lpt[i].free = free;
+-	c->lpt[i].dirty = dirty;
+-	c->lpt[i].flags = flags;
++	if (i < c->main_lebs) {
++		c->lpt[i].free = free;
++		c->lpt[i].dirty = dirty;
++		c->lpt[i].flags = flags;
++	}
+ 	c->lst.total_free += free;
+ 	c->lst.total_dirty += dirty;
+ 	if (flags & LPROPS_INDEX)
+@@ -1943,8 +1945,6 @@ static int finalize_leb_cnt(void)
+ {
+ 	c->leb_cnt = head_lnum;
+ 	if (c->leb_cnt > c->max_leb_cnt)
+-		/* TODO: in this case it segfaults because buffer overruns - we
+-		 * somewhere allocate smaller buffers - fix */
+ 		return err_msg("max_leb_cnt too low (%d needed)", c->leb_cnt);
+ 	c->main_lebs = c->leb_cnt - c->main_first;
+ 	if (verbose) {
+-- 
+1.7.2.3
+
recipes/mtd/mtd-utils-native_1.4.1.bb new file +3 -0
new file mode 100644
index 0000000..74ba439
@@ -0,0 +1,3 @@
+require mtd-utils_${PV}.bb
+require mtd-utils-native.inc
+DEPENDS += "util-linux-ng-native"
recipes/mtd/mtd-utils_1.4.1.bb new file +27 -0
new file mode 100644
index 0000000..d67ea5f
@@ -0,0 +1,27 @@
+require mtd-utils.inc
+
+DEPENDS += "util-linux-ng"
+
+PARALLEL_MAKE = ""
+ARM_INSTRUCTION_SET = "arm"
+
+# This is the default package, thus we lock to a specific git version so 
+# upstream changes will not break builds.
+
+TAG = "v${PV}"
+
+SRC_URI = "git://git.infradead.org/mtd-utils.git;protocol=git;tag=${TAG} \
+	   file://add-exclusion-to-mkfs-jffs2-git-2.patch \
+	   file://fix_heap_corruption.patch \
+	   file://lzo_1x-git.patch"
+
+S = "${WORKDIR}/git/"
+
+do_configure_prepend() {
+	for i in $(find . -name "Makefile") ; do
+		sed -i -e s:lzo2:lzo:g $i
+	done
+	if [ -e mkfs.ubifs/compr.c ]; then
+		sed -i -e s:lzo/::g mkfs.ubifs/compr.c
+	fi
+}
Signature · 1 line
1.6.3.3
#13 lore raw
In reply to Eric Bénard
Quoted 1 line · Eric Bénard

tested with kernel headers 2.6.31& 2.6.37 : both compile fine.

Is there a reason to not switch to 4.5.20, or even newer instead?

Quoted 27 lines
---
  recipes/strace/strace_4.5.14.bb |    3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)
recipes/strace/strace_4.5.14.bb +2 -1
index 33a44ad..395e4ee 100644
@@ -1,7 +1,7 @@
  DESCRIPTION = "strace is a system call tracing tool."
  SECTION = "console/utils"
  LICENSE = "BSD"
-PR = "r9"
+PR = "r10"
 
  SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
             file://glibc-2.5.patch \
@@ -13,6 +13,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
             file://strace-arm-no-cachectl.patch \
             file://strace-dont-include-linux-dirent-h.patch \
             file://mips-sigcontext.patch \
+           file://strace-linux-2.6.32.patch \
            "
 
  # The strace-4.5.14-avr32.patch conflicts with some other patches.
Signature · 2 lines
Tom Rini
Mentor Graphics Corporation
#3 lore raw

Re: [PATCH 3/3] mtd-utils: add 1.4.1

In reply to Eric Bénard
Quoted 5 lines · Eric Bénard

latest stable version + a fix to mkubifs.

tested to generate ubi rootfs on the host.

Is there a reason we're perpetuating lzo1 for newer stuff rather than switching to lzo2?

Quoted 152 lines
---
  .../mtd/mtd-utils-1.4.1/fix_heap_corruption.patch  |   95 ++++++++++++++++++++
  recipes/mtd/mtd-utils-native_1.4.1.bb              |    3 +
  recipes/mtd/mtd-utils_1.4.1.bb                     |   27 ++++++
  3 files changed, 125 insertions(+), 0 deletions(-)

create mode 100644 recipes/mtd/mtd-utils-1.4.1/fix_heap_corruption.patch create mode 100644 recipes/mtd/mtd-utils-native_1.4.1.bb create mode 100644 recipes/mtd/mtd-utils_1.4.1.bb

recipes/mtd/mtd-utils-1.4.1/fix_heap_corruption.patch new file +95 -0
new file mode 100644
index 0000000..5ce3a53
@@ -0,0 +1,95 @@
+From d8f0ae2f26898f652ad3af4536b5d0e4db37714f Mon Sep 17 00:00:00 2001
+From: Kevin Cernekee<[email protected]>
+Date: Wed, 22 Sep 2010 16:01:59 -0700
+Subject: [PATCH] mkfs.ubifs: Fix heap corruption on LEB overrun
+
+If max_leb_cnt (-c option) is set too low, set_lprops() will corrupt
+the heap and may result in a scary looking crash:
+
+$ bin/mkfs.ubifs -U -r romfs -o ubifs.img -m 512 -e 15360 -c 39
+Error: max_leb_cnt too low (241 needed)
+*** glibc detected *** bin/mkfs.ubifs: double free or corruption (!prev): 0x088fe070 ***
+======= Backtrace: =========
+/lib32/libc.so.6(+0x6c231)[0xf75fb231]
+/lib32/libc.so.6(+0x6dab8)[0xf75fcab8]
+/lib32/libc.so.6(cfree+0x6d)[0xf75ffb9d]
+bin/mkfs.ubifs[0x804e801]
+bin/mkfs.ubifs[0x804e94b]
+bin/mkfs.ubifs[0x804e99d]
+/lib32/libc.so.6(__libc_start_main+0xe6)[0xf75a5bd6]
+bin/mkfs.ubifs(__fxstat64+0x55)[0x80491e1]
+======= Memory map: ========
+08048000-0805d000 r-xp 00000000 08:08 10012045                           /work/bin/mkfs.ubifs
+0805d000-0805e000 rwxp 00015000 08:08 10012045                           /work/bin/mkfs.ubifs
+088fe000-08945000 rwxp 00000000 00:00 0                                  [heap]
+f73e1000-f73fe000 r-xp 00000000 08:05 2228842                            /usr/lib32/libgcc_s.so.1
+f73fe000-f73ff000 r-xp 0001c000 08:05 2228842                            /usr/lib32/libgcc_s.so.1
+f73ff000-f7400000 rwxp 0001d000 08:05 2228842                            /usr/lib32/libgcc_s.so.1
+f7400000-f7421000 rwxp 00000000 00:00 0
+f7421000-f7500000 ---p 00000000 00:00 0
+f751c000-f758f000 rwxp 00000000 00:00 0
+f758f000-f76e2000 r-xp 00000000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e2000-f76e3000 ---p 00153000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e3000-f76e5000 r-xp 00153000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e5000-f76e6000 rwxp 00155000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e6000-f76e9000 rwxp 00000000 00:00 0
+f76e9000-f770d000 r-xp 00000000 08:05 426296                             /lib32/libm-2.11.1.so
+f770d000-f770e000 r-xp 00023000 08:05 426296                             /lib32/libm-2.11.1.so
+f770e000-f770f000 rwxp 00024000 08:05 426296                             /lib32/libm-2.11.1.so
+f772a000-f772c000 rwxp 00000000 00:00 0
+f772c000-f772d000 r-xp 00000000 00:00 0                                  [vdso]
+f772d000-f7749000 r-xp 00000000 08:05 6062081                            /lib32/ld-2.11.1.so
+f7749000-f774a000 r-xp 0001b000 08:05 6062081                            /lib32/ld-2.11.1.so
+f774a000-f774b000 rwxp 0001c000 08:05 6062081                            /lib32/ld-2.11.1.so
+ffb58000-ffb6d000 rwxp 00000000 00:00 0                                  [stack]
+Aborted
+
+New code aborts cleanly, and still calculates the number of LEBs
+required:
+
+$ bin/mkfs.ubifs -U -r romfs -o tmp/ubifs.img -m 512 -e 15360 -c 39
+Error: max_leb_cnt too low (241 needed)
+$ echo $?
+255
+$ bin/mkfs.ubifs -U -r romfs -o tmp/ubifs.img -m 512 -e 15360 -c 240
+Error: max_leb_cnt too low (241 needed)
+$ bin/mkfs.ubifs -U -r romfs -o tmp/ubifs.img -m 512 -e 15360 -c 241
+$
+
+Signed-off-by: Kevin Cernekee<[email protected]>
+Signed-off-by: Artem Bityutskiy<[email protected]>
+---
+ mkfs.ubifs/mkfs.ubifs.c |   10 +++++-----
+ 1 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/mkfs.ubifs/mkfs.ubifs.c b/mkfs.ubifs/mkfs.ubifs.c
+index eeb5e42..ec38f0e 100644
+--- a/mkfs.ubifs/mkfs.ubifs.c
++++ b/mkfs.ubifs/mkfs.ubifs.c
+@@ -929,9 +929,11 @@ static void set_lprops(int lnum, int offs, int flags)
+ 	dirty = c->leb_size - free - ALIGN(offs, 8);
+ 	dbg_msg(3, "LEB %d free %d dirty %d flags %d", lnum, free, dirty,
+ 		flags);
+-	c->lpt[i].free = free;
+-	c->lpt[i].dirty = dirty;
+-	c->lpt[i].flags = flags;
++	if (i<  c->main_lebs) {
++		c->lpt[i].free = free;
++		c->lpt[i].dirty = dirty;
++		c->lpt[i].flags = flags;
++	}
+ 	c->lst.total_free += free;
+ 	c->lst.total_dirty += dirty;
+ 	if (flags&  LPROPS_INDEX)
+@@ -1943,8 +1945,6 @@ static int finalize_leb_cnt(void)
+ {
+ 	c->leb_cnt = head_lnum;
+ 	if (c->leb_cnt>  c->max_leb_cnt)
+-		/* TODO: in this case it segfaults because buffer overruns - we
+-		 * somewhere allocate smaller buffers - fix */
+ 		return err_msg("max_leb_cnt too low (%d needed)", c->leb_cnt);
+ 	c->main_lebs = c->leb_cnt - c->main_first;
+ 	if (verbose) {
+--
+1.7.2.3
+
recipes/mtd/mtd-utils-native_1.4.1.bb new file +3 -0
new file mode 100644
index 0000000..74ba439
@@ -0,0 +1,3 @@
+require mtd-utils_${PV}.bb
+require mtd-utils-native.inc
+DEPENDS += "util-linux-ng-native"
recipes/mtd/mtd-utils_1.4.1.bb new file +27 -0
new file mode 100644
index 0000000..d67ea5f
@@ -0,0 +1,27 @@
+require mtd-utils.inc
+
+DEPENDS += "util-linux-ng"
+
+PARALLEL_MAKE = ""
+ARM_INSTRUCTION_SET = "arm"
+
+# This is the default package, thus we lock to a specific git version so
+# upstream changes will not break builds.
+
+TAG = "v${PV}"
+
+SRC_URI = "git://git.infradead.org/mtd-utils.git;protocol=git;tag=${TAG} \
+	   file://add-exclusion-to-mkfs-jffs2-git-2.patch \
+	   file://fix_heap_corruption.patch \
+	   file://lzo_1x-git.patch"
+
+S = "${WORKDIR}/git/"
+
+do_configure_prepend() {
+	for i in $(find . -name "Makefile") ; do
+		sed -i -e s:lzo2:lzo:g $i
+	done
+	if [ -e mkfs.ubifs/compr.c ]; then
+		sed -i -e s:lzo/::g mkfs.ubifs/compr.c
+	fi
+}
Signature · 2 lines
Tom Rini
Mentor Graphics Corporation
#17 lore raw
In reply to Eric Bénard
Quoted 3 lines · Eric Bénard

tested with kernel headers 2.6.31& 2.6.37 : both compile fine.

I think you forgot to add the patch itself.

Quoted 25 lines
---
  recipes/strace/strace_4.5.14.bb |    3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)
recipes/strace/strace_4.5.14.bb +2 -1
index 33a44ad..395e4ee 100644
@@ -1,7 +1,7 @@
  DESCRIPTION = "strace is a system call tracing tool."
  SECTION = "console/utils"
  LICENSE = "BSD"
-PR = "r9"
+PR = "r10"
 
  SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
             file://glibc-2.5.patch \
@@ -13,6 +13,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
             file://strace-arm-no-cachectl.patch \
             file://strace-dont-include-linux-dirent-h.patch \
             file://mips-sigcontext.patch \
+           file://strace-linux-2.6.32.patch \
            "
 
  # The strace-4.5.14-avr32.patch conflicts with some other patches.
Acked-by on v1 2/3
#12 lore raw

Re: [PATCH 2/3] busybox 1.18.1: add latest fix

In reply to Eric Bénard
Quoted 4 lines · Eric Bénard

* httpd: send correct mtime for .gz filesmaster
* patch fetched from git as per blindvt request

Quoted 28 lines
---
  recipes/busybox/busybox_1.18.1.bb |    7 ++++---
  1 files changed, 4 insertions(+), 3 deletions(-)
recipes/busybox/busybox_1.18.1.bb +4 -3
index a2b4475..f337eef 100644
@@ -1,5 +1,5 @@
  require busybox_1.1x.inc
-PR = "${INC_PR}.4"
+PR = "${INC_PR}.5"
 
  SRC_URI += " \
  	file://busybox-1.18.1-hush.patch \
@@ -8,9 +8,10 @@ SRC_URI += " \
  	file://busybox-1.18.1-mkswap.patch \
  	file://busybox-1.18.1-warning.patch \
  	file://busybox-1.18.1-modprobe-small.patch \
-	file://busybox-1.18.1-tftp.patch \
+	http://git.busybox.net/busybox/patch/id=8030a1484917d5b71d5ccd1a1d28a29da7a3d7f0;apply=yes;name=bb181-01 \
  	"
 
  SRC_URI[md5sum] = "f15fe752d8b7012aa5e59f83b88ccb1c"
  SRC_URI[sha256sum] = "33eb25ea7b20c727c3af769256b21408a1ac1f927ff9f89a1f1e3767c18c9967"
-
+SRC_URI[bb181-01.md5sum] = "fe58a0e758c2581fdd2554186089b03b"
+SRC_URI[bb181-01.sha256sum] = "f776d0b4ba525c62abe5e91f1432773eca92904cdecbdf48546a9271166cd896"
Acked-by on v1 3/3
#11 lore raw

Re: [PATCH 3/3] mtd-utils: add 1.4.1

In reply to Eric Bénard
Quoted 5 lines · Eric Bénard

latest stable version + a fix to mkubifs.

tested to generate ubi rootfs on the host.

why is it compiled ARM only ? is there any issue with thumb mode

Quoted 152 lines
---
  .../mtd/mtd-utils-1.4.1/fix_heap_corruption.patch  |   95 ++++++++++++++++++++
  recipes/mtd/mtd-utils-native_1.4.1.bb              |    3 +
  recipes/mtd/mtd-utils_1.4.1.bb                     |   27 ++++++
  3 files changed, 125 insertions(+), 0 deletions(-)

create mode 100644 recipes/mtd/mtd-utils-1.4.1/fix_heap_corruption.patch create mode 100644 recipes/mtd/mtd-utils-native_1.4.1.bb create mode 100644 recipes/mtd/mtd-utils_1.4.1.bb

recipes/mtd/mtd-utils-1.4.1/fix_heap_corruption.patch new file +95 -0
new file mode 100644
index 0000000..5ce3a53
@@ -0,0 +1,95 @@
+From d8f0ae2f26898f652ad3af4536b5d0e4db37714f Mon Sep 17 00:00:00 2001
+From: Kevin Cernekee<[email protected]>
+Date: Wed, 22 Sep 2010 16:01:59 -0700
+Subject: [PATCH] mkfs.ubifs: Fix heap corruption on LEB overrun
+
+If max_leb_cnt (-c option) is set too low, set_lprops() will corrupt
+the heap and may result in a scary looking crash:
+
+$ bin/mkfs.ubifs -U -r romfs -o ubifs.img -m 512 -e 15360 -c 39
+Error: max_leb_cnt too low (241 needed)
+*** glibc detected *** bin/mkfs.ubifs: double free or corruption (!prev): 0x088fe070 ***
+======= Backtrace: =========
+/lib32/libc.so.6(+0x6c231)[0xf75fb231]
+/lib32/libc.so.6(+0x6dab8)[0xf75fcab8]
+/lib32/libc.so.6(cfree+0x6d)[0xf75ffb9d]
+bin/mkfs.ubifs[0x804e801]
+bin/mkfs.ubifs[0x804e94b]
+bin/mkfs.ubifs[0x804e99d]
+/lib32/libc.so.6(__libc_start_main+0xe6)[0xf75a5bd6]
+bin/mkfs.ubifs(__fxstat64+0x55)[0x80491e1]
+======= Memory map: ========
+08048000-0805d000 r-xp 00000000 08:08 10012045                           /work/bin/mkfs.ubifs
+0805d000-0805e000 rwxp 00015000 08:08 10012045                           /work/bin/mkfs.ubifs
+088fe000-08945000 rwxp 00000000 00:00 0                                  [heap]
+f73e1000-f73fe000 r-xp 00000000 08:05 2228842                            /usr/lib32/libgcc_s.so.1
+f73fe000-f73ff000 r-xp 0001c000 08:05 2228842                            /usr/lib32/libgcc_s.so.1
+f73ff000-f7400000 rwxp 0001d000 08:05 2228842                            /usr/lib32/libgcc_s.so.1
+f7400000-f7421000 rwxp 00000000 00:00 0
+f7421000-f7500000 ---p 00000000 00:00 0
+f751c000-f758f000 rwxp 00000000 00:00 0
+f758f000-f76e2000 r-xp 00000000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e2000-f76e3000 ---p 00153000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e3000-f76e5000 r-xp 00153000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e5000-f76e6000 rwxp 00155000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e6000-f76e9000 rwxp 00000000 00:00 0
+f76e9000-f770d000 r-xp 00000000 08:05 426296                             /lib32/libm-2.11.1.so
+f770d000-f770e000 r-xp 00023000 08:05 426296                             /lib32/libm-2.11.1.so
+f770e000-f770f000 rwxp 00024000 08:05 426296                             /lib32/libm-2.11.1.so
+f772a000-f772c000 rwxp 00000000 00:00 0
+f772c000-f772d000 r-xp 00000000 00:00 0                                  [vdso]
+f772d000-f7749000 r-xp 00000000 08:05 6062081                            /lib32/ld-2.11.1.so
+f7749000-f774a000 r-xp 0001b000 08:05 6062081                            /lib32/ld-2.11.1.so
+f774a000-f774b000 rwxp 0001c000 08:05 6062081                            /lib32/ld-2.11.1.so
+ffb58000-ffb6d000 rwxp 00000000 00:00 0                                  [stack]
+Aborted
+
+New code aborts cleanly, and still calculates the number of LEBs
+required:
+
+$ bin/mkfs.ubifs -U -r romfs -o tmp/ubifs.img -m 512 -e 15360 -c 39
+Error: max_leb_cnt too low (241 needed)
+$ echo $?
+255
+$ bin/mkfs.ubifs -U -r romfs -o tmp/ubifs.img -m 512 -e 15360 -c 240
+Error: max_leb_cnt too low (241 needed)
+$ bin/mkfs.ubifs -U -r romfs -o tmp/ubifs.img -m 512 -e 15360 -c 241
+$
+
+Signed-off-by: Kevin Cernekee<[email protected]>
+Signed-off-by: Artem Bityutskiy<[email protected]>
+---
+ mkfs.ubifs/mkfs.ubifs.c |   10 +++++-----
+ 1 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/mkfs.ubifs/mkfs.ubifs.c b/mkfs.ubifs/mkfs.ubifs.c
+index eeb5e42..ec38f0e 100644
+--- a/mkfs.ubifs/mkfs.ubifs.c
++++ b/mkfs.ubifs/mkfs.ubifs.c
+@@ -929,9 +929,11 @@ static void set_lprops(int lnum, int offs, int flags)
+ 	dirty = c->leb_size - free - ALIGN(offs, 8);
+ 	dbg_msg(3, "LEB %d free %d dirty %d flags %d", lnum, free, dirty,
+ 		flags);
+-	c->lpt[i].free = free;
+-	c->lpt[i].dirty = dirty;
+-	c->lpt[i].flags = flags;
++	if (i<  c->main_lebs) {
++		c->lpt[i].free = free;
++		c->lpt[i].dirty = dirty;
++		c->lpt[i].flags = flags;
++	}
+ 	c->lst.total_free += free;
+ 	c->lst.total_dirty += dirty;
+ 	if (flags&  LPROPS_INDEX)
+@@ -1943,8 +1945,6 @@ static int finalize_leb_cnt(void)
+ {
+ 	c->leb_cnt = head_lnum;
+ 	if (c->leb_cnt>  c->max_leb_cnt)
+-		/* TODO: in this case it segfaults because buffer overruns - we
+-		 * somewhere allocate smaller buffers - fix */
+ 		return err_msg("max_leb_cnt too low (%d needed)", c->leb_cnt);
+ 	c->main_lebs = c->leb_cnt - c->main_first;
+ 	if (verbose) {
+--
+1.7.2.3
+
recipes/mtd/mtd-utils-native_1.4.1.bb new file +3 -0
new file mode 100644
index 0000000..74ba439
@@ -0,0 +1,3 @@
+require mtd-utils_${PV}.bb
+require mtd-utils-native.inc
+DEPENDS += "util-linux-ng-native"
recipes/mtd/mtd-utils_1.4.1.bb new file +27 -0
new file mode 100644
index 0000000..d67ea5f
@@ -0,0 +1,27 @@
+require mtd-utils.inc
+
+DEPENDS += "util-linux-ng"
+
+PARALLEL_MAKE = ""
+ARM_INSTRUCTION_SET = "arm"
+
+# This is the default package, thus we lock to a specific git version so
+# upstream changes will not break builds.
+
+TAG = "v${PV}"
+
+SRC_URI = "git://git.infradead.org/mtd-utils.git;protocol=git;tag=${TAG} \
+	   file://add-exclusion-to-mkfs-jffs2-git-2.patch \
+	   file://fix_heap_corruption.patch \
+	   file://lzo_1x-git.patch"
+
+S = "${WORKDIR}/git/"
+
+do_configure_prepend() {
+	for i in $(find . -name "Makefile") ; do
+		sed -i -e s:lzo2:lzo:g $i
+	done
+	if [ -e mkfs.ubifs/compr.c ]; then
+		sed -i -e s:lzo/::g mkfs.ubifs/compr.c
+	fi
+}
#14 lore raw
In reply to Tom Rini
Quoted 5 lines · Tom Rini
Quoted 1 line · Eric Bénard

tested with kernel headers 2.6.31& 2.6.37 : both compile fine.

Is there a reason to not switch to 4.5.20, or even newer instead?

I would like to do that but I don't know if 4.5.20 needs patches.

Eric

#4 lore raw

Re: [PATCH 3/3] mtd-utils: add 1.4.1

In reply to Tom Rini

Hi,

Quoted 10 lines · Tom Rini
Quoted 5 lines · Eric Bénard

latest stable version + a fix to mkubifs.

tested to generate ubi rootfs on the host.

Is there a reason we're perpetuating lzo1 for newer stuff rather than switching to lzo2?

lzo1 seems necessary :
compr_lzo.c:29:19: fatal error: lzo1x.h: No such file or directory

Eric

#19 lore raw

PATCH v2 1/1 strace: add patch allowing compilation with kernel headers >= 2.6.32

In reply to Khem Raj

tested with kernel headers 2.6.31 & 2.6.37 : both compile fine.

---
v2 : with the patch this time ;-)

 .../strace/strace-4.5.14/strace-linux-2.6.32.patch |   13 +++++++++++++
 recipes/strace/strace_4.5.14.bb                    |    3 ++-
 2 files changed, 15 insertions(+), 1 deletions(-)
 create mode 100644 recipes/strace/strace-4.5.14/strace-linux-2.6.32.patch
recipes/strace/strace-4.5.14/strace-linux-2.6.32.patch new file +13 -0
new file mode 100644
index 0000000..cb0ffbf
@@ -0,0 +1,13 @@
+diff --git a/configure.ac b/configure.ac
+index 03069c0..7a134bd 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -194,7 +194,7 @@ fi
+ AC_CHECK_FUNCS(sigaction strerror strsignal pread sys_siglist _sys_siglist getdents mctl prctl sendmsg inet_ntop if_indextoname)
+ AC_CHECK_HEADERS([sys/reg.h sys/filio.h sys/acl.h sys/asynch.h sys/door.h stropts.h sys/conf.h sys/stream.h sys/tihdr.h sys/tiuser.h sys/sysconfig.h ioctls.h sys/ioctl.h sys/ptrace.h termio.h linux/ptrace.h asm/reg.h sys/uio.h sys/aio.h  poll.h sys/poll.h sys/vfs.h asm/sysmips.h linux/utsname.h sys/nscsys.h mqueue.h sys/epoll.h libaio.h], [], [])
+ AC_CHECK_HEADERS([linux/icmp.h linux/in6.h linux/netlink.h linux/if_packet.h],
+-                 [], [], [#include <linux/socket.h>])
++                 [], [], [#include <sys/socket.h>])
+ AC_CHECK_HEADERS([asm/sigcontext.h], [], [], [#include <signal.h>])
+ AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include <netinet/in.h>])
+ 
recipes/strace/strace_4.5.14.bb +2 -1
index 33a44ad..395e4ee 100644
@@ -1,7 +1,7 @@
 DESCRIPTION = "strace is a system call tracing tool."
 SECTION = "console/utils"
 LICENSE = "BSD"
-PR = "r9"
+PR = "r10"
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
            file://glibc-2.5.patch \
@@ -13,6 +13,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
            file://strace-arm-no-cachectl.patch \
            file://strace-dont-include-linux-dirent-h.patch \
            file://mips-sigcontext.patch \
+           file://strace-linux-2.6.32.patch \
           "
 
 # The strace-4.5.14-avr32.patch conflicts with some other patches.
Signature · 1 line
1.6.3.3
#5 lore raw

Re: [PATCH 3/3] mtd-utils: add 1.4.1

In reply to Eric Bénard
Quoted 5 lines · Eric Bénard
Quoted 3 lines

Is there a reason we're perpetuating lzo1 for newer stuff rather than switching to lzo2?

lzo1 seems necessary :
compr_lzo.c:29:19: fatal error: lzo1x.h: No such file or directory

mtd-utils build fine here after removing *all* the lzo1 related patches and the do_configure_prepend().

Enrico

#6 lore raw

Re: [PATCH 3/3] mtd-utils: add 1.4.1

Hi Enrico,

Quoted 11 lines · Enrico Scholz
Quoted 5 lines · Eric Bénard
Quoted 3 lines

Is there a reason we're perpetuating lzo1 for newer stuff rather than switching to lzo2?

lzo1 seems necessary :
compr_lzo.c:29:19: fatal error: lzo1x.h: No such file or directory

mtd-utils build fine here after removing *all* the lzo1 related patches and the do_configure_prepend().

you're right, I should have read more carefully the recipe. Updated path follows.

Eric

#7 lore raw

PATCH v2 1/1 mtd-utils: add 1.4.1

* latest stable version + a fix to mkubifs.
* switch to lzo2
* tested to generate ubi rootfs on the host.

---
v2: switch 1.4.1 to lzo2, keep lzo for the older recipes

 .../mtd/mtd-utils-1.4.1/fix_heap_corruption.patch  |   95 ++++++++++++++++++++
 recipes/mtd/mtd-utils-native_1.1.0.bb              |    2 +
 recipes/mtd/mtd-utils-native_1.2.0+git.bb          |    2 +-
 recipes/mtd/mtd-utils-native_1.3.1.bb              |    2 +-
 recipes/mtd/mtd-utils-native_1.4.1.bb              |    3 +
 recipes/mtd/mtd-utils.inc                          |    2 +-
 recipes/mtd/mtd-utils_1.1.0.bb                     |    2 +
 recipes/mtd/mtd-utils_1.2.0+git.bb                 |    2 +-
 recipes/mtd/mtd-utils_1.3.1.bb                     |    2 +-
 recipes/mtd/mtd-utils_1.4.1.bb                     |   18 ++++
 10 files changed, 125 insertions(+), 5 deletions(-)
 create mode 100644 recipes/mtd/mtd-utils-1.4.1/fix_heap_corruption.patch
 create mode 100644 recipes/mtd/mtd-utils-native_1.4.1.bb
 create mode 100644 recipes/mtd/mtd-utils_1.4.1.bb
recipes/mtd/mtd-utils-1.4.1/fix_heap_corruption.patch new file +95 -0
new file mode 100644
index 0000000..5ce3a53
@@ -0,0 +1,95 @@
+From d8f0ae2f26898f652ad3af4536b5d0e4db37714f Mon Sep 17 00:00:00 2001
+From: Kevin Cernekee <[email protected]>
+Date: Wed, 22 Sep 2010 16:01:59 -0700
+Subject: [PATCH] mkfs.ubifs: Fix heap corruption on LEB overrun
+
+If max_leb_cnt (-c option) is set too low, set_lprops() will corrupt
+the heap and may result in a scary looking crash:
+
+$ bin/mkfs.ubifs -U -r romfs -o ubifs.img -m 512 -e 15360 -c 39
+Error: max_leb_cnt too low (241 needed)
+*** glibc detected *** bin/mkfs.ubifs: double free or corruption (!prev): 0x088fe070 ***
+======= Backtrace: =========
+/lib32/libc.so.6(+0x6c231)[0xf75fb231]
+/lib32/libc.so.6(+0x6dab8)[0xf75fcab8]
+/lib32/libc.so.6(cfree+0x6d)[0xf75ffb9d]
+bin/mkfs.ubifs[0x804e801]
+bin/mkfs.ubifs[0x804e94b]
+bin/mkfs.ubifs[0x804e99d]
+/lib32/libc.so.6(__libc_start_main+0xe6)[0xf75a5bd6]
+bin/mkfs.ubifs(__fxstat64+0x55)[0x80491e1]
+======= Memory map: ========
+08048000-0805d000 r-xp 00000000 08:08 10012045                           /work/bin/mkfs.ubifs
+0805d000-0805e000 rwxp 00015000 08:08 10012045                           /work/bin/mkfs.ubifs
+088fe000-08945000 rwxp 00000000 00:00 0                                  [heap]
+f73e1000-f73fe000 r-xp 00000000 08:05 2228842                            /usr/lib32/libgcc_s.so.1
+f73fe000-f73ff000 r-xp 0001c000 08:05 2228842                            /usr/lib32/libgcc_s.so.1
+f73ff000-f7400000 rwxp 0001d000 08:05 2228842                            /usr/lib32/libgcc_s.so.1
+f7400000-f7421000 rwxp 00000000 00:00 0
+f7421000-f7500000 ---p 00000000 00:00 0
+f751c000-f758f000 rwxp 00000000 00:00 0
+f758f000-f76e2000 r-xp 00000000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e2000-f76e3000 ---p 00153000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e3000-f76e5000 r-xp 00153000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e5000-f76e6000 rwxp 00155000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e6000-f76e9000 rwxp 00000000 00:00 0
+f76e9000-f770d000 r-xp 00000000 08:05 426296                             /lib32/libm-2.11.1.so
+f770d000-f770e000 r-xp 00023000 08:05 426296                             /lib32/libm-2.11.1.so
+f770e000-f770f000 rwxp 00024000 08:05 426296                             /lib32/libm-2.11.1.so
+f772a000-f772c000 rwxp 00000000 00:00 0
+f772c000-f772d000 r-xp 00000000 00:00 0                                  [vdso]
+f772d000-f7749000 r-xp 00000000 08:05 6062081                            /lib32/ld-2.11.1.so
+f7749000-f774a000 r-xp 0001b000 08:05 6062081                            /lib32/ld-2.11.1.so
+f774a000-f774b000 rwxp 0001c000 08:05 6062081                            /lib32/ld-2.11.1.so
+ffb58000-ffb6d000 rwxp 00000000 00:00 0                                  [stack]
+Aborted
+
+New code aborts cleanly, and still calculates the number of LEBs
+required:
+
+$ bin/mkfs.ubifs -U -r romfs -o tmp/ubifs.img -m 512 -e 15360 -c 39
+Error: max_leb_cnt too low (241 needed)
+$ echo $?
+255
+$ bin/mkfs.ubifs -U -r romfs -o tmp/ubifs.img -m 512 -e 15360 -c 240
+Error: max_leb_cnt too low (241 needed)
+$ bin/mkfs.ubifs -U -r romfs -o tmp/ubifs.img -m 512 -e 15360 -c 241
+$
+
+Signed-off-by: Kevin Cernekee <[email protected]>
+Signed-off-by: Artem Bityutskiy <[email protected]>
+---
+ mkfs.ubifs/mkfs.ubifs.c |   10 +++++-----
+ 1 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/mkfs.ubifs/mkfs.ubifs.c b/mkfs.ubifs/mkfs.ubifs.c
+index eeb5e42..ec38f0e 100644
+--- a/mkfs.ubifs/mkfs.ubifs.c
++++ b/mkfs.ubifs/mkfs.ubifs.c
+@@ -929,9 +929,11 @@ static void set_lprops(int lnum, int offs, int flags)
+ 	dirty = c->leb_size - free - ALIGN(offs, 8);
+ 	dbg_msg(3, "LEB %d free %d dirty %d flags %d", lnum, free, dirty,
+ 		flags);
+-	c->lpt[i].free = free;
+-	c->lpt[i].dirty = dirty;
+-	c->lpt[i].flags = flags;
++	if (i < c->main_lebs) {
++		c->lpt[i].free = free;
++		c->lpt[i].dirty = dirty;
++		c->lpt[i].flags = flags;
++	}
+ 	c->lst.total_free += free;
+ 	c->lst.total_dirty += dirty;
+ 	if (flags & LPROPS_INDEX)
+@@ -1943,8 +1945,6 @@ static int finalize_leb_cnt(void)
+ {
+ 	c->leb_cnt = head_lnum;
+ 	if (c->leb_cnt > c->max_leb_cnt)
+-		/* TODO: in this case it segfaults because buffer overruns - we
+-		 * somewhere allocate smaller buffers - fix */
+ 		return err_msg("max_leb_cnt too low (%d needed)", c->leb_cnt);
+ 	c->main_lebs = c->leb_cnt - c->main_first;
+ 	if (verbose) {
+-- 
+1.7.2.3
+
recipes/mtd/mtd-utils-native_1.1.0.bb +2 -0
index 6f9d71e..edaeff0 100644
@@ -1,2 +1,4 @@
 require mtd-utils_${PV}.bb
 require mtd-utils-native.inc
+
+DEPENDS += "lzo-native"
recipes/mtd/mtd-utils-native_1.2.0+git.bb +1 -1
index 74ba439..472d743 100644
@@ -1,3 +1,3 @@
 require mtd-utils_${PV}.bb
 require mtd-utils-native.inc
-DEPENDS += "util-linux-ng-native"
+DEPENDS += "util-linux-ng-native lzo-native"
recipes/mtd/mtd-utils-native_1.3.1.bb +1 -1
index 74ba439..472d743 100644
@@ -1,3 +1,3 @@
 require mtd-utils_${PV}.bb
 require mtd-utils-native.inc
-DEPENDS += "util-linux-ng-native"
+DEPENDS += "util-linux-ng-native lzo-native"
recipes/mtd/mtd-utils-native_1.4.1.bb new file +3 -0
new file mode 100644
index 0000000..4208a4b
@@ -0,0 +1,3 @@
+require mtd-utils_${PV}.bb
+require mtd-utils-native.inc
+DEPENDS += "util-linux-ng-native lzo2-native"
recipes/mtd/mtd-utils.inc +1 -1
index 319fd9a..74c4cf0 100644
@@ -1,6 +1,6 @@
 DESCRIPTION = "Tools for managing memory technology devices."
 SECTION = "base"
-DEPENDS = "zlib lzo"
+DEPENDS = "zlib"
 HOMEPAGE = "http://www.linux-mtd.infradead.org/"
 LICENSE = "GPLv2"
 PR = "r0"
recipes/mtd/mtd-utils_1.1.0.bb +2 -0
index 00aee3d..87f3615 100644
@@ -2,6 +2,8 @@ require mtd-utils.inc
 
 PR = "r4"
 
+DEPENDS += "lzo"
+
 SRC_URI += "file://add-exclusion-to-mkfs-jffs2-git.patch \
 	    file://fix-ignoreerrors-git.patch \
 	    file://lzo_1x.patch"
recipes/mtd/mtd-utils_1.2.0+git.bb +1 -1
index 4d73c83..04cf2f2 100644
@@ -1,6 +1,6 @@
 require mtd-utils.inc
 
-DEPENDS += "util-linux-ng"
+DEPENDS += "util-linux-ng lzo"
 PR = "r4"
 
 ARM_INSTRUCTION_SET = "arm"
recipes/mtd/mtd-utils_1.3.1.bb +1 -1
index 75ff7b9..7b9d624 100644
@@ -1,6 +1,6 @@
 require mtd-utils.inc
 
-DEPENDS += "util-linux-ng"
+DEPENDS += "util-linux-ng lzo"
 
 PARALLEL_MAKE = ""
 ARM_INSTRUCTION_SET = "arm"
recipes/mtd/mtd-utils_1.4.1.bb new file +18 -0
new file mode 100644
index 0000000..948fce1
@@ -0,0 +1,18 @@
+require mtd-utils.inc
+
+DEPENDS += "util-linux-ng lzo2"
+
+PARALLEL_MAKE = ""
+ARM_INSTRUCTION_SET = "arm"
+
+# This is the default package, thus we lock to a specific git version so 
+# upstream changes will not break builds.
+
+TAG = "v${PV}"
+
+SRC_URI = "git://git.infradead.org/mtd-utils.git;protocol=git;tag=${TAG} \
+	   file://add-exclusion-to-mkfs-jffs2-git-2.patch \
+	   file://fix_heap_corruption.patch \
+	  "
+
+S = "${WORKDIR}/git/"
Signature · 1 line
1.6.3.3
#15 lore raw
In reply to Eric Bénard
Quoted 7 lines · Eric Bénard
Quoted 5 lines · Tom Rini
Quoted 1 line · Eric Bénard

tested with kernel headers 2.6.31& 2.6.37 : both compile fine.

Is there a reason to not switch to 4.5.20, or even newer instead?

I would like to do that but I don't know if 4.5.20 needs patches.

I haven't tried .37, but it doesn't for .34 (when .14 does). To be clear, I'm suggesting we look at removing the D_P = -1 from .20. My assumption is that since .20 is the latest it probably doesn't need ARM EABI patches (and probably not the SH patches either).

Signature · 2 lines
Tom Rini
Mentor Graphics Corporation
Acked-by on v2 1/1
#8 lore raw

Re: [PATCH v2] mtd-utils: add 1.4.1

In reply to Eric Bénard
Quoted 5 lines · Eric Bénard

* latest stable version + a fix to mkubifs.
* switch to lzo2
* tested to generate ubi rootfs on the host.

Quoted 228 lines

---
v2: switch 1.4.1 to lzo2, keep lzo for the older recipes

  .../mtd/mtd-utils-1.4.1/fix_heap_corruption.patch  |   95 ++++++++++++++++++++
  recipes/mtd/mtd-utils-native_1.1.0.bb              |    2 +
  recipes/mtd/mtd-utils-native_1.2.0+git.bb          |    2 +-
  recipes/mtd/mtd-utils-native_1.3.1.bb              |    2 +-
  recipes/mtd/mtd-utils-native_1.4.1.bb              |    3 +
  recipes/mtd/mtd-utils.inc                          |    2 +-
  recipes/mtd/mtd-utils_1.1.0.bb                     |    2 +
  recipes/mtd/mtd-utils_1.2.0+git.bb                 |    2 +-
  recipes/mtd/mtd-utils_1.3.1.bb                     |    2 +-
  recipes/mtd/mtd-utils_1.4.1.bb                     |   18 ++++
  10 files changed, 125 insertions(+), 5 deletions(-)

create mode 100644 recipes/mtd/mtd-utils-1.4.1/fix_heap_corruption.patch create mode 100644 recipes/mtd/mtd-utils-native_1.4.1.bb create mode 100644 recipes/mtd/mtd-utils_1.4.1.bb

recipes/mtd/mtd-utils-1.4.1/fix_heap_corruption.patch new file +95 -0
new file mode 100644
index 0000000..5ce3a53
@@ -0,0 +1,95 @@
+From d8f0ae2f26898f652ad3af4536b5d0e4db37714f Mon Sep 17 00:00:00 2001
+From: Kevin Cernekee<[email protected]>
+Date: Wed, 22 Sep 2010 16:01:59 -0700
+Subject: [PATCH] mkfs.ubifs: Fix heap corruption on LEB overrun
+
+If max_leb_cnt (-c option) is set too low, set_lprops() will corrupt
+the heap and may result in a scary looking crash:
+
+$ bin/mkfs.ubifs -U -r romfs -o ubifs.img -m 512 -e 15360 -c 39
+Error: max_leb_cnt too low (241 needed)
+*** glibc detected *** bin/mkfs.ubifs: double free or corruption (!prev): 0x088fe070 ***
+======= Backtrace: =========
+/lib32/libc.so.6(+0x6c231)[0xf75fb231]
+/lib32/libc.so.6(+0x6dab8)[0xf75fcab8]
+/lib32/libc.so.6(cfree+0x6d)[0xf75ffb9d]
+bin/mkfs.ubifs[0x804e801]
+bin/mkfs.ubifs[0x804e94b]
+bin/mkfs.ubifs[0x804e99d]
+/lib32/libc.so.6(__libc_start_main+0xe6)[0xf75a5bd6]
+bin/mkfs.ubifs(__fxstat64+0x55)[0x80491e1]
+======= Memory map: ========
+08048000-0805d000 r-xp 00000000 08:08 10012045                           /work/bin/mkfs.ubifs
+0805d000-0805e000 rwxp 00015000 08:08 10012045                           /work/bin/mkfs.ubifs
+088fe000-08945000 rwxp 00000000 00:00 0                                  [heap]
+f73e1000-f73fe000 r-xp 00000000 08:05 2228842                            /usr/lib32/libgcc_s.so.1
+f73fe000-f73ff000 r-xp 0001c000 08:05 2228842                            /usr/lib32/libgcc_s.so.1
+f73ff000-f7400000 rwxp 0001d000 08:05 2228842                            /usr/lib32/libgcc_s.so.1
+f7400000-f7421000 rwxp 00000000 00:00 0
+f7421000-f7500000 ---p 00000000 00:00 0
+f751c000-f758f000 rwxp 00000000 00:00 0
+f758f000-f76e2000 r-xp 00000000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e2000-f76e3000 ---p 00153000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e3000-f76e5000 r-xp 00153000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e5000-f76e6000 rwxp 00155000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e6000-f76e9000 rwxp 00000000 00:00 0
+f76e9000-f770d000 r-xp 00000000 08:05 426296                             /lib32/libm-2.11.1.so
+f770d000-f770e000 r-xp 00023000 08:05 426296                             /lib32/libm-2.11.1.so
+f770e000-f770f000 rwxp 00024000 08:05 426296                             /lib32/libm-2.11.1.so
+f772a000-f772c000 rwxp 00000000 00:00 0
+f772c000-f772d000 r-xp 00000000 00:00 0                                  [vdso]
+f772d000-f7749000 r-xp 00000000 08:05 6062081                            /lib32/ld-2.11.1.so
+f7749000-f774a000 r-xp 0001b000 08:05 6062081                            /lib32/ld-2.11.1.so
+f774a000-f774b000 rwxp 0001c000 08:05 6062081                            /lib32/ld-2.11.1.so
+ffb58000-ffb6d000 rwxp 00000000 00:00 0                                  [stack]
+Aborted
+
+New code aborts cleanly, and still calculates the number of LEBs
+required:
+
+$ bin/mkfs.ubifs -U -r romfs -o tmp/ubifs.img -m 512 -e 15360 -c 39
+Error: max_leb_cnt too low (241 needed)
+$ echo $?
+255
+$ bin/mkfs.ubifs -U -r romfs -o tmp/ubifs.img -m 512 -e 15360 -c 240
+Error: max_leb_cnt too low (241 needed)
+$ bin/mkfs.ubifs -U -r romfs -o tmp/ubifs.img -m 512 -e 15360 -c 241
+$
+
+Signed-off-by: Kevin Cernekee<[email protected]>
+Signed-off-by: Artem Bityutskiy<[email protected]>
+---
+ mkfs.ubifs/mkfs.ubifs.c |   10 +++++-----
+ 1 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/mkfs.ubifs/mkfs.ubifs.c b/mkfs.ubifs/mkfs.ubifs.c
+index eeb5e42..ec38f0e 100644
+--- a/mkfs.ubifs/mkfs.ubifs.c
++++ b/mkfs.ubifs/mkfs.ubifs.c
+@@ -929,9 +929,11 @@ static void set_lprops(int lnum, int offs, int flags)
+ 	dirty = c->leb_size - free - ALIGN(offs, 8);
+ 	dbg_msg(3, "LEB %d free %d dirty %d flags %d", lnum, free, dirty,
+ 		flags);
+-	c->lpt[i].free = free;
+-	c->lpt[i].dirty = dirty;
+-	c->lpt[i].flags = flags;
++	if (i<  c->main_lebs) {
++		c->lpt[i].free = free;
++		c->lpt[i].dirty = dirty;
++		c->lpt[i].flags = flags;
++	}
+ 	c->lst.total_free += free;
+ 	c->lst.total_dirty += dirty;
+ 	if (flags&  LPROPS_INDEX)
+@@ -1943,8 +1945,6 @@ static int finalize_leb_cnt(void)
+ {
+ 	c->leb_cnt = head_lnum;
+ 	if (c->leb_cnt>  c->max_leb_cnt)
+-		/* TODO: in this case it segfaults because buffer overruns - we
+-		 * somewhere allocate smaller buffers - fix */
+ 		return err_msg("max_leb_cnt too low (%d needed)", c->leb_cnt);
+ 	c->main_lebs = c->leb_cnt - c->main_first;
+ 	if (verbose) {
+--
+1.7.2.3
+
recipes/mtd/mtd-utils-native_1.1.0.bb +2 -0
index 6f9d71e..edaeff0 100644
@@ -1,2 +1,4 @@
  require mtd-utils_${PV}.bb
  require mtd-utils-native.inc
+
+DEPENDS += "lzo-native"
recipes/mtd/mtd-utils-native_1.2.0+git.bb +1 -1
index 74ba439..472d743 100644
@@ -1,3 +1,3 @@
  require mtd-utils_${PV}.bb
  require mtd-utils-native.inc
-DEPENDS += "util-linux-ng-native"
+DEPENDS += "util-linux-ng-native lzo-native"
recipes/mtd/mtd-utils-native_1.3.1.bb +1 -1
index 74ba439..472d743 100644
@@ -1,3 +1,3 @@
  require mtd-utils_${PV}.bb
  require mtd-utils-native.inc
-DEPENDS += "util-linux-ng-native"
+DEPENDS += "util-linux-ng-native lzo-native"
recipes/mtd/mtd-utils-native_1.4.1.bb new file +3 -0
new file mode 100644
index 0000000..4208a4b
@@ -0,0 +1,3 @@
+require mtd-utils_${PV}.bb
+require mtd-utils-native.inc
+DEPENDS += "util-linux-ng-native lzo2-native"
recipes/mtd/mtd-utils.inc +1 -1
index 319fd9a..74c4cf0 100644
@@ -1,6 +1,6 @@
  DESCRIPTION = "Tools for managing memory technology devices."
  SECTION = "base"
-DEPENDS = "zlib lzo"
+DEPENDS = "zlib"
  HOMEPAGE = "http://www.linux-mtd.infradead.org/"
  LICENSE = "GPLv2"
  PR = "r0"
recipes/mtd/mtd-utils_1.1.0.bb +2 -0
index 00aee3d..87f3615 100644
@@ -2,6 +2,8 @@ require mtd-utils.inc
 
  PR = "r4"
 
+DEPENDS += "lzo"
+
  SRC_URI += "file://add-exclusion-to-mkfs-jffs2-git.patch \
  	    file://fix-ignoreerrors-git.patch \
  	    file://lzo_1x.patch"
recipes/mtd/mtd-utils_1.2.0+git.bb +1 -1
index 4d73c83..04cf2f2 100644
@@ -1,6 +1,6 @@
  require mtd-utils.inc
 
-DEPENDS += "util-linux-ng"
+DEPENDS += "util-linux-ng lzo"
  PR = "r4"
 
  ARM_INSTRUCTION_SET = "arm"
recipes/mtd/mtd-utils_1.3.1.bb +1 -1
index 75ff7b9..7b9d624 100644
@@ -1,6 +1,6 @@
  require mtd-utils.inc
 
-DEPENDS += "util-linux-ng"
+DEPENDS += "util-linux-ng lzo"
 
  PARALLEL_MAKE = ""
  ARM_INSTRUCTION_SET = "arm"
recipes/mtd/mtd-utils_1.4.1.bb new file +18 -0
new file mode 100644
index 0000000..948fce1
@@ -0,0 +1,18 @@
+require mtd-utils.inc
+
+DEPENDS += "util-linux-ng lzo2"
+
+PARALLEL_MAKE = ""
+ARM_INSTRUCTION_SET = "arm"
+
+# This is the default package, thus we lock to a specific git version so
+# upstream changes will not break builds.
+
+TAG = "v${PV}"
+
+SRC_URI = "git://git.infradead.org/mtd-utils.git;protocol=git;tag=${TAG} \
+	   file://add-exclusion-to-mkfs-jffs2-git-2.patch \
+	   file://fix_heap_corruption.patch \
+	  "
+
+S = "${WORKDIR}/git/"
Signature · 2 lines
Tom Rini
Mentor Graphics Corporation
#20 lore raw
In reply to Eric Bénard
Quoted 3 lines · Eric Bénard

tested with kernel headers 2.6.31& 2.6.37 : both compile fine.

I still say (and on top of my last, just sent email) that we basically only need strace 4.5.14 for avr32 and everyone else should be fine with 4.5.20.

Quoted 48 lines

---
v2 : with the patch this time ;-)

  .../strace/strace-4.5.14/strace-linux-2.6.32.patch |   13 +++++++++++++
  recipes/strace/strace_4.5.14.bb                    |    3 ++-
  2 files changed, 15 insertions(+), 1 deletions(-)

create mode 100644 recipes/strace/strace-4.5.14/strace-linux-2.6.32.patch

recipes/strace/strace-4.5.14/strace-linux-2.6.32.patch new file +13 -0
new file mode 100644
index 0000000..cb0ffbf
@@ -0,0 +1,13 @@
+diff --git a/configure.ac b/configure.ac
+index 03069c0..7a134bd 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -194,7 +194,7 @@ fi
+ AC_CHECK_FUNCS(sigaction strerror strsignal pread sys_siglist _sys_siglist getdents mctl prctl sendmsg inet_ntop if_indextoname)
+ AC_CHECK_HEADERS([sys/reg.h sys/filio.h sys/acl.h sys/asynch.h sys/door.h stropts.h sys/conf.h sys/stream.h sys/tihdr.h sys/tiuser.h sys/sysconfig.h ioctls.h sys/ioctl.h sys/ptrace.h termio.h linux/ptrace.h asm/reg.h sys/uio.h sys/aio.h  poll.h sys/poll.h sys/vfs.h asm/sysmips.h linux/utsname.h sys/nscsys.h mqueue.h sys/epoll.h libaio.h], [], [])
+ AC_CHECK_HEADERS([linux/icmp.h linux/in6.h linux/netlink.h linux/if_packet.h],
+-                 [], [], [#include<linux/socket.h>])
++                 [], [], [#include<sys/socket.h>])
+ AC_CHECK_HEADERS([asm/sigcontext.h], [], [], [#include<signal.h>])
+ AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include<netinet/in.h>])
+
recipes/strace/strace_4.5.14.bb +2 -1
index 33a44ad..395e4ee 100644
@@ -1,7 +1,7 @@
  DESCRIPTION = "strace is a system call tracing tool."
  SECTION = "console/utils"
  LICENSE = "BSD"
-PR = "r9"
+PR = "r10"
 
  SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
             file://glibc-2.5.patch \
@@ -13,6 +13,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
             file://strace-arm-no-cachectl.patch \
             file://strace-dont-include-linux-dirent-h.patch \
             file://mips-sigcontext.patch \
+           file://strace-linux-2.6.32.patch \
            "
 
  # The strace-4.5.14-avr32.patch conflicts with some other patches.
Signature · 2 lines
Tom Rini
Mentor Graphics Corporation
#16 lore raw
In reply to Tom Rini
Quoted 5 lines · Tom Rini
Quoted 4 lines · Eric Bénard
Quoted 3 lines · Tom Rini
Quoted 1 line · Eric Bénard

tested with kernel headers 2.6.31& 2.6.37 : both compile fine.

Quoted 9 lines
Quoted 3 lines
Quoted 2 lines

Is there a reason to not switch to 4.5.20, or even newer instead?

I would like to do that but I don't know if 4.5.20 needs patches.

I haven't tried .37, but it doesn't for .34 (when .14 does). To be clear, I'm suggesting we look at removing the D_P = -1 from .20. My assumption is that since .20 is the latest it probably doesn't need ARM EABI patches (and probably not the SH patches either).

OK lets go

Eric

#21 lore raw
In reply to Tom Rini
Quoted 8 lines · Tom Rini
Quoted 3 lines · Eric Bénard

tested with kernel headers 2.6.31& 2.6.37 : both compile fine.

I still say (and on top of my last, just sent email) that we basically only need strace 4.5.14 for avr32 and everyone else should be fine with 4.5.20.

this patch was sent before reading your email :-)

Eric

#22 lore raw

PATCH 1/1 strace 4.5.20: stable since 04/14/2010 so remove DP=-1

In reply to Tom Rini
---
 recipes/strace/strace_4.5.20.bb |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
recipes/strace/strace_4.5.20.bb +1 -5
index 89c5fd3..3de5469 100644
@@ -1,11 +1,7 @@
 DESCRIPTION = "strace is a system call tracing tool."
 SECTION = "console/utils"
 LICENSE = "BSD"
-PR = "r1"
-
-DEFAULT_PREFERENCE = "-1"
-DEFAULT_PREFERENCE_mips = "1"
-DEFAULT_PREFERENCE_mipsel = "1"
+PR = "r2"
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
           file://mips-nolargefile.patch \
Signature · 1 line
1.6.3.3
#23 lore raw

Re: [PATCH] strace 4.5.20: stable since 04/14/2010 so remove DP=-1

Quoted 12 lines · Eric Bénard
---
  recipes/strace/strace_4.5.20.bb |    6 +-----
  1 files changed, 1 insertions(+), 5 deletions(-)
recipes/strace/strace_4.5.20.bb +0 -0
index 89c5fd3..3de5469 100644
@@ -1,11 +1,7 @@
  DESCRIPTION = "strace is a system call tracing tool."
  SECTION = "console/utils"

recipes/strace/strace_4.5.20.bb line 7

Quoted 10 lines
recipes/strace/strace_4.5.20.bb +1 -5
  LICENSE = "BSD"
-PR = "r1"
-
-DEFAULT_PREFERENCE = "-1"
-DEFAULT_PREFERENCE_mips = "1"
-DEFAULT_PREFERENCE_mipsel = "1"
+PR = "r2"
 
  SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
            file://mips-nolargefile.patch \

Shouldn't need to bump PR, it'll just show up as now available to distros that didn't pin to it already.

Signature · 2 lines
Tom Rini
Mentor Graphics Corporation
#24 lore raw

PATCH v2 1/1 strace 4.5.20: stable since 04/14/2010 so remove DP=-1

---
v2: don't increase PR

 recipes/strace/strace_4.5.20.bb |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
recipes/strace/strace_4.5.20.bb +0 -4
index 89c5fd3..6146554 100644
@@ -3,10 +3,6 @@ SECTION = "console/utils"
 LICENSE = "BSD"
 PR = "r1"
 
-DEFAULT_PREFERENCE = "-1"
-DEFAULT_PREFERENCE_mips = "1"
-DEFAULT_PREFERENCE_mipsel = "1"
-
 SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
           file://mips-nolargefile.patch \
           "
Signature · 1 line
1.6.3.3
Acked-by on v2 1/1
#25 lore raw

Re: [PATCH v2] strace 4.5.20: stable since 04/14/2010 so remove DP=-1

Quoted 1 line · Eric Bénard
Quoted 21 lines

---
v2: don't increase PR

  recipes/strace/strace_4.5.20.bb |    4 ----
  1 files changed, 0 insertions(+), 4 deletions(-)
recipes/strace/strace_4.5.20.bb +0 -4
index 89c5fd3..6146554 100644
@@ -3,10 +3,6 @@ SECTION = "console/utils"
  LICENSE = "BSD"
  PR = "r1"
 
-DEFAULT_PREFERENCE = "-1"
-DEFAULT_PREFERENCE_mips = "1"
-DEFAULT_PREFERENCE_mipsel = "1"
-
  SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
            file://mips-nolargefile.patch \
            "
Signature · 2 lines
Tom Rini
Mentor Graphics Corporation
Acked-by on v2 1/1
#28 lore raw
In reply to Eric Bénard
Quoted 5 lines · Eric Bénard

tested with kernel headers 2.6.31& 2.6.37 : both compile fine.

---
v2 : with the patch this time ;-)

Quoted 46 lines
  .../strace/strace-4.5.14/strace-linux-2.6.32.patch |   13 +++++++++++++
  recipes/strace/strace_4.5.14.bb                    |    3 ++-
  2 files changed, 15 insertions(+), 1 deletions(-)

create mode 100644 recipes/strace/strace-4.5.14/strace-linux-2.6.32.patch

recipes/strace/strace-4.5.14/strace-linux-2.6.32.patch new file +13 -0
new file mode 100644
index 0000000..cb0ffbf
@@ -0,0 +1,13 @@
+diff --git a/configure.ac b/configure.ac
+index 03069c0..7a134bd 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -194,7 +194,7 @@ fi
+ AC_CHECK_FUNCS(sigaction strerror strsignal pread sys_siglist _sys_siglist getdents mctl prctl sendmsg inet_ntop if_indextoname)
+ AC_CHECK_HEADERS([sys/reg.h sys/filio.h sys/acl.h sys/asynch.h sys/door.h stropts.h sys/conf.h sys/stream.h sys/tihdr.h sys/tiuser.h sys/sysconfig.h ioctls.h sys/ioctl.h sys/ptrace.h termio.h linux/ptrace.h asm/reg.h sys/uio.h sys/aio.h  poll.h sys/poll.h sys/vfs.h asm/sysmips.h linux/utsname.h sys/nscsys.h mqueue.h sys/epoll.h libaio.h], [], [])
+ AC_CHECK_HEADERS([linux/icmp.h linux/in6.h linux/netlink.h linux/if_packet.h],
+-                 [], [], [#include<linux/socket.h>])
++                 [], [], [#include<sys/socket.h>])
+ AC_CHECK_HEADERS([asm/sigcontext.h], [], [], [#include<signal.h>])
+ AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include<netinet/in.h>])
+
recipes/strace/strace_4.5.14.bb +2 -1
index 33a44ad..395e4ee 100644
@@ -1,7 +1,7 @@
  DESCRIPTION = "strace is a system call tracing tool."
  SECTION = "console/utils"
  LICENSE = "BSD"
-PR = "r9"
+PR = "r10"
 
  SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
             file://glibc-2.5.patch \
@@ -13,6 +13,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
             file://strace-arm-no-cachectl.patch \
             file://strace-dont-include-linux-dirent-h.patch \
             file://mips-sigcontext.patch \
+           file://strace-linux-2.6.32.patch \
            "
 
  # The strace-4.5.14-avr32.patch conflicts with some other patches.
Acked-by on v2 1/1
#9 lore raw

Re: [PATCH v2] mtd-utils: add 1.4.1

In reply to Eric Bénard
Quoted 5 lines · Eric Bénard

* latest stable version + a fix to mkubifs.
* switch to lzo2
* tested to generate ubi rootfs on the host.

Quoted 228 lines

---
v2: switch 1.4.1 to lzo2, keep lzo for the older recipes

  .../mtd/mtd-utils-1.4.1/fix_heap_corruption.patch  |   95 ++++++++++++++++++++
  recipes/mtd/mtd-utils-native_1.1.0.bb              |    2 +
  recipes/mtd/mtd-utils-native_1.2.0+git.bb          |    2 +-
  recipes/mtd/mtd-utils-native_1.3.1.bb              |    2 +-
  recipes/mtd/mtd-utils-native_1.4.1.bb              |    3 +
  recipes/mtd/mtd-utils.inc                          |    2 +-
  recipes/mtd/mtd-utils_1.1.0.bb                     |    2 +
  recipes/mtd/mtd-utils_1.2.0+git.bb                 |    2 +-
  recipes/mtd/mtd-utils_1.3.1.bb                     |    2 +-
  recipes/mtd/mtd-utils_1.4.1.bb                     |   18 ++++
  10 files changed, 125 insertions(+), 5 deletions(-)

create mode 100644 recipes/mtd/mtd-utils-1.4.1/fix_heap_corruption.patch create mode 100644 recipes/mtd/mtd-utils-native_1.4.1.bb create mode 100644 recipes/mtd/mtd-utils_1.4.1.bb

recipes/mtd/mtd-utils-1.4.1/fix_heap_corruption.patch new file +95 -0
new file mode 100644
index 0000000..5ce3a53
@@ -0,0 +1,95 @@
+From d8f0ae2f26898f652ad3af4536b5d0e4db37714f Mon Sep 17 00:00:00 2001
+From: Kevin Cernekee<[email protected]>
+Date: Wed, 22 Sep 2010 16:01:59 -0700
+Subject: [PATCH] mkfs.ubifs: Fix heap corruption on LEB overrun
+
+If max_leb_cnt (-c option) is set too low, set_lprops() will corrupt
+the heap and may result in a scary looking crash:
+
+$ bin/mkfs.ubifs -U -r romfs -o ubifs.img -m 512 -e 15360 -c 39
+Error: max_leb_cnt too low (241 needed)
+*** glibc detected *** bin/mkfs.ubifs: double free or corruption (!prev): 0x088fe070 ***
+======= Backtrace: =========
+/lib32/libc.so.6(+0x6c231)[0xf75fb231]
+/lib32/libc.so.6(+0x6dab8)[0xf75fcab8]
+/lib32/libc.so.6(cfree+0x6d)[0xf75ffb9d]
+bin/mkfs.ubifs[0x804e801]
+bin/mkfs.ubifs[0x804e94b]
+bin/mkfs.ubifs[0x804e99d]
+/lib32/libc.so.6(__libc_start_main+0xe6)[0xf75a5bd6]
+bin/mkfs.ubifs(__fxstat64+0x55)[0x80491e1]
+======= Memory map: ========
+08048000-0805d000 r-xp 00000000 08:08 10012045                           /work/bin/mkfs.ubifs
+0805d000-0805e000 rwxp 00015000 08:08 10012045                           /work/bin/mkfs.ubifs
+088fe000-08945000 rwxp 00000000 00:00 0                                  [heap]
+f73e1000-f73fe000 r-xp 00000000 08:05 2228842                            /usr/lib32/libgcc_s.so.1
+f73fe000-f73ff000 r-xp 0001c000 08:05 2228842                            /usr/lib32/libgcc_s.so.1
+f73ff000-f7400000 rwxp 0001d000 08:05 2228842                            /usr/lib32/libgcc_s.so.1
+f7400000-f7421000 rwxp 00000000 00:00 0
+f7421000-f7500000 ---p 00000000 00:00 0
+f751c000-f758f000 rwxp 00000000 00:00 0
+f758f000-f76e2000 r-xp 00000000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e2000-f76e3000 ---p 00153000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e3000-f76e5000 r-xp 00153000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e5000-f76e6000 rwxp 00155000 08:05 426288                             /lib32/libc-2.11.1.so
+f76e6000-f76e9000 rwxp 00000000 00:00 0
+f76e9000-f770d000 r-xp 00000000 08:05 426296                             /lib32/libm-2.11.1.so
+f770d000-f770e000 r-xp 00023000 08:05 426296                             /lib32/libm-2.11.1.so
+f770e000-f770f000 rwxp 00024000 08:05 426296                             /lib32/libm-2.11.1.so
+f772a000-f772c000 rwxp 00000000 00:00 0
+f772c000-f772d000 r-xp 00000000 00:00 0                                  [vdso]
+f772d000-f7749000 r-xp 00000000 08:05 6062081                            /lib32/ld-2.11.1.so
+f7749000-f774a000 r-xp 0001b000 08:05 6062081                            /lib32/ld-2.11.1.so
+f774a000-f774b000 rwxp 0001c000 08:05 6062081                            /lib32/ld-2.11.1.so
+ffb58000-ffb6d000 rwxp 00000000 00:00 0                                  [stack]
+Aborted
+
+New code aborts cleanly, and still calculates the number of LEBs
+required:
+
+$ bin/mkfs.ubifs -U -r romfs -o tmp/ubifs.img -m 512 -e 15360 -c 39
+Error: max_leb_cnt too low (241 needed)
+$ echo $?
+255
+$ bin/mkfs.ubifs -U -r romfs -o tmp/ubifs.img -m 512 -e 15360 -c 240
+Error: max_leb_cnt too low (241 needed)
+$ bin/mkfs.ubifs -U -r romfs -o tmp/ubifs.img -m 512 -e 15360 -c 241
+$
+
+Signed-off-by: Kevin Cernekee<[email protected]>
+Signed-off-by: Artem Bityutskiy<[email protected]>
+---
+ mkfs.ubifs/mkfs.ubifs.c |   10 +++++-----
+ 1 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/mkfs.ubifs/mkfs.ubifs.c b/mkfs.ubifs/mkfs.ubifs.c
+index eeb5e42..ec38f0e 100644
+--- a/mkfs.ubifs/mkfs.ubifs.c
++++ b/mkfs.ubifs/mkfs.ubifs.c
+@@ -929,9 +929,11 @@ static void set_lprops(int lnum, int offs, int flags)
+ 	dirty = c->leb_size - free - ALIGN(offs, 8);
+ 	dbg_msg(3, "LEB %d free %d dirty %d flags %d", lnum, free, dirty,
+ 		flags);
+-	c->lpt[i].free = free;
+-	c->lpt[i].dirty = dirty;
+-	c->lpt[i].flags = flags;
++	if (i<  c->main_lebs) {
++		c->lpt[i].free = free;
++		c->lpt[i].dirty = dirty;
++		c->lpt[i].flags = flags;
++	}
+ 	c->lst.total_free += free;
+ 	c->lst.total_dirty += dirty;
+ 	if (flags&  LPROPS_INDEX)
+@@ -1943,8 +1945,6 @@ static int finalize_leb_cnt(void)
+ {
+ 	c->leb_cnt = head_lnum;
+ 	if (c->leb_cnt>  c->max_leb_cnt)
+-		/* TODO: in this case it segfaults because buffer overruns - we
+-		 * somewhere allocate smaller buffers - fix */
+ 		return err_msg("max_leb_cnt too low (%d needed)", c->leb_cnt);
+ 	c->main_lebs = c->leb_cnt - c->main_first;
+ 	if (verbose) {
+--
+1.7.2.3
+
recipes/mtd/mtd-utils-native_1.1.0.bb +2 -0
index 6f9d71e..edaeff0 100644
@@ -1,2 +1,4 @@
  require mtd-utils_${PV}.bb
  require mtd-utils-native.inc
+
+DEPENDS += "lzo-native"
recipes/mtd/mtd-utils-native_1.2.0+git.bb +1 -1
index 74ba439..472d743 100644
@@ -1,3 +1,3 @@
  require mtd-utils_${PV}.bb
  require mtd-utils-native.inc
-DEPENDS += "util-linux-ng-native"
+DEPENDS += "util-linux-ng-native lzo-native"
recipes/mtd/mtd-utils-native_1.3.1.bb +1 -1
index 74ba439..472d743 100644
@@ -1,3 +1,3 @@
  require mtd-utils_${PV}.bb
  require mtd-utils-native.inc
-DEPENDS += "util-linux-ng-native"
+DEPENDS += "util-linux-ng-native lzo-native"
recipes/mtd/mtd-utils-native_1.4.1.bb new file +3 -0
new file mode 100644
index 0000000..4208a4b
@@ -0,0 +1,3 @@
+require mtd-utils_${PV}.bb
+require mtd-utils-native.inc
+DEPENDS += "util-linux-ng-native lzo2-native"
recipes/mtd/mtd-utils.inc +1 -1
index 319fd9a..74c4cf0 100644
@@ -1,6 +1,6 @@
  DESCRIPTION = "Tools for managing memory technology devices."
  SECTION = "base"
-DEPENDS = "zlib lzo"
+DEPENDS = "zlib"
  HOMEPAGE = "http://www.linux-mtd.infradead.org/"
  LICENSE = "GPLv2"
  PR = "r0"
recipes/mtd/mtd-utils_1.1.0.bb +2 -0
index 00aee3d..87f3615 100644
@@ -2,6 +2,8 @@ require mtd-utils.inc
 
  PR = "r4"
 
+DEPENDS += "lzo"
+
  SRC_URI += "file://add-exclusion-to-mkfs-jffs2-git.patch \
  	    file://fix-ignoreerrors-git.patch \
  	    file://lzo_1x.patch"
recipes/mtd/mtd-utils_1.2.0+git.bb +1 -1
index 4d73c83..04cf2f2 100644
@@ -1,6 +1,6 @@
  require mtd-utils.inc
 
-DEPENDS += "util-linux-ng"
+DEPENDS += "util-linux-ng lzo"
  PR = "r4"
 
  ARM_INSTRUCTION_SET = "arm"
recipes/mtd/mtd-utils_1.3.1.bb +1 -1
index 75ff7b9..7b9d624 100644
@@ -1,6 +1,6 @@
  require mtd-utils.inc
 
-DEPENDS += "util-linux-ng"
+DEPENDS += "util-linux-ng lzo"
 
  PARALLEL_MAKE = ""
  ARM_INSTRUCTION_SET = "arm"
recipes/mtd/mtd-utils_1.4.1.bb new file +18 -0
new file mode 100644
index 0000000..948fce1
@@ -0,0 +1,18 @@
+require mtd-utils.inc
+
+DEPENDS += "util-linux-ng lzo2"
+
+PARALLEL_MAKE = ""
+ARM_INSTRUCTION_SET = "arm"
+
+# This is the default package, thus we lock to a specific git version so
+# upstream changes will not break builds.
+
+TAG = "v${PV}"
+
+SRC_URI = "git://git.infradead.org/mtd-utils.git;protocol=git;tag=${TAG} \
+	   file://add-exclusion-to-mkfs-jffs2-git-2.patch \
+	   file://fix_heap_corruption.patch \
+	  "
+
+S = "${WORKDIR}/git/"
#27 lore raw
In reply to Tom Rini
Quoted 8 lines · Tom Rini
Quoted 3 lines · Eric Bénard

tested with kernel headers 2.6.31& 2.6.37 : both compile fine.

I still say (and on top of my last, just sent email) that we basically only need strace 4.5.14 for avr32 and everyone else should be fine with 4.5.20.

OK then just keep those two versions around.

Quoted 62 lines
Quoted 60 lines

---
v2 : with the patch this time ;-)

.../strace/strace-4.5.14/strace-linux-2.6.32.patch | 13 +++++++++++++ recipes/strace/strace_4.5.14.bb | 3 ++-

2 files changed, 15 insertions(+), 1 deletions(-)

create mode 100644 recipes/strace/strace-4.5.14/strace-linux-2.6.32.patch

recipes/strace/strace-4.5.14/strace-linux-2.6.32.patch new file +6 -0
new file mode 100644
index 0000000..cb0ffbf
@@ -0,0 +1,13 @@
+diff --git a/configure.ac b/configure.ac
+index 03069c0..7a134bd 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -194,7 +194,7 @@ fi
+ AC_CHECK_FUNCS(sigaction strerror strsignal pread sys_siglist

_sys_siglist getdents mctl prctl sendmsg inet_ntop if_indextoname)
+ AC_CHECK_HEADERS([sys/reg.h sys/filio.h sys/acl.h sys/asynch.h sys/door.h stropts.h sys/conf.h sys/stream.h sys/tihdr.h sys/tiuser.h sys/sysconfig.h ioctls.h sys/ioctl.h sys/ptrace.h termio.h linux/ptrace.h asm/reg.h sys/uio.h sys/aio.h poll.h sys/poll.h sys/vfs.h asm/sysmips.h linux/utsname.h sys/nscsys.h mqueue.h sys/epoll.h libaio.h], [], [])
+ AC_CHECK_HEADERS([linux/icmp.h linux/in6.h linux/netlink.h linux/if_packet.h],
+- [], [], [#include<linux/socket.h>])
++ [], [], [#include<sys/socket.h>])
+ AC_CHECK_HEADERS([asm/sigcontext.h], [], [], [#include<signal.h>])
+ AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include<netinet/in.h>])

recipes/strace/strace-4.5.14/strace-linux-2.6.32.patch new file +1 -0
+
recipes/strace/strace_4.5.14.bb +0 -0
index 33a44ad..395e4ee 100644
@@ -1,7 +1,7 @@

DESCRIPTION = "strace is a system call tracing tool." SECTION = "console/utils"
LICENSE = "BSD"

recipes/strace/strace_4.5.14.bb +1 -1
-PR = "r9"
+PR = "r10"

SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
file://glibc-2.5.patch \

recipes/strace/strace_4.5.14.bb +1 -0
@@ -13,6 +13,7 @@ SRC_URI =
 "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
 file://strace-arm-no-cachectl.patch \
 file://strace-dont-include-linux-dirent-h.patch \
 file://mips-sigcontext.patch \
+ file://strace-linux-2.6.32.patch \

"

# The strace-4.5.14-avr32.patch conflicts with some other patches.

Acked-by on v2 1/1
#26 lore raw

Re: [PATCH v2] strace 4.5.20: stable since 04/14/2010 so remove DP=-1

In reply to Eric Bénard
Quoted 3 lines · Eric Bénard

---
v2: don't increase PR

I hope its build tested on some arches which were not using it

Quoted 19 lines
  recipes/strace/strace_4.5.20.bb |    4 ----
  1 files changed, 0 insertions(+), 4 deletions(-)
recipes/strace/strace_4.5.20.bb +0 -4
index 89c5fd3..6146554 100644
@@ -3,10 +3,6 @@ SECTION = "console/utils"
  LICENSE = "BSD"
  PR = "r1"
 
-DEFAULT_PREFERENCE = "-1"
-DEFAULT_PREFERENCE_mips = "1"
-DEFAULT_PREFERENCE_mipsel = "1"
-
  SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.bz2 \
            file://mips-nolargefile.patch \
            "
Acked-by
#10 lore raw

Re: [PATCH v2] mtd-utils: add 1.4.1

In reply to Khem Raj
Quoted 12 lines · Khem Raj
Quoted 6 lines · Eric Bénard

* latest stable version + a fix to mkubifs.
* switch to lzo2
* tested to generate ubi rootfs on the host.

Quoted 2 lines

---
v2: switch 1.4.1 to lzo2, keep lzo for the older recipes

nice, finally no segfaults in dmesg while building shr-images for gta01 with small nand :)