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_is_in_init_pid_ns(current))
+               return -EINVAL;
+
        spin_lock(&drvdata->spinlock);
        val = (unsigned long)config->vmid_val[config->vmid_idx];
        spin_unlock(&drvdata->spinlock);
        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_is_in_init_pid_ns(current))
+               return -EINVAL;
+
        /*
         * only implemented when vmid tracing is enabled, i.e. at least one
         * vmid comparator is implemented and at least 8 bit vmid size
        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_is_in_init_pid_ns(current))
+               return -EINVAL;
+
        spin_lock(&drvdata->spinlock);
        val1 = config->vmid_mask0;
        val2 = config->vmid_mask1;
        struct etmv4_config *config = &drvdata->config;
        int nr_inputs;
 
+       /*
+        * Don't use virtual contextID tracing if coming from a PID namespace.
+        * See comment in ctxid_pid_store().
+        */
+       if (!task_is_in_init_pid_ns(current))
+               return -EINVAL;
+
        /*
         * only implemented when vmid tracing is enabled, i.e. at least one
         * vmid comparator is implemented and at least 8 bit vmid size