Skip to contentSkip to conversation

android/system-emulator: Pass --track-origin=yes to valgrind

PATCH In review Luiz Augusto von Dentz 2 participants 3 messages Apr 10, 2014 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/2 android/system-emulator: Pass --track-origin=yes to valgrind

From: Luiz Augusto von Dentz <[email protected]>

This adds --track-origin=yes option:

"Controls whether Memcheck tracks the origin of uninitialised values.
By default, it does not, which means that although it can tell you that an uninitialised value is being used in a dangerous way, it cannot tell you where the uninitialised value came from. This often makes it difficult to track down the root problem."

---
 android/system-emulator.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
android/system-emulator.c +5 -4
index dc46814..c1b1b25 100644
@@ -50,7 +50,7 @@ static pid_t snoop_pid = -1;
 static void ctl_start(void)
 {
 	char prg_name[PATH_MAX + 1];
-	char *prg_argv[5];
+	char *prg_argv[6];
 	char *prg_envp[3];
 	pid_t pid;
 
@@ -58,9 +58,10 @@ static void ctl_start(void)
 
 	prg_argv[0] = "/usr/bin/valgrind";
 	prg_argv[1] = "--leak-check=full";
-	prg_argv[2] = prg_name;
-	prg_argv[3] = "-d";
-	prg_argv[4] = NULL;
+	prg_argv[2] = "--track-origins=yes";
+	prg_argv[3] = prg_name;
+	prg_argv[4] = "-d";
+	prg_argv[5] = NULL;
 
 	prg_envp[0] = "G_SLICE=always-malloc";
 	prg_envp[1] = "G_DEBUG=gc-friendly";
Signature · 1 line
1.9.0
author maintainer
#1 lore raw

PATCH 2/2 android/hal-gatt: Fix sending uninitialised byte

From: Luiz Augusto von Dentz <[email protected]>

This fixes sending uninitialised byte on init:

Syscall param sendmsg(msg.msg_iov[1]) points to uninitialised byte(s)
at 0x534ADDD: ??? (in /usr/lib64/libpthread-2.18.so)
by 0x6B5628C: hal_ipc_cmd (hal-ipc.c:357)
by 0x6B54F6D: init (hal-gatt.c:1268)
by 0x4092DB: init_p (if-gatt.c:779)
by 0x401CCD: main (haltest.c:413)
Address 0xffefffda1 is on thread 1's stack
Uninitialised value was created by a stack allocation
at 0x6B54EC0: init (hal-gatt.c:1252)

---
 android/hal-gatt.c | 1 +
 1 file changed, 1 insertion(+)
android/hal-gatt.c +1 -0
index d8c0d54..6fde143 100644
@@ -1264,6 +1264,7 @@ static bt_status_t init(const btgatt_callbacks_t *callbacks)
 				sizeof(ev_handlers)/sizeof(ev_handlers[0]));
 
 	cmd.service_id = HAL_SERVICE_ID_GATT;
+	cmd.mode = HAL_MODE_DEFAULT;
 
 	ret = hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_REGISTER_MODULE,
 					sizeof(cmd), &cmd, 0, NULL, NULL);
Signature · 1 line
1.9.0
#2 lore raw
In reply to Luiz Augusto von Dentz

Hi Luiz,

Quoted 31 lines · On Thursday 10 of April 2014 15:17:08 Luiz Augusto von Dentz wrote:

From: Luiz Augusto von Dentz <[email protected]>

This adds --track-origin=yes option:

"Controls whether Memcheck tracks the origin of uninitialised values.
By default, it does not, which means that although it can tell you that an uninitialised value is being used in a dangerous way, it cannot tell you where the uninitialised value came from. This often makes it difficult to track down the root problem."

---
 android/system-emulator.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
android/system-emulator.c +1 -1
index dc46814..c1b1b25 100644
@@ -50,7 +50,7 @@ static pid_t snoop_pid = -1;
 static void ctl_start(void)
 {
 	char prg_name[PATH_MAX + 1];
-	char *prg_argv[5];
+	char *prg_argv[6];
 	char *prg_envp[3];
 	pid_t pid;
 
@@ -58,9 +58,10 @@ static void ctl_start(void)
 
 	prg_argv[0] = "/usr/bin/valgrind";
 	prg_argv[1] = "--leak-check=full";

android/system-emulator.c static void ctl_start(void) · line 67

Quoted 10 lines
android/system-emulator.c +4 -3
-	prg_argv[2] = prg_name;
-	prg_argv[3] = "-d";
-	prg_argv[4] = NULL;
+	prg_argv[2] = "--track-origins=yes";
+	prg_argv[3] = prg_name;
+	prg_argv[4] = "-d";
+	prg_argv[5] = NULL;
 
 	prg_envp[0] = "G_SLICE=always-malloc";
 	prg_envp[1] = "G_DEBUG=gc-friendly";

Both patches applied, thanks.

Signature · 2 lines
Best regards, 
Szymon Janc