Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH V4 0/4] Update connman to v1.3, fix dependencies and runtime
@ 2012-07-17 17:06 Andrei Gherzan
  2012-07-17 17:06 ` [PATCH V4 1/4] connman: Update to version 1.3 Andrei Gherzan
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Andrei Gherzan @ 2012-07-17 17:06 UTC (permalink / raw)
  To: openembedded-core; +Cc: Andrei Gherzan

Changes from V3: Messed up my patches. As well, added Ross Burton's patch:
[OE-core] [PATCH 2/2] connman: fix crashes on startup on PPC/MIPS

Update connman to v1.3.
Fix dependencies needed for tests.
Add patches to fix runtime segfault on mips and ppc architecture.

Machine tested: qemux86 / qemumips

Tests done on connman-gnome
        OnlineMode / OfflineMode
        Enable / Disable Wired Networks
        Set manual IP configuration

Tests on connman v.1.3
        addr-test
        iptables-test
        polkit-test
        get-global-timeservers
        get-proxy-autoconfig
        get-services
        get-state
        list-services
        show-introspection
        test-clock
        test-connman
        test-counter
        test-manager
        test-session
The following changes since commit 90ad663909c0c8a405b22a510c9f957007d02669:

  upstream_tracking: update boost (2012-07-09 17:21:38 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib ag/connman1.3
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ag/connman1.3

Andrei Gherzan (3):
  connman: Update to version 1.3
  connman.inc: Add missing dependencies needed by some tests
  connman: Add patches to fix connman on fs with no d_type support

Ross Burton (1):
  connman: fix crashes on startup on PPC/MIPS

 meta/recipes-connectivity/connman/connman.inc      |    4 +-
 ...ck-that-the-string-isn-t-empty-before-spl.patch |   37 +++++++++++++
 ...If-there-is-no-d_type-support-use-fstatat.patch |   57 ++++++++++++++++++++
 ...If-there-is-no-d_type-support-use-fstatat.patch |   45 ++++++++++++++++
 .../connman/{connman_1.0.bb => connman_1.3.bb}     |   11 ++--
 5 files changed, 148 insertions(+), 6 deletions(-)
 create mode 100644 meta/recipes-connectivity/connman/connman/0001-storage-check-that-the-string-isn-t-empty-before-spl.patch
 create mode 100644 meta/recipes-connectivity/connman/connman/0001-timezone.c-If-there-is-no-d_type-support-use-fstatat.patch
 create mode 100644 meta/recipes-connectivity/connman/connman/0002-storage.c-If-there-is-no-d_type-support-use-fstatat.patch
 rename meta/recipes-connectivity/connman/{connman_1.0.bb => connman_1.3.bb} (41%)

-- 
1.7.9.5




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH V4 1/4] connman: Update to version 1.3
  2012-07-17 17:06 [PATCH V4 0/4] Update connman to v1.3, fix dependencies and runtime Andrei Gherzan
@ 2012-07-17 17:06 ` Andrei Gherzan
  2012-07-17 17:06 ` [PATCH V4 2/4] connman.inc: Add missing dependencies needed by some tests Andrei Gherzan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Andrei Gherzan @ 2012-07-17 17:06 UTC (permalink / raw)
  To: openembedded-core

From: Andrei Gherzan <andrei.gherzan@windriver.com>

Signed-off-by: Andrei Gherzan <andrei.gherzan@windriver.com>
---
 .../connman/{connman_1.0.bb => connman_1.3.bb}     |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
 rename meta/recipes-connectivity/connman/{connman_1.0.bb => connman_1.3.bb} (82%)

diff --git a/meta/recipes-connectivity/connman/connman_1.0.bb b/meta/recipes-connectivity/connman/connman_1.3.bb
similarity index 82%
rename from meta/recipes-connectivity/connman/connman_1.0.bb
rename to meta/recipes-connectivity/connman/connman_1.3.bb
index 926d22e..1e3d138 100644
--- a/meta/recipes-connectivity/connman/connman_1.0.bb
+++ b/meta/recipes-connectivity/connman/connman_1.3.bb
@@ -1,7 +1,7 @@
 require connman.inc
 
-# 1.0 tag
-SRCREV = "6d6f312fb2b751b4cf7037f2a526c7785364732f"
+# 1.3 tag
+SRCREV = "3c0fa84091524c7cd6237744f2088ffee2f1d5ad"
 SRC_URI  = "git://git.kernel.org/pub/scm/network/connman/connman.git \
             file://0001-plugin.h-Change-visibility-to-default-for-debug-symb.patch \
             file://add_xuser_dbus_permission.patch \
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH V4 2/4] connman.inc: Add missing dependencies needed by some tests
  2012-07-17 17:06 [PATCH V4 0/4] Update connman to v1.3, fix dependencies and runtime Andrei Gherzan
  2012-07-17 17:06 ` [PATCH V4 1/4] connman: Update to version 1.3 Andrei Gherzan
@ 2012-07-17 17:06 ` Andrei Gherzan
  2012-07-17 17:06 ` [PATCH V4 3/4] connman: Add patches to fix connman on fs with no d_type support Andrei Gherzan
  2012-07-17 17:06 ` [PATCH V4 4/4] connman: fix crashes on startup on PPC/MIPS Andrei Gherzan
  3 siblings, 0 replies; 7+ messages in thread
From: Andrei Gherzan @ 2012-07-17 17:06 UTC (permalink / raw)
  To: openembedded-core

From: Andrei Gherzan <andrei.gherzan@windriver.com>

Some tests need:
* gobject and optparse module (ex: test-session)
* subprocess and fnctl module (ex: backtrace)
* urllib module (ex: get-proxy-autoconfig)

Signed-off-by: Andrei Gherzan <andrei.gherzan@windriver.com>
---
 meta/recipes-connectivity/connman/connman.inc |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-connectivity/connman/connman.inc b/meta/recipes-connectivity/connman/connman.inc
index 12378e9..58cac0b 100644
--- a/meta/recipes-connectivity/connman/connman.inc
+++ b/meta/recipes-connectivity/connman/connman.inc
@@ -20,7 +20,7 @@ DEPENDS  = "dbus glib-2.0 ppp iptables gnutls \
             ${@base_contains('DISTRO_FEATURES', '3g','ofono', '', d)} \
             "
 
-INC_PR = "r11"
+INC_PR = "r12"
 
 TIST = "--enable-tist"
 TIST_powerpc = ""
@@ -113,7 +113,7 @@ PACKAGES =+ "${PN}-tools ${PN}-tests"
 FILES_${PN}-tools = "${bindir}/wispr"
 
 FILES_${PN}-tests = "${bindir}/*-test ${libdir}/${BPN}/test/*"
-RDEPENDS_${PN}-tests = "python-dbus"
+RDEPENDS_${PN}-tests = "python-dbus python-pygobject python-textutils python-subprocess python-fcntl python-netclient"
 
 FILES_${PN} = "${bindir}/* ${sbindir}/* ${libexecdir}/* ${libdir}/lib*.so.* \
             ${libdir}/connman/plugins \
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH V4 3/4] connman: Add patches to fix connman on fs with no d_type support
  2012-07-17 17:06 [PATCH V4 0/4] Update connman to v1.3, fix dependencies and runtime Andrei Gherzan
  2012-07-17 17:06 ` [PATCH V4 1/4] connman: Update to version 1.3 Andrei Gherzan
  2012-07-17 17:06 ` [PATCH V4 2/4] connman.inc: Add missing dependencies needed by some tests Andrei Gherzan
@ 2012-07-17 17:06 ` Andrei Gherzan
  2012-07-17 17:44   ` Saul Wold
  2012-07-17 17:06 ` [PATCH V4 4/4] connman: fix crashes on startup on PPC/MIPS Andrei Gherzan
  3 siblings, 1 reply; 7+ messages in thread
From: Andrei Gherzan @ 2012-07-17 17:06 UTC (permalink / raw)
  To: openembedded-core

When there is not d_type avalaible on filesystem, fstatat (stat)
can be used to check if the path is a directory.
storage.c and timezone.c were modified accordingly.

Signed-off-by: Andrei Gherzan <andrei.gherzan@windriver.com>
---
 ...If-there-is-no-d_type-support-use-fstatat.patch |   57 ++++++++++++++++++++
 ...If-there-is-no-d_type-support-use-fstatat.patch |   45 ++++++++++++++++
 meta/recipes-connectivity/connman/connman_1.3.bb   |    6 ++-
 3 files changed, 106 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-connectivity/connman/connman/0001-timezone.c-If-there-is-no-d_type-support-use-fstatat.patch
 create mode 100644 meta/recipes-connectivity/connman/connman/0002-storage.c-If-there-is-no-d_type-support-use-fstatat.patch

diff --git a/meta/recipes-connectivity/connman/connman/0001-timezone.c-If-there-is-no-d_type-support-use-fstatat.patch b/meta/recipes-connectivity/connman/connman/0001-timezone.c-If-there-is-no-d_type-support-use-fstatat.patch
new file mode 100644
index 0000000..2e2f615
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/0001-timezone.c-If-there-is-no-d_type-support-use-fstatat.patch
@@ -0,0 +1,57 @@
+From f2094e6b2e4542adf458d8fa58d7bccd5edb762e Mon Sep 17 00:00:00 2001
+From: Andrei Gherzan <andrei@gherzan.ro>
+Date: Tue, 17 Jul 2012 17:27:39 +0300
+Subject: [PATCH V3 1/2] timezone.c: If there is no d_type support use
+ fstatat()
+
+This is useful for filesystems where d_type is always DT_UNKNOWN.
+In this case use fstatat() function.
+---
+ src/timezone.c |   24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+diff --git a/src/timezone.c b/src/timezone.c
+index 173d658..f951f6b 100644
+--- a/src/timezone.c
++++ b/src/timezone.c
+@@ -157,6 +157,8 @@ static char *find_origin(void *src_map, struct stat *src_st,
+ 	DIR *dir;
+ 	struct dirent *d;
+ 	char *str, pathname[PATH_MAX];
++	struct stat buf;
++	int ret;
+ 
+ 	if (subpath == NULL)
+ 		strncpy(pathname, basepath, sizeof(pathname));
+@@ -205,6 +207,28 @@ static char *find_origin(void *src_map, struct stat *src_st,
+ 				return str;
+ 			}
+ 			break;
++		case DT_UNKNOWN:
++			/*
++			 * If there is no d_type support use stat()
++			 * to check if directory
++			 */
++			ret = fstatat(dirfd(dir), d->d_name, &buf, 0);
++			if (ret < 0)
++				continue;
++			if (!(buf.st_mode & S_IFDIR))
++				continue;
++			if (subpath == NULL)
++				strncpy(pathname, d->d_name, sizeof(pathname));
++			else
++				snprintf(pathname, sizeof(pathname),
++						"%s/%s", subpath, d->d_name);
++
++			str = find_origin(src_map, src_st, basepath, pathname);
++			if (str != NULL) {
++				closedir(dir);
++				return str;
++			}
++			break;
+ 		}
+ 	}
+ 
+-- 
+1.7.9.5
+
diff --git a/meta/recipes-connectivity/connman/connman/0002-storage.c-If-there-is-no-d_type-support-use-fstatat.patch b/meta/recipes-connectivity/connman/connman/0002-storage.c-If-there-is-no-d_type-support-use-fstatat.patch
new file mode 100644
index 0000000..0103e60
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/0002-storage.c-If-there-is-no-d_type-support-use-fstatat.patch
@@ -0,0 +1,45 @@
+From 7007ef32a959ac4717c19339a24fd90a68638a19 Mon Sep 17 00:00:00 2001
+From: Andrei Gherzan <andrei@gherzan.ro>
+Date: Tue, 17 Jul 2012 16:07:17 +0300
+Subject: [PATCH V3 2/2] storage.c: If there is no d_type support use
+ fstatat()
+
+This is useful for filesystems where d_type is always DT_UNKNOWN.
+In this case use fstatat() function.
+---
+ src/storage.c |   19 +++++++++++++++++++
+ 1 file changed, 19 insertions(+)
+
+diff --git a/src/storage.c b/src/storage.c
+index 47bd0cb..0491a52 100644
+--- a/src/storage.c
++++ b/src/storage.c
+@@ -206,6 +206,25 @@ gchar **connman_storage_get_services()
+ 
+ 			g_string_append_printf(result, "%s/", d->d_name);
+ 			break;
++		case DT_UNKNOWN:
++			/*
++			 * If there is no d_type support use stat()
++			 * to check if directory
++			 */
++			ret = fstatat(dirfd(dir), d->d_name, &buf, 0);
++			if (ret < 0)
++				continue;
++			if (!(buf.st_mode & S_IFDIR))
++				continue;
++			str = g_strdup_printf("%s/%s/settings", STORAGEDIR,
++							d->d_name);
++			ret = stat(str, &buf);
++			g_free(str);
++			if (ret < 0)
++				continue;
++
++			g_string_append_printf(result, "%s/", d->d_name);
++			break;
+ 		}
+ 	}
+ 
+-- 
+1.7.9.5
+
diff --git a/meta/recipes-connectivity/connman/connman_1.3.bb b/meta/recipes-connectivity/connman/connman_1.3.bb
index 1e3d138..a98b46c 100644
--- a/meta/recipes-connectivity/connman/connman_1.3.bb
+++ b/meta/recipes-connectivity/connman/connman_1.3.bb
@@ -5,6 +5,8 @@ SRCREV = "3c0fa84091524c7cd6237744f2088ffee2f1d5ad"
 SRC_URI  = "git://git.kernel.org/pub/scm/network/connman/connman.git \
             file://0001-plugin.h-Change-visibility-to-default-for-debug-symb.patch \
             file://add_xuser_dbus_permission.patch \
-            file://connman"
+            file://connman \
+            file://0002-storage.c-If-there-is-no-d_type-support-use-fstatat.patch \
+            file://0001-timezone.c-If-there-is-no-d_type-support-use-fstatat.patch"
 S = "${WORKDIR}/git"
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH V4 4/4] connman: fix crashes on startup on PPC/MIPS
  2012-07-17 17:06 [PATCH V4 0/4] Update connman to v1.3, fix dependencies and runtime Andrei Gherzan
                   ` (2 preceding siblings ...)
  2012-07-17 17:06 ` [PATCH V4 3/4] connman: Add patches to fix connman on fs with no d_type support Andrei Gherzan
@ 2012-07-17 17:06 ` Andrei Gherzan
  2012-07-17 22:59   ` Saul Wold
  3 siblings, 1 reply; 7+ messages in thread
From: Andrei Gherzan @ 2012-07-17 17:06 UTC (permalink / raw)
  To: openembedded-core

From: Ross Burton <ross.burton@intel.com>

It appears that when there is no existing connman state there is memory
corruption which causes free() on MIPS/PPC to abort.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 ...ck-that-the-string-isn-t-empty-before-spl.patch |   37 ++++++++++++++++++++
 meta/recipes-connectivity/connman/connman_1.3.bb   |    5 +--
 2 files changed, 40 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-connectivity/connman/connman/0001-storage-check-that-the-string-isn-t-empty-before-spl.patch

diff --git a/meta/recipes-connectivity/connman/connman/0001-storage-check-that-the-string-isn-t-empty-before-spl.patch b/meta/recipes-connectivity/connman/connman/0001-storage-check-that-the-string-isn-t-empty-before-spl.patch
new file mode 100644
index 0000000..c92b586
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/0001-storage-check-that-the-string-isn-t-empty-before-spl.patch
@@ -0,0 +1,37 @@
+From ea8c7b3efce4c1762411e073893e948de5d552d6 Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@intel.com>
+Date: Tue, 17 Jul 2012 16:04:12 +0100
+Subject: [PATCH] storage: check that the string isn't empty before splitting
+
+If the string was non-NULL but empty (str="\0"), the following \0 assignment
+would write to str[-1] and thus cause memory corruption.
+
+On PPC and MIPS, this was causing crashes in glibc.
+
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+Upstream-Status: Submitted
+ 
+---
+ src/storage.c |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/storage.c b/src/storage.c
+index 47bd0cb..20766a3 100644
+--- a/src/storage.c
++++ b/src/storage.c
+@@ -212,7 +212,11 @@ gchar **connman_storage_get_services()
+ 	closedir(dir);
+ 
+ 	str = g_string_free(result, FALSE);
+-	if (str) {
++	if (str && str[0] != '\0') {
++		/*
++		 * Remove the trailing separator so that services doesn't end up
++		 * with an empty element.
++		 */
+ 		str[strlen(str) - 1] = '\0';
+ 		services = g_strsplit(str, "/", -1);
+ 	}
+-- 
+1.7.10.4
+
diff --git a/meta/recipes-connectivity/connman/connman_1.3.bb b/meta/recipes-connectivity/connman/connman_1.3.bb
index a98b46c..1e3ee56 100644
--- a/meta/recipes-connectivity/connman/connman_1.3.bb
+++ b/meta/recipes-connectivity/connman/connman_1.3.bb
@@ -7,6 +7,7 @@ SRC_URI  = "git://git.kernel.org/pub/scm/network/connman/connman.git \
             file://add_xuser_dbus_permission.patch \
             file://connman \
             file://0002-storage.c-If-there-is-no-d_type-support-use-fstatat.patch \
-            file://0001-timezone.c-If-there-is-no-d_type-support-use-fstatat.patch"
+            file://0001-timezone.c-If-there-is-no-d_type-support-use-fstatat.patch \
+            file://storage-check-that-the-string-isn-t-empty-before-spl.patch"
 S = "${WORKDIR}/git"
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH V4 3/4] connman: Add patches to fix connman on fs with no d_type support
  2012-07-17 17:06 ` [PATCH V4 3/4] connman: Add patches to fix connman on fs with no d_type support Andrei Gherzan
@ 2012-07-17 17:44   ` Saul Wold
  0 siblings, 0 replies; 7+ messages in thread
From: Saul Wold @ 2012-07-17 17:44 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On 07/17/2012 10:06 AM, Andrei Gherzan wrote:
> When there is not d_type avalaible on filesystem, fstatat (stat)
> can be used to check if the path is a directory.
> storage.c and timezone.c were modified accordingly.
>
> Signed-off-by: Andrei Gherzan <andrei.gherzan@windriver.com>
> ---
>   ...If-there-is-no-d_type-support-use-fstatat.patch |   57 ++++++++++++++++++++
>   ...If-there-is-no-d_type-support-use-fstatat.patch |   45 ++++++++++++++++
>   meta/recipes-connectivity/connman/connman_1.3.bb   |    6 ++-
>   3 files changed, 106 insertions(+), 2 deletions(-)
>   create mode 100644 meta/recipes-connectivity/connman/connman/0001-timezone.c-If-there-is-no-d_type-support-use-fstatat.patch
>   create mode 100644 meta/recipes-connectivity/connman/connman/0002-storage.c-If-there-is-no-d_type-support-use-fstatat.patch
>

These patches are missing Upstream-Status: and SOBs.

Thanks
	Sau!
> diff --git a/meta/recipes-connectivity/connman/connman/0001-timezone.c-If-there-is-no-d_type-support-use-fstatat.patch b/meta/recipes-connectivity/connman/connman/0001-timezone.c-If-there-is-no-d_type-support-use-fstatat.patch
> new file mode 100644
> index 0000000..2e2f615
> --- /dev/null
> +++ b/meta/recipes-connectivity/connman/connman/0001-timezone.c-If-there-is-no-d_type-support-use-fstatat.patch
> @@ -0,0 +1,57 @@
> +From f2094e6b2e4542adf458d8fa58d7bccd5edb762e Mon Sep 17 00:00:00 2001
> +From: Andrei Gherzan <andrei@gherzan.ro>
> +Date: Tue, 17 Jul 2012 17:27:39 +0300
> +Subject: [PATCH V3 1/2] timezone.c: If there is no d_type support use
> + fstatat()
> +
> +This is useful for filesystems where d_type is always DT_UNKNOWN.
> +In this case use fstatat() function.
> +---
> + src/timezone.c |   24 ++++++++++++++++++++++++
> + 1 file changed, 24 insertions(+)
> +
> +diff --git a/src/timezone.c b/src/timezone.c
> +index 173d658..f951f6b 100644
> +--- a/src/timezone.c
> ++++ b/src/timezone.c
> +@@ -157,6 +157,8 @@ static char *find_origin(void *src_map, struct stat *src_st,
> + 	DIR *dir;
> + 	struct dirent *d;
> + 	char *str, pathname[PATH_MAX];
> ++	struct stat buf;
> ++	int ret;
> +
> + 	if (subpath == NULL)
> + 		strncpy(pathname, basepath, sizeof(pathname));
> +@@ -205,6 +207,28 @@ static char *find_origin(void *src_map, struct stat *src_st,
> + 				return str;
> + 			}
> + 			break;
> ++		case DT_UNKNOWN:
> ++			/*
> ++			 * If there is no d_type support use stat()
> ++			 * to check if directory
> ++			 */
> ++			ret = fstatat(dirfd(dir), d->d_name, &buf, 0);
> ++			if (ret < 0)
> ++				continue;
> ++			if (!(buf.st_mode & S_IFDIR))
> ++				continue;
> ++			if (subpath == NULL)
> ++				strncpy(pathname, d->d_name, sizeof(pathname));
> ++			else
> ++				snprintf(pathname, sizeof(pathname),
> ++						"%s/%s", subpath, d->d_name);
> ++
> ++			str = find_origin(src_map, src_st, basepath, pathname);
> ++			if (str != NULL) {
> ++				closedir(dir);
> ++				return str;
> ++			}
> ++			break;
> + 		}
> + 	}
> +
> +--
> +1.7.9.5
> +
> diff --git a/meta/recipes-connectivity/connman/connman/0002-storage.c-If-there-is-no-d_type-support-use-fstatat.patch b/meta/recipes-connectivity/connman/connman/0002-storage.c-If-there-is-no-d_type-support-use-fstatat.patch
> new file mode 100644
> index 0000000..0103e60
> --- /dev/null
> +++ b/meta/recipes-connectivity/connman/connman/0002-storage.c-If-there-is-no-d_type-support-use-fstatat.patch
> @@ -0,0 +1,45 @@
> +From 7007ef32a959ac4717c19339a24fd90a68638a19 Mon Sep 17 00:00:00 2001
> +From: Andrei Gherzan <andrei@gherzan.ro>
> +Date: Tue, 17 Jul 2012 16:07:17 +0300
> +Subject: [PATCH V3 2/2] storage.c: If there is no d_type support use
> + fstatat()
> +
> +This is useful for filesystems where d_type is always DT_UNKNOWN.
> +In this case use fstatat() function.
> +---
> + src/storage.c |   19 +++++++++++++++++++
> + 1 file changed, 19 insertions(+)
> +
> +diff --git a/src/storage.c b/src/storage.c
> +index 47bd0cb..0491a52 100644
> +--- a/src/storage.c
> ++++ b/src/storage.c
> +@@ -206,6 +206,25 @@ gchar **connman_storage_get_services()
> +
> + 			g_string_append_printf(result, "%s/", d->d_name);
> + 			break;
> ++		case DT_UNKNOWN:
> ++			/*
> ++			 * If there is no d_type support use stat()
> ++			 * to check if directory
> ++			 */
> ++			ret = fstatat(dirfd(dir), d->d_name, &buf, 0);
> ++			if (ret < 0)
> ++				continue;
> ++			if (!(buf.st_mode & S_IFDIR))
> ++				continue;
> ++			str = g_strdup_printf("%s/%s/settings", STORAGEDIR,
> ++							d->d_name);
> ++			ret = stat(str, &buf);
> ++			g_free(str);
> ++			if (ret < 0)
> ++				continue;
> ++
> ++			g_string_append_printf(result, "%s/", d->d_name);
> ++			break;
> + 		}
> + 	}
> +
> +--
> +1.7.9.5
> +
> diff --git a/meta/recipes-connectivity/connman/connman_1.3.bb b/meta/recipes-connectivity/connman/connman_1.3.bb
> index 1e3d138..a98b46c 100644
> --- a/meta/recipes-connectivity/connman/connman_1.3.bb
> +++ b/meta/recipes-connectivity/connman/connman_1.3.bb
> @@ -5,6 +5,8 @@ SRCREV = "3c0fa84091524c7cd6237744f2088ffee2f1d5ad"
>   SRC_URI  = "git://git.kernel.org/pub/scm/network/connman/connman.git \
>               file://0001-plugin.h-Change-visibility-to-default-for-debug-symb.patch \
>               file://add_xuser_dbus_permission.patch \
> -            file://connman"
> +            file://connman \
> +            file://0002-storage.c-If-there-is-no-d_type-support-use-fstatat.patch \
> +            file://0001-timezone.c-If-there-is-no-d_type-support-use-fstatat.patch"
>   S = "${WORKDIR}/git"
> -PR = "${INC_PR}.0"
> +PR = "${INC_PR}.1"
>




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH V4 4/4] connman: fix crashes on startup on PPC/MIPS
  2012-07-17 17:06 ` [PATCH V4 4/4] connman: fix crashes on startup on PPC/MIPS Andrei Gherzan
@ 2012-07-17 22:59   ` Saul Wold
  0 siblings, 0 replies; 7+ messages in thread
From: Saul Wold @ 2012-07-17 22:59 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer, Andrei Gherzan,
	Burton, Ross

On 07/17/2012 10:06 AM, Andrei Gherzan wrote:
> From: Ross Burton <ross.burton@intel.com>
>
> It appears that when there is no existing connman state there is memory
> corruption which causes free() on MIPS/PPC to abort.
>
> Signed-off-by: Ross Burton <ross.burton@intel.com>
> ---
>   ...ck-that-the-string-isn-t-empty-before-spl.patch |   37 ++++++++++++++++++++
>   meta/recipes-connectivity/connman/connman_1.3.bb   |    5 +--
>   2 files changed, 40 insertions(+), 2 deletions(-)
>   create mode 100644 meta/recipes-connectivity/connman/connman/0001-storage-check-that-the-string-isn-t-empty-before-spl.patch
>
> diff --git a/meta/recipes-connectivity/connman/connman/0001-storage-check-that-the-string-isn-t-empty-before-spl.patch b/meta/recipes-connectivity/connman/connman/0001-storage-check-that-the-string-isn-t-empty-before-spl.patch
> new file mode 100644
> index 0000000..c92b586
> --- /dev/null
> +++ b/meta/recipes-connectivity/connman/connman/0001-storage-check-that-the-string-isn-t-empty-before-spl.patch
> @@ -0,0 +1,37 @@
> +From ea8c7b3efce4c1762411e073893e948de5d552d6 Mon Sep 17 00:00:00 2001
> +From: Ross Burton <ross.burton@intel.com>
> +Date: Tue, 17 Jul 2012 16:04:12 +0100
> +Subject: [PATCH] storage: check that the string isn't empty before splitting
> +
> +If the string was non-NULL but empty (str="\0"), the following \0 assignment
> +would write to str[-1] and thus cause memory corruption.
> +
> +On PPC and MIPS, this was causing crashes in glibc.
> +
> +Signed-off-by: Ross Burton <ross.burton@intel.com>
> +Upstream-Status: Submitted
> +
> +---
> + src/storage.c |    6 +++++-
> + 1 file changed, 5 insertions(+), 1 deletion(-)
> +
> +diff --git a/src/storage.c b/src/storage.c
> +index 47bd0cb..20766a3 100644
> +--- a/src/storage.c
> ++++ b/src/storage.c
> +@@ -212,7 +212,11 @@ gchar **connman_storage_get_services()
> + 	closedir(dir);
> +
> + 	str = g_string_free(result, FALSE);
> +-	if (str) {
> ++	if (str && str[0] != '\0') {
> ++		/*
> ++		 * Remove the trailing separator so that services doesn't end up
> ++		 * with an empty element.
> ++		 */
> + 		str[strlen(str) - 1] = '\0';
> + 		services = g_strsplit(str, "/", -1);
> + 	}
> +--
> +1.7.10.4
> +
> diff --git a/meta/recipes-connectivity/connman/connman_1.3.bb b/meta/recipes-connectivity/connman/connman_1.3.bb
> index a98b46c..1e3ee56 100644
> --- a/meta/recipes-connectivity/connman/connman_1.3.bb
> +++ b/meta/recipes-connectivity/connman/connman_1.3.bb
> @@ -7,6 +7,7 @@ SRC_URI  = "git://git.kernel.org/pub/scm/network/connman/connman.git \
>               file://add_xuser_dbus_permission.patch \
>               file://connman \
>               file://0002-storage.c-If-there-is-no-d_type-support-use-fstatat.patch \
> -            file://0001-timezone.c-If-there-is-no-d_type-support-use-fstatat.patch"
> +            file://0001-timezone.c-If-there-is-no-d_type-support-use-fstatat.patch \
> +            file://storage-check-that-the-string-isn-t-empty-before-spl.patch"
Patch name here does not match the filename created above!

Sau!

>   S = "${WORKDIR}/git"
> -PR = "${INC_PR}.1"
> +PR = "${INC_PR}.2"
>




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-07-17 23:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-17 17:06 [PATCH V4 0/4] Update connman to v1.3, fix dependencies and runtime Andrei Gherzan
2012-07-17 17:06 ` [PATCH V4 1/4] connman: Update to version 1.3 Andrei Gherzan
2012-07-17 17:06 ` [PATCH V4 2/4] connman.inc: Add missing dependencies needed by some tests Andrei Gherzan
2012-07-17 17:06 ` [PATCH V4 3/4] connman: Add patches to fix connman on fs with no d_type support Andrei Gherzan
2012-07-17 17:44   ` Saul Wold
2012-07-17 17:06 ` [PATCH V4 4/4] connman: fix crashes on startup on PPC/MIPS Andrei Gherzan
2012-07-17 22:59   ` Saul Wold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox