ns: Fix time_for_children symlink

Submitted by Michael Kerrisk (man-pages) on April 3, 2020, 12:11 p.m.

Details

Message ID a2418c48-ed80-3afe-116e-6611cb799557@gmail.com
State New
Series "ns: Fix time_for_children symlink"
Headers show

Commit Message

Michael Kerrisk (man-pages) April 3, 2020, 12:11 p.m.
Dmitry, Andrei,

Looking at the contents of the /proc/PID/ns/time_for_children
symlink shows an anomaly:

$ ls -l /proc/self/ns/* |awk '{print $9, $10, $11}'
...
/proc/self/ns/pid -> pid:[4026531836]
/proc/self/ns/pid_for_children -> pid:[4026531836]
/proc/self/ns/time -> time:[4026531834]
/proc/self/ns/time_for_children -> time_for_children:[4026531834]
/proc/self/ns/user -> user:[4026531837]
...

The reference for 'time_for_children' should be a 'time' namespace,
just as the reference for 'pid_for_children' is a 'pid' namespace.
In other words, I think the above time_for_children link should read:

/proc/self/ns/time_for_children -> time:[4026531834]

If you agree with this patch, then it should be marked for
stable@vger.kernel.org.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>

---
 kernel/time/namespace.c | 1 +
 1 file changed, 1 insertion(+)

Patch hide | download patch | download mbox

diff --git a/kernel/time/namespace.c b/kernel/time/namespace.c
index e6ba064ce773..3b30288793fe 100644
--- a/kernel/time/namespace.c
+++ b/kernel/time/namespace.c
@@ -447,6 +447,7 @@  const struct proc_ns_operations timens_operations = {
 
 const struct proc_ns_operations timens_for_children_operations = {
 	.name		= "time_for_children",
+	.real_ns_name	= "time",
 	.type		= CLONE_NEWTIME,
 	.get		= timens_for_children_get,
 	.put		= timens_put,

Comments

Christian Brauner April 3, 2020, 12:34 p.m.
On Fri, Apr 03, 2020 at 02:11:39PM +0200, Michael Kerrisk (man-pages) wrote:
> Dmitry, Andrei,
> 
> Looking at the contents of the /proc/PID/ns/time_for_children
> symlink shows an anomaly:
> 
> $ ls -l /proc/self/ns/* |awk '{print $9, $10, $11}'
> ...
> /proc/self/ns/pid -> pid:[4026531836]
> /proc/self/ns/pid_for_children -> pid:[4026531836]
> /proc/self/ns/time -> time:[4026531834]
> /proc/self/ns/time_for_children -> time_for_children:[4026531834]
> /proc/self/ns/user -> user:[4026531837]
> ...
> 
> The reference for 'time_for_children' should be a 'time' namespace,
> just as the reference for 'pid_for_children' is a 'pid' namespace.
> In other words, I think the above time_for_children link should read:
> 
> /proc/self/ns/time_for_children -> time:[4026531834]
> 
> If you agree with this patch, then it should be marked for
> stable@vger.kernel.org.
> 
> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>

Yeah, that just seems like an oversight.

Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Jann Horn via Containers April 3, 2020, 12:49 p.m.
On 4/3/20 1:34 PM, Christian Brauner wrote:
> On Fri, Apr 03, 2020 at 02:11:39PM +0200, Michael Kerrisk (man-pages) wrote:
>> Dmitry, Andrei,
>>
>> Looking at the contents of the /proc/PID/ns/time_for_children
>> symlink shows an anomaly:
>>
>> $ ls -l /proc/self/ns/* |awk '{print $9, $10, $11}'
>> ...
>> /proc/self/ns/pid -> pid:[4026531836]
>> /proc/self/ns/pid_for_children -> pid:[4026531836]
>> /proc/self/ns/time -> time:[4026531834]
>> /proc/self/ns/time_for_children -> time_for_children:[4026531834]
>> /proc/self/ns/user -> user:[4026531837]
>> ...
>>
>> The reference for 'time_for_children' should be a 'time' namespace,
>> just as the reference for 'pid_for_children' is a 'pid' namespace.
>> In other words, I think the above time_for_children link should read:
>>
>> /proc/self/ns/time_for_children -> time:[4026531834]
>>
>> If you agree with this patch, then it should be marked for
>> stable@vger.kernel.org.
>>
>> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
> 
> Yeah, that just seems like an oversight.
> 
> Acked-by: Christian Brauner <christian.brauner@ubuntu.com>

Thanks,

Reviewed-by: Dmitry Safonov <dima@arista.com>
Fixes: 769071ac9f20 ("ns: Introduce Time Namespace")
+Cc: stable # v5.6
Andrei Vagin April 7, 2020, 3:33 a.m.
On Fri, Apr 03, 2020 at 02:11:39PM +0200, Michael Kerrisk (man-pages) wrote:
> Dmitry, Andrei,
> 
> Looking at the contents of the /proc/PID/ns/time_for_children
> symlink shows an anomaly:
> 
> $ ls -l /proc/self/ns/* |awk '{print $9, $10, $11}'
> ...
> /proc/self/ns/pid -> pid:[4026531836]
> /proc/self/ns/pid_for_children -> pid:[4026531836]
> /proc/self/ns/time -> time:[4026531834]
> /proc/self/ns/time_for_children -> time_for_children:[4026531834]
> /proc/self/ns/user -> user:[4026531837]
> ...
> 
> The reference for 'time_for_children' should be a 'time' namespace,
> just as the reference for 'pid_for_children' is a 'pid' namespace.
> In other words, I think the above time_for_children link should read:
> 
> /proc/self/ns/time_for_children -> time:[4026531834]
> 
> If you agree with this patch, then it should be marked for
> stable@vger.kernel.org.
>

Acked-by: Andrei Vagin <avagin@gmail.com>
 
> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>