From: Carlos Neira <hidden> Date: 2019-10-22 19:18:06
Currently bpf_get_current_pid_tgid(), is used to do pid filtering in bcc's
scripts but this helper returns the pid as seen by the root namespace which is
fine when a bcc script is not executed inside a container.
When the process of interest is inside a container, pid filtering will not work
if bpf_get_current_pid_tgid() is used.
This helper addresses this limitation returning the pid as it's seen by the current
namespace where the script is executing.
In the future different pid_ns files may belong to different devices, according to the
discussion between Eric Biederman and Yonghong in 2017 Linux plumbers conference.
To address that situation the helper requires inum and dev_t from /proc/self/ns/pid.
This helper has the same use cases as bpf_get_current_pid_tgid() as it can be
used to do pid filtering even inside a container.
Changes from V14:
- refactored selftests
- refactored ebpf helper
Signed-off-by: Carlos Neira <redacted>
Carlos Neira (5):
fs/nsfs.c: added ns_match
bpf: added new helper bpf_get_ns_current_pid_tgid
tools: Added bpf_get_ns_current_pid_tgid helper
tools/testing/selftests/bpf: Add self-tests for new helper.
bpf_helpers_doc.py: Add struct bpf_pidns_info to known types
fs/nsfs.c | 14 +++
include/linux/bpf.h | 1 +
include/linux/proc_ns.h | 2 +
include/uapi/linux/bpf.h | 20 ++++-
kernel/bpf/core.c | 1 +
kernel/bpf/helpers.c | 45 ++++++++++
kernel/trace/bpf_trace.c | 2 +
scripts/bpf_helpers_doc.py | 1 +
tools/include/uapi/linux/bpf.h | 20 ++++-
.../bpf/prog_tests/ns_current_pid_tgid.c | 87 +++++++++++++++++++
.../bpf/progs/test_ns_current_pid_tgid.c | 37 ++++++++
11 files changed, 228 insertions(+), 2 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c
create mode 100644 tools/testing/selftests/bpf/progs/test_ns_current_pid_tgid.c
--
2.20.1
From: Carlos Neira <hidden> Date: 2019-10-22 19:18:08
ns_match returns true if the namespace inode and dev_t matches the ones
provided by the caller.
Signed-off-by: Carlos Neira <redacted>
---
fs/nsfs.c | 14 ++++++++++++++
include/linux/proc_ns.h | 2 ++
2 files changed, 16 insertions(+)
From: Carlos Neira <hidden> Date: 2019-10-22 19:18:11
New bpf helper bpf_get_ns_current_pid_tgid,
This helper will return pid and tgid from current task
which namespace matches dev_t and inode number provided,
this will allows us to instrument a process inside a container.
Signed-off-by: Carlos Neira <redacted>
---
include/linux/bpf.h | 1 +
include/uapi/linux/bpf.h | 20 +++++++++++++++++-
kernel/bpf/core.c | 1 +
kernel/bpf/helpers.c | 45 ++++++++++++++++++++++++++++++++++++++++
kernel/trace/bpf_trace.c | 2 ++
5 files changed, 68 insertions(+), 1 deletion(-)
@@ -2775,6 +2775,19 @@ union bpf_attr {*restrictedtoraw_tracepointbpfprograms.*Return*0onsuccess,oranegativeerrorincaseoffailure.+*+*intbpf_get_ns_current_pid_tgid(u64dev,u64ino,structbpf_pidns_info*nsdata,u32size)+*Description+*Returns0onsuccess,valuesfor*pid*and*tgid*asseenfromthecurrent+**namespace*willbereturnedin*nsdata*.+*+*Onfailure,thereturnedvalueisoneofthefollowing:+*+***-EINVAL**ifdevandinumsupplieddon'tmatchdev_tandinodenumber+*withnsfsofcurrenttask,orifdevconversiontodev_tlosthighbits.+*+***-ENOENT**ifpidnsdoesnotexistsforthecurrenttask.+**/#define __BPF_FUNC_MAPPER(FN) \FN(unspec),\
@@ -2888,7 +2901,8 @@ union bpf_attr {FN(sk_storage_delete),\FN(send_signal),\FN(tcp_gen_syncookie),\-FN(skb_output),+FN(skb_output),\+FN(get_ns_current_pid_tgid),/* integer value in 'imm' field of BPF_CALL instruction selects which helper*functioneBPFprogramintendstocall
@@ -2775,6 +2775,19 @@ union bpf_attr {*restrictedtoraw_tracepointbpfprograms.*Return*0onsuccess,oranegativeerrorincaseoffailure.+*+*intbpf_get_ns_current_pid_tgid(u64dev,u64ino,structbpf_pidns_info*nsdata,u32size)+*Description+*Returns0onsuccess,valuesfor*pid*and*tgid*asseenfromthecurrent+**namespace*willbereturnedin*nsdata*.+*+*Onfailure,thereturnedvalueisoneofthefollowing:+*+***-EINVAL**ifdevandinumsupplieddon'tmatchdev_tandinodenumber+*withnsfsofcurrenttask,orifdevconversiontodev_tlosthighbits.+*+***-ENOENT**ifpidnsdoesnotexistsforthecurrenttask.+**/#define __BPF_FUNC_MAPPER(FN) \FN(unspec),\
@@ -2888,7 +2901,8 @@ union bpf_attr {FN(sk_storage_delete),\FN(send_signal),\FN(tcp_gen_syncookie),\-FN(skb_output),+FN(skb_output),\+FN(get_ns_current_pid_tgid),/* integer value in 'imm' field of BPF_CALL instruction selects which helper*functioneBPFprogramintendstocall
@@ -0,0 +1,87 @@+// SPDX-License-Identifier: GPL-2.0+/* Copyright (c) 2019 Carlos Neira cneirabustos@gmail.com */+#include<test_progs.h>+#include<sys/stat.h>+#include<sys/types.h>+#include<unistd.h>+#include<sys/syscall.h>++structbss{+__u64dev;+__u64ino;+__u64pid_tgid;+__u64user_pid_tgid;+};++voidtest_ns_current_pid_tgid(void)+{+constchar*probe_name="raw_tracepoint/sys_enter";+constchar*file="test_ns_current_pid_tgid.o";+interr,key=0,duration=0;+structbpf_link*link=NULL;+structbpf_program*prog;+structbpf_map*bss_map;+structbpf_object*obj;+structbssbss;+structstatst;+__u64id;++obj=bpf_object__open_file(file,NULL);+if(CHECK(IS_ERR(obj),"obj_open","err %ld\n",PTR_ERR(obj)))+return;++err=bpf_object__load(obj);+if(CHECK(err,"obj_load","err %d errno %d\n",err,errno))+gotocleanup;++bss_map=bpf_object__find_map_by_name(obj,"test_ns_.bss");+if(CHECK(!bss_map,"find_bss_map","failed\n"))+gotocleanup;++prog=bpf_object__find_program_by_title(obj,probe_name);+if(CHECK(!prog,"find_prog","prog '%s' not found\n",+probe_name))+gotocleanup;++memset(&bss,0,sizeof(bss));+pid_ttid=syscall(SYS_gettid);+pid_tpid=getpid();++id=(__u64)tid<<32|pid;+bss.user_pid_tgid=id;++if(CHECK_FAIL(stat("/proc/self/ns/pid",&st))){+perror("Failed to stat /proc/self/ns/pid");+gotocleanup;+}++bss.dev=st.st_dev;+bss.ino=st.st_ino;++err=bpf_map_update_elem(bpf_map__fd(bss_map),&key,&bss,0);+if(CHECK(err,"setting_bss","failed to set bss : %d\n",err))+gotocleanup;++link=bpf_program__attach_raw_tracepoint(prog,"sys_enter");+if(CHECK(IS_ERR(link),"attach_raw_tp","err %ld\n",+PTR_ERR(link)))+gotocleanup;++/* trigger some syscalls */+usleep(1);++err=bpf_map_lookup_elem(bpf_map__fd(bss_map),&key,&bss);+if(CHECK(err,"set_bss","failed to get bss : %d\n",err))+gotocleanup;++if(CHECK(id!=bss.pid_tgid,"Compare user pid/tgid vs. bpf pid/tgid",+"User pid/tgid %llu EBPF pid/tgid %llu\n",id,bss.pid_tgid))+gotocleanup;+cleanup:++if(!IS_ERR_OR_NULL(link)){+bpf_link__destroy(link);+link=NULL;+}+bpf_object__close(obj);+}
From: Yonghong Song <hidden> Date: 2019-10-23 02:51:50
On 10/22/19 12:17 PM, Carlos Neira wrote:
New bpf helper bpf_get_ns_current_pid_tgid,
This helper will return pid and tgid from current task
which namespace matches dev_t and inode number provided,
this will allows us to instrument a process inside a container.
Signed-off-by: Carlos Neira <redacted>
@@ -2775,6 +2775,19 @@ union bpf_attr {*restrictedtoraw_tracepointbpfprograms.*Return*0onsuccess,oranegativeerrorincaseoffailure.+*+*intbpf_get_ns_current_pid_tgid(u64dev,u64ino,structbpf_pidns_info*nsdata,u32size)+*Description+*Returns0onsuccess,valuesfor*pid*and*tgid*asseenfromthecurrent+**namespace*willbereturnedin*nsdata*.+*+*Onfailure,thereturnedvalueisoneofthefollowing:+*+***-EINVAL**ifdevandinumsupplieddon'tmatchdev_tandinodenumber+*withnsfsofcurrenttask,orifdevconversiontodev_tlosthighbits.+*+***-ENOENT**ifpidnsdoesnotexistsforthecurrenttask.+**/#define __BPF_FUNC_MAPPER(FN) \FN(unspec),\
@@ -2888,7 +2901,8 @@ union bpf_attr {FN(sk_storage_delete),\FN(send_signal),\FN(tcp_gen_syncookie),\-FN(skb_output),+FN(skb_output),\+FN(get_ns_current_pid_tgid),/* integer value in 'imm' field of BPF_CALL instruction selects which helper*functioneBPFprogramintendstocall
@@ -2775,6 +2775,19 @@ union bpf_attr {*restrictedtoraw_tracepointbpfprograms.*Return*0onsuccess,oranegativeerrorincaseoffailure.+*+*intbpf_get_ns_current_pid_tgid(u64dev,u64ino,structbpf_pidns_info*nsdata,u32size)+*Description+*Returns0onsuccess,valuesfor*pid*and*tgid*asseenfromthecurrent+**namespace*willbereturnedin*nsdata*.+*+*Onfailure,thereturnedvalueisoneofthefollowing:+*+***-EINVAL**ifdevandinumsupplieddon'tmatchdev_tandinodenumber+*withnsfsofcurrenttask,orifdevconversiontodev_tlosthighbits.+*+***-ENOENT**ifpidnsdoesnotexistsforthecurrenttask.+**/#define __BPF_FUNC_MAPPER(FN) \FN(unspec),\
@@ -2888,7 +2901,8 @@ union bpf_attr {FN(sk_storage_delete),\FN(send_signal),\FN(tcp_gen_syncookie),\-FN(skb_output),+FN(skb_output),\+FN(get_ns_current_pid_tgid),/* integer value in 'imm' field of BPF_CALL instruction selects which helper*functioneBPFprogramintendstocall
@@ -0,0 +1,87 @@+// SPDX-License-Identifier: GPL-2.0+/* Copyright (c) 2019 Carlos Neira cneirabustos@gmail.com */+#include<test_progs.h>+#include<sys/stat.h>+#include<sys/types.h>+#include<unistd.h>+#include<sys/syscall.h>++structbss{+__u64dev;+__u64ino;+__u64pid_tgid;+__u64user_pid_tgid;+};++voidtest_ns_current_pid_tgid(void)+{+constchar*probe_name="raw_tracepoint/sys_enter";+constchar*file="test_ns_current_pid_tgid.o";+interr,key=0,duration=0;+structbpf_link*link=NULL;+structbpf_program*prog;+structbpf_map*bss_map;+structbpf_object*obj;+structbssbss;+structstatst;+__u64id;++obj=bpf_object__open_file(file,NULL);+if(CHECK(IS_ERR(obj),"obj_open","err %ld\n",PTR_ERR(obj)))+return;++err=bpf_object__load(obj);+if(CHECK(err,"obj_load","err %d errno %d\n",err,errno))+gotocleanup;++bss_map=bpf_object__find_map_by_name(obj,"test_ns_.bss");+if(CHECK(!bss_map,"find_bss_map","failed\n"))+gotocleanup;++prog=bpf_object__find_program_by_title(obj,probe_name);+if(CHECK(!prog,"find_prog","prog '%s' not found\n",+probe_name))+gotocleanup;++memset(&bss,0,sizeof(bss));+pid_ttid=syscall(SYS_gettid);+pid_tpid=getpid();++id=(__u64)tid<<32|pid;+bss.user_pid_tgid=id;++if(CHECK_FAIL(stat("/proc/self/ns/pid",&st))){+perror("Failed to stat /proc/self/ns/pid");+gotocleanup;+}++bss.dev=st.st_dev;+bss.ino=st.st_ino;++err=bpf_map_update_elem(bpf_map__fd(bss_map),&key,&bss,0);+if(CHECK(err,"setting_bss","failed to set bss : %d\n",err))+gotocleanup;++link=bpf_program__attach_raw_tracepoint(prog,"sys_enter");+if(CHECK(IS_ERR(link),"attach_raw_tp","err %ld\n",+PTR_ERR(link)))+gotocleanup;
You already have default link = NULL.
Here, I think you can do
link = NULL;
goto cleanup;
+
+ /* trigger some syscalls */
+ usleep(1);
+
+ err = bpf_map_lookup_elem(bpf_map__fd(bss_map), &key, &bss);
+ if (CHECK(err, "set_bss", "failed to get bss : %d\n", err))
+ goto cleanup;
+
+ if (CHECK(id != bss.pid_tgid, "Compare user pid/tgid vs. bpf pid/tgid",
+ "User pid/tgid %llu EBPF pid/tgid %llu\n", id, bss.pid_tgid))
EBPF -> BPF?
+ goto cleanup;
+cleanup:
+
The above empty line can be removed.
+ if (!IS_ERR_OR_NULL(link)) {
With the above suggested change, you only need to check
if (!link)
From: Yonghong Song <hidden> Date: 2019-10-23 03:05:08
Hi, Eric,
Could you take a look at this patch the series as well?
If it looks good, could you ack the patch #1?
Thanks!
On 10/22/19 12:17 PM, Carlos Neira wrote:
quoted hunk
ns_match returns true if the namespace inode and dev_t matches the ones
provided by the caller.
Signed-off-by: Carlos Neira <redacted>
---
fs/nsfs.c | 14 ++++++++++++++
include/linux/proc_ns.h | 2 ++
2 files changed, 16 insertions(+)
@@ -0,0 +1,87 @@+// SPDX-License-Identifier: GPL-2.0+/* Copyright (c) 2019 Carlos Neira cneirabustos@gmail.com */+#include<test_progs.h>+#include<sys/stat.h>+#include<sys/types.h>+#include<unistd.h>+#include<sys/syscall.h>++structbss{+__u64dev;+__u64ino;+__u64pid_tgid;+__u64user_pid_tgid;+};++voidtest_ns_current_pid_tgid(void)+{+constchar*probe_name="raw_tracepoint/sys_enter";+constchar*file="test_ns_current_pid_tgid.o";+interr,key=0,duration=0;+structbpf_link*link=NULL;+structbpf_program*prog;+structbpf_map*bss_map;+structbpf_object*obj;+structbssbss;+structstatst;+__u64id;++obj=bpf_object__open_file(file,NULL);+if(CHECK(IS_ERR(obj),"obj_open","err %ld\n",PTR_ERR(obj)))+return;++err=bpf_object__load(obj);+if(CHECK(err,"obj_load","err %d errno %d\n",err,errno))+gotocleanup;++bss_map=bpf_object__find_map_by_name(obj,"test_ns_.bss");+if(CHECK(!bss_map,"find_bss_map","failed\n"))+gotocleanup;++prog=bpf_object__find_program_by_title(obj,probe_name);+if(CHECK(!prog,"find_prog","prog '%s' not found\n",+probe_name))+gotocleanup;++memset(&bss,0,sizeof(bss));+pid_ttid=syscall(SYS_gettid);+pid_tpid=getpid();++id=(__u64)tid<<32|pid;+bss.user_pid_tgid=id;++if(CHECK_FAIL(stat("/proc/self/ns/pid",&st))){+perror("Failed to stat /proc/self/ns/pid");+gotocleanup;+}++bss.dev=st.st_dev;+bss.ino=st.st_ino;++err=bpf_map_update_elem(bpf_map__fd(bss_map),&key,&bss,0);+if(CHECK(err,"setting_bss","failed to set bss : %d\n",err))+gotocleanup;++link=bpf_program__attach_raw_tracepoint(prog,"sys_enter");+if(CHECK(IS_ERR(link),"attach_raw_tp","err %ld\n",+PTR_ERR(link)))+gotocleanup;
You already have default link = NULL.
Here, I think you can do
link = NULL;
goto cleanup;
quoted
+
+ /* trigger some syscalls */
+ usleep(1);
+
+ err = bpf_map_lookup_elem(bpf_map__fd(bss_map), &key, &bss);
+ if (CHECK(err, "set_bss", "failed to get bss : %d\n", err))
+ goto cleanup;
+
+ if (CHECK(id != bss.pid_tgid, "Compare user pid/tgid vs. bpf pid/tgid",
+ "User pid/tgid %llu EBPF pid/tgid %llu\n", id, bss.pid_tgid))
EBPF -> BPF?
quoted
+ goto cleanup;
+cleanup:
+
The above empty line can be removed.
quoted
+ if (!IS_ERR_OR_NULL(link)) {
With the above suggested change, you only need to check
if (!link)
The new helper does not require GPL, could you double check this?
The above _license should not be necessary.
Thanks, Yonghong.
Do I need to re-send the series of patches as v16 ? or I could reply to this thread addressing your comments for patch 4/5.
Thanks again for your support.
Bests
@@ -0,0 +1,87 @@+// SPDX-License-Identifier: GPL-2.0+/* Copyright (c) 2019 Carlos Neira cneirabustos@gmail.com */+#include<test_progs.h>+#include<sys/stat.h>+#include<sys/types.h>+#include<unistd.h>+#include<sys/syscall.h>++structbss{+__u64dev;+__u64ino;+__u64pid_tgid;+__u64user_pid_tgid;+};++voidtest_ns_current_pid_tgid(void)+{+constchar*probe_name="raw_tracepoint/sys_enter";+constchar*file="test_ns_current_pid_tgid.o";+interr,key=0,duration=0;+structbpf_link*link=NULL;+structbpf_program*prog;+structbpf_map*bss_map;+structbpf_object*obj;+structbssbss;+structstatst;+__u64id;++obj=bpf_object__open_file(file,NULL);+if(CHECK(IS_ERR(obj),"obj_open","err %ld\n",PTR_ERR(obj)))+return;++err=bpf_object__load(obj);+if(CHECK(err,"obj_load","err %d errno %d\n",err,errno))+gotocleanup;++bss_map=bpf_object__find_map_by_name(obj,"test_ns_.bss");+if(CHECK(!bss_map,"find_bss_map","failed\n"))+gotocleanup;++prog=bpf_object__find_program_by_title(obj,probe_name);+if(CHECK(!prog,"find_prog","prog '%s' not found\n",+probe_name))+gotocleanup;++memset(&bss,0,sizeof(bss));+pid_ttid=syscall(SYS_gettid);+pid_tpid=getpid();++id=(__u64)tid<<32|pid;+bss.user_pid_tgid=id;++if(CHECK_FAIL(stat("/proc/self/ns/pid",&st))){+perror("Failed to stat /proc/self/ns/pid");+gotocleanup;+}++bss.dev=st.st_dev;+bss.ino=st.st_ino;++err=bpf_map_update_elem(bpf_map__fd(bss_map),&key,&bss,0);+if(CHECK(err,"setting_bss","failed to set bss : %d\n",err))+gotocleanup;++link=bpf_program__attach_raw_tracepoint(prog,"sys_enter");+if(CHECK(IS_ERR(link),"attach_raw_tp","err %ld\n",+PTR_ERR(link)))+gotocleanup;
You already have default link = NULL.
Here, I think you can do
link = NULL;
goto cleanup;
quoted
+
+ /* trigger some syscalls */
+ usleep(1);
+
+ err = bpf_map_lookup_elem(bpf_map__fd(bss_map), &key, &bss);
+ if (CHECK(err, "set_bss", "failed to get bss : %d\n", err))
+ goto cleanup;
+
+ if (CHECK(id != bss.pid_tgid, "Compare user pid/tgid vs. bpf pid/tgid",
+ "User pid/tgid %llu EBPF pid/tgid %llu\n", id, bss.pid_tgid))
EBPF -> BPF?
quoted
+ goto cleanup;
+cleanup:
+
The above empty line can be removed.
quoted
+ if (!IS_ERR_OR_NULL(link)) {
With the above suggested change, you only need to check
if (!link)
From: Yonghong Song <hidden> Date: 2019-10-28 15:35:14
Ping again.
Eric, could you take a look at this patch and ack it if it is okay?
Thanks!
On 10/22/19 8:05 PM, Yonghong Song wrote:
Hi, Eric,
Could you take a look at this patch the series as well?
If it looks good, could you ack the patch #1?
Thanks!
On 10/22/19 12:17 PM, Carlos Neira wrote:
quoted
ns_match returns true if the namespace inode and dev_t matches the ones
provided by the caller.
Signed-off-by: Carlos Neira <redacted>
---
fs/nsfs.c | 14 ++++++++++++++
include/linux/proc_ns.h | 2 ++
2 files changed, 16 insertions(+)
From: Yonghong Song <hidden> Date: 2019-10-31 22:31:22
Eric,
In case that you missed the email, I added "[Review Request]"
and pinged again. It would be good if you can take a look
and ack if it looks good to you.
Thanks!
On 10/28/19 8:34 AM, Yonghong Song wrote:
Ping again.
Eric, could you take a look at this patch and ack it if it is okay?
Thanks!
On 10/22/19 8:05 PM, Yonghong Song wrote:
quoted
Hi, Eric,
Could you take a look at this patch the series as well?
If it looks good, could you ack the patch #1?
Thanks!
On 10/22/19 12:17 PM, Carlos Neira wrote:
quoted
ns_match returns true if the namespace inode and dev_t matches the ones
provided by the caller.
Signed-off-by: Carlos Neira <redacted>
---
fs/nsfs.c | 14 ++++++++++++++
include/linux/proc_ns.h | 2 ++
2 files changed, 16 insertions(+)
From: Yonghong Song <hidden> Date: 2019-11-12 15:18:31
Eric,
ping again. Any comment on this patch?
On 10/31/19 3:31 PM, Yonghong Song wrote:
Eric,
In case that you missed the email, I added "[Review Request]"
and pinged again. It would be good if you can take a look
and ack if it looks good to you.
Thanks!
On 10/28/19 8:34 AM, Yonghong Song wrote:
quoted
Ping again.
Eric, could you take a look at this patch and ack it if it is okay?
Thanks!
On 10/22/19 8:05 PM, Yonghong Song wrote:
quoted
Hi, Eric,
Could you take a look at this patch the series as well?
If it looks good, could you ack the patch #1?
Thanks!
On 10/22/19 12:17 PM, Carlos Neira wrote:
quoted
ns_match returns true if the namespace inode and dev_t matches the ones
provided by the caller.
Signed-off-by: Carlos Neira <redacted>
---
fs/nsfs.c | 14 ++++++++++++++
include/linux/proc_ns.h | 2 ++
2 files changed, 16 insertions(+)
return ERR_PTR(-EINVAL);
}
+/**
+ * ns_match() - Returns true if current namespace matches dev/ino
provided.
+ * @ns_common: current ns
+ * @dev: dev_t from nsfs that will be matched against current nsfs
+ * @ino: ino_t from nsfs that will be matched against current nsfs
+ *
+ * Return: true if dev and ino matches the current nsfs.
+ */
+bool ns_match(const struct ns_common *ns, dev_t dev, ino_t ino)
+{
+ return (ns->inum == ino) && (nsfs_mnt->mnt_sb->s_dev == dev);
+}
+
+
static int nsfs_show_path(struct seq_file *seq, struct dentry
*dentry)
{
struct inode *inode = d_inode(dentry);
From: Carlos Antonio Neira Bustos <hidden> Date: 2019-11-25 14:03:26
Yonghong,
I think the merge window has closed, should I resubmit these patches, or
wait for Eric's feedback ?
Bests
On Tue, Nov 12, 2019 at 03:18:20PM +0000, Yonghong Song wrote:
Eric,
ping again. Any comment on this patch?
On 10/31/19 3:31 PM, Yonghong Song wrote:
quoted
Eric,
In case that you missed the email, I added "[Review Request]"
and pinged again. It would be good if you can take a look
and ack if it looks good to you.
Thanks!
On 10/28/19 8:34 AM, Yonghong Song wrote:
quoted
Ping again.
Eric, could you take a look at this patch and ack it if it is okay?
Thanks!
On 10/22/19 8:05 PM, Yonghong Song wrote:
quoted
Hi, Eric,
Could you take a look at this patch the series as well?
If it looks good, could you ack the patch #1?
Thanks!
On 10/22/19 12:17 PM, Carlos Neira wrote:
quoted
ns_match returns true if the namespace inode and dev_t matches the ones
provided by the caller.
Signed-off-by: Carlos Neira <redacted>
---
fs/nsfs.c | 14 ++++++++++++++
include/linux/proc_ns.h | 2 ++
2 files changed, 16 insertions(+)
return ERR_PTR(-EINVAL);
}
+/**
+ * ns_match() - Returns true if current namespace matches dev/ino
provided.
+ * @ns_common: current ns
+ * @dev: dev_t from nsfs that will be matched against current nsfs
+ * @ino: ino_t from nsfs that will be matched against current nsfs
+ *
+ * Return: true if dev and ino matches the current nsfs.
+ */
+bool ns_match(const struct ns_common *ns, dev_t dev, ino_t ino)
+{
+ return (ns->inum == ino) && (nsfs_mnt->mnt_sb->s_dev == dev);
+}
+
+
static int nsfs_show_path(struct seq_file *seq, struct dentry
*dentry)
{
struct inode *inode = d_inode(dentry);