* [PATCH v4 1/5] coresight: etm3x: Use task_is_in_init_pid_ns()
2022-02-04 13:50 [PATCH v4 0/5] pid: Use helper task_is_in_root_ns() Leo Yan
@ 2022-02-04 13:50 ` Leo Yan
2022-02-04 13:50 ` [PATCH v4 2/5] coresight: etm4x: " Leo Yan
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Leo Yan @ 2022-02-04 13:50 UTC (permalink / raw)
To: Mathieu Poirier, Suzuki K Poulose, Mike Leach, Alexander Shishkin,
Jan Harkes, coda, Paul Moore, Eric Paris, Balbir Singh, coresight,
linux-arm-kernel, linux-kernel, codalist, linux-audit
Cc: Leo Yan
This patch replaces open code with task_is_in_init_pid_ns() to check if
a task is in root PID namespace.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Acked-by: Balbir Singh <bsingharora@gmail.com>
---
drivers/hwtracing/coresight/coresight-etm3x-sysfs.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c
index e8c7649f123e..ff76cb56b727 100644
--- a/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c
+++ b/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c
@@ -1030,7 +1030,7 @@ static ssize_t ctxid_pid_show(struct device *dev,
* Don't use contextID tracing if coming from a PID namespace. See
* comment in ctxid_pid_store().
*/
- if (task_active_pid_ns(current) != &init_pid_ns)
+ if (!task_is_in_init_pid_ns(current))
return -EINVAL;
spin_lock(&drvdata->spinlock);
@@ -1058,7 +1058,7 @@ static ssize_t ctxid_pid_store(struct device *dev,
* As such refuse to use the feature if @current is not in the initial
* PID namespace.
*/
- if (task_active_pid_ns(current) != &init_pid_ns)
+ if (!task_is_in_init_pid_ns(current))
return -EINVAL;
ret = kstrtoul(buf, 16, &pid);
@@ -1084,7 +1084,7 @@ static ssize_t ctxid_mask_show(struct device *dev,
* Don't use contextID tracing if coming from a PID namespace. See
* comment in ctxid_pid_store().
*/
- if (task_active_pid_ns(current) != &init_pid_ns)
+ if (!task_is_in_init_pid_ns(current))
return -EINVAL;
val = config->ctxid_mask;
@@ -1104,7 +1104,7 @@ static ssize_t ctxid_mask_store(struct device *dev,
* Don't use contextID tracing if coming from a PID namespace. See
* comment in ctxid_pid_store().
*/
- if (task_active_pid_ns(current) != &init_pid_ns)
+ if (!task_is_in_init_pid_ns(current))
return -EINVAL;
ret = kstrtoul(buf, 16, &val);
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v4 2/5] coresight: etm4x: Use task_is_in_init_pid_ns()
2022-02-04 13:50 [PATCH v4 0/5] pid: Use helper task_is_in_root_ns() Leo Yan
2022-02-04 13:50 ` [PATCH v4 1/5] coresight: etm3x: Use task_is_in_init_pid_ns() Leo Yan
@ 2022-02-04 13:50 ` Leo Yan
2022-02-04 13:50 ` [PATCH v4 3/5] coda: " Leo Yan
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Leo Yan @ 2022-02-04 13:50 UTC (permalink / raw)
To: Mathieu Poirier, Suzuki K Poulose, Mike Leach, Alexander Shishkin,
Jan Harkes, coda, Paul Moore, Eric Paris, Balbir Singh, coresight,
linux-arm-kernel, linux-kernel, codalist, linux-audit
Cc: Leo Yan
This patch replaces open code with task_is_in_init_pid_ns() to check if
a task is in root PID namespace.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Acked-by: Balbir Singh <bsingharora@gmail.com>
---
drivers/hwtracing/coresight/coresight-etm4x-sysfs.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c
index a0640fa5c55b..10ef2a29006e 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c
+++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c
@@ -1890,7 +1890,7 @@ static ssize_t ctxid_pid_show(struct device *dev,
* Don't use contextID tracing if coming from a PID namespace. See
* comment in ctxid_pid_store().
*/
- if (task_active_pid_ns(current) != &init_pid_ns)
+ if (!task_is_in_init_pid_ns(current))
return -EINVAL;
spin_lock(&drvdata->spinlock);
@@ -1918,7 +1918,7 @@ static ssize_t ctxid_pid_store(struct device *dev,
* As such refuse to use the feature if @current is not in the initial
* PID namespace.
*/
- if (task_active_pid_ns(current) != &init_pid_ns)
+ if (!task_is_in_init_pid_ns(current))
return -EINVAL;
/*
@@ -1951,7 +1951,7 @@ static ssize_t ctxid_masks_show(struct device *dev,
* Don't use contextID tracing if coming from a PID namespace. See
* comment in ctxid_pid_store().
*/
- if (task_active_pid_ns(current) != &init_pid_ns)
+ if (!task_is_in_init_pid_ns(current))
return -EINVAL;
spin_lock(&drvdata->spinlock);
@@ -1975,7 +1975,7 @@ static ssize_t ctxid_masks_store(struct device *dev,
* Don't use contextID tracing if coming from a PID namespace. See
* comment in ctxid_pid_store().
*/
- if (task_active_pid_ns(current) != &init_pid_ns)
+ if (!task_is_in_init_pid_ns(current))
return -EINVAL;
/*
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v4 3/5] coda: Use task_is_in_init_pid_ns()
2022-02-04 13:50 [PATCH v4 0/5] pid: Use helper task_is_in_root_ns() Leo Yan
2022-02-04 13:50 ` [PATCH v4 1/5] coresight: etm3x: Use task_is_in_init_pid_ns() Leo Yan
2022-02-04 13:50 ` [PATCH v4 2/5] coresight: etm4x: " Leo Yan
@ 2022-02-04 13:50 ` Leo Yan
2022-02-04 13:50 ` [PATCH v4 4/5] audit: " Leo Yan
2022-02-04 13:50 ` [PATCH v4 5/5] taskstats: " Leo Yan
4 siblings, 0 replies; 6+ messages in thread
From: Leo Yan @ 2022-02-04 13:50 UTC (permalink / raw)
To: Mathieu Poirier, Suzuki K Poulose, Mike Leach, Alexander Shishkin,
Jan Harkes, coda, Paul Moore, Eric Paris, Balbir Singh, coresight,
linux-arm-kernel, linux-kernel, codalist, linux-audit
Cc: Leo Yan
Replace open code with task_is_in_init_pid_ns() for checking root PID
namespace.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
fs/coda/inode.c | 2 +-
fs/coda/psdev.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index d9f1bd7153df..931f4560fdd0 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -152,7 +152,7 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)
int error;
int idx;
- if (task_active_pid_ns(current) != &init_pid_ns)
+ if (!task_is_in_init_pid_ns(current))
return -EINVAL;
idx = get_device_index((struct coda_mount_data *) data);
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c
index b39580ad4ce5..73457661fbe8 100644
--- a/fs/coda/psdev.c
+++ b/fs/coda/psdev.c
@@ -270,7 +270,7 @@ static int coda_psdev_open(struct inode * inode, struct file * file)
struct venus_comm *vcp;
int idx, err;
- if (task_active_pid_ns(current) != &init_pid_ns)
+ if (!task_is_in_init_pid_ns(current))
return -EINVAL;
if (current_user_ns() != &init_user_ns)
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v4 4/5] audit: Use task_is_in_init_pid_ns()
2022-02-04 13:50 [PATCH v4 0/5] pid: Use helper task_is_in_root_ns() Leo Yan
` (2 preceding siblings ...)
2022-02-04 13:50 ` [PATCH v4 3/5] coda: " Leo Yan
@ 2022-02-04 13:50 ` Leo Yan
2022-02-04 13:50 ` [PATCH v4 5/5] taskstats: " Leo Yan
4 siblings, 0 replies; 6+ messages in thread
From: Leo Yan @ 2022-02-04 13:50 UTC (permalink / raw)
To: Mathieu Poirier, Suzuki K Poulose, Mike Leach, Alexander Shishkin,
Jan Harkes, coda, Paul Moore, Eric Paris, Balbir Singh, coresight,
linux-arm-kernel, linux-kernel, codalist, linux-audit
Cc: Leo Yan, Richard Guy Briggs
Replace open code with task_is_in_init_pid_ns() for checking root PID
namespace.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Acked-by: Balbir Singh <bsingharora@gmail.com>
Acked-by: Paul Moore <paul@paul-moore.com>
Reviewed-by: Richard Guy Briggs <rgb@redhat.com>
---
kernel/audit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/audit.c b/kernel/audit.c
index 7690c29d4ee4..4dfa58865d9a 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1056,7 +1056,7 @@ static int audit_netlink_ok(struct sk_buff *skb, u16 msg_type)
case AUDIT_MAKE_EQUIV:
/* Only support auditd and auditctl in initial pid namespace
* for now. */
- if (task_active_pid_ns(current) != &init_pid_ns)
+ if (!task_is_in_init_pid_ns(current))
return -EPERM;
if (!netlink_capable(skb, CAP_AUDIT_CONTROL))
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v4 5/5] taskstats: Use task_is_in_init_pid_ns()
2022-02-04 13:50 [PATCH v4 0/5] pid: Use helper task_is_in_root_ns() Leo Yan
` (3 preceding siblings ...)
2022-02-04 13:50 ` [PATCH v4 4/5] audit: " Leo Yan
@ 2022-02-04 13:50 ` Leo Yan
4 siblings, 0 replies; 6+ messages in thread
From: Leo Yan @ 2022-02-04 13:50 UTC (permalink / raw)
To: Mathieu Poirier, Suzuki K Poulose, Mike Leach, Alexander Shishkin,
Jan Harkes, coda, Paul Moore, Eric Paris, Balbir Singh, coresight,
linux-arm-kernel, linux-kernel, codalist, linux-audit
Cc: Leo Yan
Replace open code with task_is_in_init_pid_ns() for checking root PID
namespace.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Acked-by: Balbir Singh <bsingharora@gmail.com>
---
kernel/taskstats.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/taskstats.c b/kernel/taskstats.c
index 2b4898b4752e..f570d8e1f001 100644
--- a/kernel/taskstats.c
+++ b/kernel/taskstats.c
@@ -284,7 +284,7 @@ static int add_del_listener(pid_t pid, const struct cpumask *mask, int isadd)
if (current_user_ns() != &init_user_ns)
return -EINVAL;
- if (task_active_pid_ns(current) != &init_pid_ns)
+ if (!task_is_in_init_pid_ns(current))
return -EINVAL;
if (isadd == REGISTER) {
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread