Thread (12 messages) 12 messages, 2 authors, 2021-11-17

Re: [PATCH v1 2/4] coresight: etm4x: Don't use virtual contextID for non-root PID namespace

From: Leo Yan <hidden>
Date: 2021-11-04 15:24:34
Also in: lkml

On Thu, Nov 04, 2021 at 03:07:45PM +0000, Suzuki Kuruppassery Poulose wrote:

[...]
quoted
@@ -2111,6 +2111,13 @@ static ssize_t vmid_val_show(struct device *dev,
  	struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent);
  	struct etmv4_config *config = &drvdata->config;
+	/*
+	 * Don't use virtual contextID tracing if coming from a PID namespace.
+	 * See comment in ctxid_pid_store().
+	 */
+	if (task_active_pid_ns(current) != &init_pid_ns)
+		return -EINVAL;
+
  	spin_lock(&drvdata->spinlock);
  	val = (unsigned long)config->vmid_val[config->vmid_idx];
  	spin_unlock(&drvdata->spinlock);
@@ -2125,6 +2132,13 @@ static ssize_t vmid_val_store(struct device *dev,
  	struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent);
  	struct etmv4_config *config = &drvdata->config;
+	/*
+	 * Don't use virtual contextID tracing if coming from a PID namespace.
+	 * See comment in ctxid_pid_store().
+	 */
+	if (task_active_pid_ns(current) != &init_pid_ns)
Please could we add a helper function to make this obvious ?

e.g: task_is_in_root_ns(task) ?
Yeah, I will use a separate patch set to add this helper function and
polish relevant codes in the kernel.  Thanks for suggestion.

Leo

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help