Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Saul Wold <sgw@linux.intel.com>
To: Patches and discussions about the oe-core layer
	<openembedded-core@lists.openembedded.org>,
	 Andrei Gherzan <andrei@gherzan.ro>,
	"Burton, Ross" <ross.burton@intel.com>
Subject: Re: [PATCH V4 4/4] connman: fix crashes on startup on PPC/MIPS
Date: Tue, 17 Jul 2012 15:59:25 -0700	[thread overview]
Message-ID: <5005EE4D.7050200@linux.intel.com> (raw)
In-Reply-To: <3d20c37040fb3d1a88003ff5e5d71e1b1e14e553.1342544558.git.andrei@gherzan.ro>

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"
>




      reply	other threads:[~2012-07-17 23:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5005EE4D.7050200@linux.intel.com \
    --to=sgw@linux.intel.com \
    --cc=andrei@gherzan.ro \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=ross.burton@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox