← Back to team overview

ubuntu-phone team mailing list archive

[Porting] New procfs kernel patch requirement

 

Just wanted to let folks now that we've added a kernel patch to all of
our current public kernels which fixes some problems with the current
application life cycle due to PID mis-matches between Android and the
Ubuntu container.

This patch allows code running on the Android side to properly lookup a
processes PID from the Ubuntu namespace, so that it both sides can refer
to the same process.

This is a short-term solution, however it unblocks a bug which prevents
applications from being launched from the command-line without manual
intervention to get the app to display.

If you're involved in porting Ubuntu Touch to a new device ( or have
already done so ), you'll need to apply this patch to your kernels,
which should result in better application behavior.

I will also make sure the Porting Guide on the wiki is updated.

Regards,
/tony
>From 30e9b2f64f011997987ce9ed3457f8e832f6f56d Mon Sep 17 00:00:00 2001
From: Tony Espy <espy@xxxxxxxxxxxxx>
Date: Wed, 27 Feb 2013 17:34:33 -0500
Subject: [PATCH] Expose virtual PID from child namespace in /proc/PID/status.

The virtual PID is used by Ubuntu Touch application manager code ( which
runs in the Android namespace ), to communicate with code that runs inside the
Ubuntu container.

This patch is not from upstream.  It was proposed on the lxc-users
mailing list:

http://www.mail-archive.com/lxc-users@xxxxxxxxxxxxxxxxxxxxx/msg01840.html

Change-Id: If63652002c227827fb524e03a1d0210fc2b7d4b1
Original-Author: Greg Kurz <gkurz@xxxxxxxxxx>
Signed-off-by: Greg Kurz <gkurz@xxxxxxxxxx>
Signed-off-by: Tony Espy <espy@xxxxxxxxxxxxx>
---
 fs/proc/array.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/proc/array.c b/fs/proc/array.c
index f9bd395..83ea1bc 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -337,6 +337,12 @@ static void task_cpus_allowed(struct seq_file *m, struct task_struct *task)
 	seq_putc(m, '\n');
 }
 
+static void task_vpid(struct seq_file *m, struct task_struct *task)
+{
+	struct pid_namespace *ns = task_active_pid_ns(task);
+	seq_printf(m, "Vpid:\t%d\n", ns ? task_pid_nr_ns(task, ns) : 0);
+}
+
 int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
 			struct pid *pid, struct task_struct *task)
 {
@@ -354,6 +360,7 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
 	task_cpus_allowed(m, task);
 	cpuset_task_status_allowed(m, task);
 	task_context_switch_counts(m, task);
+	task_vpid(m, task);
 	return 0;
 }
 
-- 
1.7.10.4