realpath.c (c59f415a7cb6e1e1e1cdbd6ee370b050e95f6b21) realpath.c (9d78edeaec759f997c303f286ecd39daee166f2a)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * security/tomoyo/realpath.c
4 *
5 * Copyright (C) 2005-2011 NTT DATA CORPORATION
6 */
7
8#include "common.h"

--- 148 unchanged lines hidden (view full) ---

157 char *pos = tomoyo_get_dentry_path(dentry, buffer, buflen);
158
159 if (IS_ERR(pos))
160 return pos;
161 /* Convert from $PID to self if $PID is current thread. */
162 if (sb->s_magic == PROC_SUPER_MAGIC && *pos == '/') {
163 char *ep;
164 const pid_t pid = (pid_t) simple_strtoul(pos + 1, &ep, 10);
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * security/tomoyo/realpath.c
4 *
5 * Copyright (C) 2005-2011 NTT DATA CORPORATION
6 */
7
8#include "common.h"

--- 148 unchanged lines hidden (view full) ---

157 char *pos = tomoyo_get_dentry_path(dentry, buffer, buflen);
158
159 if (IS_ERR(pos))
160 return pos;
161 /* Convert from $PID to self if $PID is current thread. */
162 if (sb->s_magic == PROC_SUPER_MAGIC && *pos == '/') {
163 char *ep;
164 const pid_t pid = (pid_t) simple_strtoul(pos + 1, &ep, 10);
165 struct pid_namespace *proc_pidns = proc_pid_ns(d_inode(dentry));
165 struct pid_namespace *proc_pidns = proc_pid_ns(sb);
166
167 if (*ep == '/' && pid && pid ==
168 task_tgid_nr_ns(current, proc_pidns)) {
169 pos = ep - 5;
170 if (pos < buffer)
171 goto out;
172 memmove(pos, "/self", 5);
173 }

--- 142 unchanged lines hidden ---
166
167 if (*ep == '/' && pid && pid ==
168 task_tgid_nr_ns(current, proc_pidns)) {
169 pos = ep - 5;
170 if (pos < buffer)
171 goto out;
172 memmove(pos, "/self", 5);
173 }

--- 142 unchanged lines hidden ---