Re: agenda: IO Visor TSC/Dev Meeting
alessandro.gario@...
Hello Brenden!
toggle quoted messageShow quoted text
I’m not sure if it counts as an agenda item, but I’m interested in recording process events using tracepoints, and I would like to know what are the best practices when attempting to do so. Due to project goals (endpoint monitoring) one of the requirements is to avoid losing any event data. It is probably not a surprise given the limits imposed by the verifier, but I’m having trouble with variadic functions and long strings. The following are some events I would like to capture with reasonable success: String padding, causing the string I need to be truncated: bash -c “<padding whitespace> /bin/rm -rf /home” Argument padding, causing the BPF program to not reach the last elements: sudo bash --verbose --verbose .. --verbose -c ‘printf “SELINUX=disabled\nSELINUXTYPE=targeted\n” > /etc/selinux/config’ I thought about trying to (tail?) call additional BPF programs to work around the second issue, but I’m not sure how to proceed with the first one. Thanks! Alessandro Gario
On Mon, 2019-08-05 at 20:55 -0700, Brenden Blanco wrote:
Hi All,
|
|
Re: sockmap redirect doesn't work all the time
Forrest Chen
Hi Ferenc, I think sock_ops is a good option for me, it seems the cilium project also use this to accelerate networks. All of your curl request successfully establish his TCP connection? If there are some connection reset failure, maybe you could increase net.somaxconn and the backlog size of the listener socket.Yes, all TCP connection established. There're no connection pressures and I send curl requests manually. Thanks, Forrest chen
|
|
agenda: IO Visor TSC/Dev Meeting
Brenden Blanco
Hi All,
We have the bi-weekly phone conference scheduled for two days from now, does anybody have a discussion topic to add to the agenda? As a reminder, we are planning to hold the meeting only if agenda items are proposed. Cheers, Brenden
|
|
Re: [PATCHv5 RFC 1/3] BPF: New helper to obtainnamespace data from current task.
Yonghong Song
On Mon, Aug 5, 2019 at 2:19 PM carlos antonio neira bustos
<cneirabustos@...> wrote: looks good. A couple of comments below. reverse Christmas order. Looks like -EINVAL is returned for all error cases. This is suboptimal. There are cases where other error code should be returned. +directly return -EINVAL. Not 100% sure whether pidns/pid/tgid can go wrong. During process exit? You can keep it now. Need more study or other people can comment on this. We should return the error code "ret" instead of -EINVAL. pidns_info is not NULL, guaranteed by the verifier, so "if (pidns_info)" can be removed. It should be memset((void *)pidns_info, ...) Accidentally zeroing pidns may cause kernel errors (not sure whether it is related below fault or not). After making the above suggested changes, you can directly send the patch set to the upstream. Please cc me at yhs@....
|
|
Re: [PATCHv5 RFC 1/3] BPF: New helper to obtainnamespace data from current task.
Hi Yonghong,
I had time yesterday to finish the code to avoid using getname_kernel , self-tests run ok with expected results. Here is the current code to avoid the getname_kernel call.
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c index 5e28718928ca..bfb2bbf37a58 100644 --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c @@ -11,6 +11,12 @@ #include <linux/uidgid.h> #include <linux/filter.h> #include <linux/ctype.h> +#include <linux/pid_namespace.h> +#include <linux/major.h> +#include <linux/stat.h> +#include <linux/namei.h> +#include <linux/version.h> +
#include "../../lib/kstrtox.h"
@@ -312,6 +318,81 @@ void copy_map_value_locked(struct bpf_map *map, void *dst, void *src, preempt_enable(); }
+BPF_CALL_2(bpf_get_current_pidns_info, struct bpf_pidns_info *, pidns_info, u32, + size) +{ + const char* name = "/proc/self/ns/pid"; + struct pid_namespace *pidns = NULL; + int len = strlen(name) + 1; + struct filename *tmp = NULL; + struct inode *inode; + struct path kp; + pid_t tgid = 0; + pid_t pid = 0; + int ret; + + + if (unlikely(size != sizeof(struct bpf_pidns_info))) + goto clear; + + pidns = task_active_pid_ns(current); + + if (unlikely(!pidns)) + goto clear; + + pidns_info->nsid = pidns->ns.inum; + pid = task_pid_nr_ns(current, pidns); + + if (unlikely(!pid)) + goto clear; + + tgid = task_tgid_nr_ns(current, pidns); + + if (unlikely(!tgid)) + goto clear; + + pidns_info->tgid = (u32) tgid; + pidns_info->pid = (u32) pid; + + if(!names_cachep) + goto clear; + + tmp = kmem_cache_alloc(names_cachep, GFP_ATOMIC); + if (unlikely(!tmp)) { + goto clear; + } + + memcpy((char *)tmp->name, name, len); + tmp->uptr = NULL; + tmp->aname = NULL; + tmp->refcnt = 1; + + ret = filename_lookup(AT_FDCWD, tmp, 0, &kp, NULL); + + if (ret) + goto clear; + + + inode = d_backing_inode(kp.dentry); + pidns_info->dev = inode->i_sb->s_dev; + + return 0; + + clear: + if (pidns_info) + memset((void *)pidns, 0, (size_t) size); + + return -EINVAL; +} + +const struct bpf_func_proto bpf_get_current_pidns_info_proto = { + .func = bpf_get_current_pidns_info, + .gpl_only = false, + .ret_type = RET_INTEGER, + .arg1_type = ARG_PTR_TO_UNINIT_MEM, + .arg2_type = ARG_CONST_SIZE, +}; + #ifdef CONFIG_CGROUPS BPF_CALL_0(bpf_get_current_cgroup_id) {
Now the problem I’m facing is that after running the sample code to call the helper, I’m seeing this once but then it’s never repeated running in later runs of the same sample code.
[ 75.097213] CPU: 0 PID: 1382 Comm: bash Not tainted 5.3.0-rc1patch12-00120-g5d8525007580-dirty #7 [ 75.097213] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 04/13/2018 [ 75.097215] RIP: 0010:idr_alloc_u32+0xa8/0xc0 [ 75.097216] Code: 31 d2 48 89 e6 48 89 ef e8 e5 54 00 00 31 c0 48 8b 7c 24 20 65 48 33 3c 25 28 00 00 00 75 1a 48 83 c4 28 5b 5d 41 5c 41 5d c3 <0f> 0b 0d 04 00 80 00 89 47 04 e9 78 ff ff ff e8 14 ed 93 ff 0f 1f [ 75.097216] RSP: 0018:ffffac39007c7d08 EFLAGS: 00010046 [ 75.097217] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 000000000001ffff [ 75.097218] RDX: ffffac39007c7d5c RSI: 0000000000000d99 RDI: ffffffffbea46b88 [ 75.097218] RBP: ffffffffbea46b88 R08: 0000000000000a20 R09: 0000000000000000 [ 75.097218] R10: 0000000001200000 R11: 0000000000000000 R12: 0000000000000000 [ 75.097219] R13: ffffac39007c7d5c R14: 000000000000012c R15: ffffffffbea46b80 [ 75.097219] FS: 00007f7ba7691b40(0000) GS:ffffa0fef5c00000(0000) knlGS:0000000000000000 [ 75.097220] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 75.097220] CR2: 00000000022eea64 CR3: 000000022f498004 CR4: 00000000003606f0 [ 75.097246] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 75.097246] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 75.097247] Call Trace: [ 75.097251] ? kmem_cache_alloc+0x161/0x600 [ 75.097252] idr_alloc_cyclic+0x53/0xb0 [ 75.097254] alloc_pid+0xc1/0x2a0 [ 75.097255] copy_process+0xdc4/0x1c20 [ 75.097256] _do_fork+0x74/0x360 [ 75.097257] ? recalc_sigpending+0x17/0x50 [ 75.097258] __x64_sys_clone+0x7f/0xa0 [ 75.097260] do_syscall_64+0x55/0x130 [ 75.097261] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 75.097263] RIP: 0033:0x7f7ba6d6538b [ 75.097264] Code: db 45 85 f6 0f 85 95 01 00 00 64 4c 8b 04 25 10 00 00 00 31 d2 4d 8d 90 d0 02 00 00 31 f6 bf 11 00 20 01 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 0f 87 de 00 00 00 85 c0 41 89 c5 0f 85 e5 00 00 [ 75.097265] RSP: 002b:00007ffc9a6cf180 EFLAGS: 00000246 ORIG_RAX: 0000000000000038 [ 75.097265] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f7ba6d6538b [ 75.097266] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011 [ 75.097266] RBP: 00007ffc9a6cf1b0 R08: 00007f7ba7691b40 R09: 0000000000000002 [ 75.097266] R10: 00007f7ba7691e10 R11: 0000000000000246 R12: 0000000000000000 [ 75.097267] R13: 00000000004cd15e R14: 0000000000000000 R15: 0000000000000000 [ 75.097268] ---[ end trace 2937ef4d051e39cd ]---
I need a couple of days to debug this and then submit the patch if nobody finds anything odd in the code. I hope tomorrow I’ll have good news on this if nobody finds anything odd in the code first.
Bests
From: Y Song
Sent: 05 August 2019 16:16 To: carlos antonio neira bustos Cc: Alexei Starovoitov; Tom Herbert via iovisor-dev; Eric Biederman Subject: Re: [iovisor-dev][PATCHv5 RFC 1/3] BPF: New helper to obtainnamespace data from current task.
Carlos,
Any update on this? It would be good to submit the patch earlier for a release cycle so we got a chance it may be accepted in the current release cycle.
On Fri, Jul 26, 2019 at 3:41 AM carlos antonio neira bustos <cneirabustos@...> wrote: > > Thanks Yonghong!. > Yes, I was looking at filename_lookup today on how to do it, I'll work on that. > Thank you very much. > > > El vie., 26 de jul. de 2019 01:18, Yonghong Song <ys114321@...> escribió: >> >> On Thu, Jul 25, 2019 at 12:11 PM Alexei Starovoitov >> <alexei.starovoitov@...> wrote: >> > >> > On Thu, Jul 25, 2019 at 11:53 AM neirac <cneirabustos@...> wrote: >> > > >> > > Hey Yonghong, >> > > I have changed getname_kernel interface to specify the allocation type, >> > > all previous callers preserve GFP_KERNEL as the allocation type, after this change >> > > getname_kernel could be used with GFP_ATOMIC in ebpf helpers. >> > > If this change goes in, I could complete bpf_get_current_pidns_info helper. >> > > Let me know your thoughts. >> > >> > please figure out how to get pidns_info w/o calling into getname_kernel(). >> >> Looks like we can call filename_lookup() directly. We do not need to >> call getname_kernel(). >> We know the exact path name. We can do a atomic allocation inside the helper. >> Carlos, could you take a look along this line? In this way, we do not >> need to change >> any files under linux/fs. >> >> >>
|
|
Re: [PATCHv5 RFC 1/3] BPF: New helper to obtain namespace data from current task.
Yonghong Song
Carlos,
Any update on this? It would be good to submit the patch earlier for a release cycle so we got a chance it may be accepted in the current release cycle. On Fri, Jul 26, 2019 at 3:41 AM carlos antonio neira bustos <cneirabustos@...> wrote:
|
|
Re: sockmap redirect doesn't work all the time
Ferenc Fejes
Hi!
Well it seems like a different problem from what I first thought. I have a few idea, maybe some of them helps: 1. If you able to modify the source code of user space receiver program, maybe try to avoid the user space receive right after the connection. This is ugly, but I think that would solve the problem: TCP backlog will store your packets until the sockmap code will redirect them to the right socket. 2. You can use BPF sock_ops for placing the new sockets to the sockmap before they receive the first packet. The problem with that you will need to put your application into a cgroup v2 to catch TCP state events. Also, on Ubuntu, you should disable net_cls,net_prio, because that would overwrite the cgroup BPF program of the sockets (see: https://stackoverflow.com/questions/55646983/why-does-my-bpf-prog-type-cgroup-skb-program-not-work-in-a-container) 3. I encountered very similar problem in my sockmap accelerated shadowsocks fork (https://github.com/SPYFF/shadowsocks-libev-nocrypto/tree/ebpf attaching sockmap right after the connection established but before the first packet) and as far as I remember I still able to count all the packets in the BPF program. So in my case the issue was different. All of your curl request successfully establish his TCP connection? If there are some connection reset failure, maybe you could increase net.somaxconn and the backlog size of the listener socket. I hope some of them might be help. Good luck, Ferenc
|
|
Re: AF_XDP query
William Tu
On Fri, Aug 2, 2019 at 3:23 AM Bjorn Topel <bjorn.topel@...> wrote:
Hi Kanthi, In the case of OVS AF_XDP netdev, we've used multiple PMD threads. Each thread has its own AF_XDP socket and its own UMEM bind to each rx queue. I think multiple processes should also work. William
|
|
Re: AF_XDP query
Bjorn Topel
On Tue, 30 Jul 2019 at 22:25, Kanthi P <Pavuluri.kanthi@...> wrote:
Hi Kanthi, Yes, it's possible! Björn Thanks,
|
|
Re: the size of BPF_MAP_TYPE_PERCPU_ARRAY doesn't match the number of CPU
Forrest Chen
On Thu, Aug 1, 2019 at 07:16 PM, Yonghong Song wrote:
I guess you mean value size. here.Thank you, Yonghong Song
|
|
Re: the size of BPF_MAP_TYPE_PERCPU_ARRAY doesn't match the number of CPU
Yonghong Song
On Thu, Aug 1, 2019 at 7:02 PM <forrest0579@...> wrote:
For array map, the key type must be 32bit int. ``` int array_map_alloc_check(union bpf_attr *attr) { bool percpu = attr->map_type == BPF_MAP_TYPE_PERCPU_ARRAY; int numa_node = bpf_map_attr_numa_node(attr); /* check sanity of attributes */ if (attr->max_entries == 0 || attr->key_size != 4 || attr->value_size == 0 || attr->map_flags & ~ARRAY_CREATE_FLAG_MASK || !bpf_map_flags_access_ok(attr->map_flags) || (percpu && numa_node != NUMA_NO_NODE)) return -EINVAL; if (attr->value_size > KMALLOC_MAX_SIZE) /* if value_size is bigger, the user space won't be able to * access the elements. */ return -E2BIG; return 0; } ``` I guess you mean value size. here. When you got the values from kernel, the value size is rounded to 8. See https://github.com/torvalds/linux/blob/master/kernel/bpf/arraymap.c#L81 So if you use 64bit value size, you will get correct value. If you use 32bit value size, you should iterate through with int64_t size, but only read the first 4 bytes for each iteration.
|
|
Re: the size of BPF_MAP_TYPE_PERCPU_ARRAY doesn't match the number of CPU
Forrest Chen
map defined: userspace code: Hi Yonghong Song, The code is as above. When I use 32bit key, the count result is in CPU 0 and 2, when I use 64bit key, the result is in CPU 0 and 1 as expect. Thanks forrest chen
|
|
Re: the size of BPF_MAP_TYPE_PERCPU_ARRAY doesn't match the number of CPU
Yonghong Song
On Wed, Jul 31, 2019 at 1:34 AM <forrest0579@...> wrote:
Could you post how to reproduce the issue so people can help? If you do provide reproducible steps, could you submit an issue to help tracking? Thanks,
|
|
the size of BPF_MAP_TYPE_PERCPU_ARRAY doesn't match the number of CPU
Forrest Chen
Hi all,
I define a BPF_MAP_TYPE_PERCPU_ARRAY and use it to count packets in the xdp program. When I read the map from userspace program, I find that the entry number doesn't match local CPU numbers. I have 2 CPUs in my VM, but the count result appear in index 0 and 2, my expectation is index 0 and 1. So why the counting result always appear in index 0 and 2 (or CPU 0 and 2), even when my VM only have 2 cores. Does it because I run the program in VM? Thanks, forrest chen
|
|
AF_XDP query
Kanthi P <Pavuluri.kanthi@...>
Hi, Is it possible to have 2 processes each with its own AF_XDP socket and its own UMEM? Thanks, Kanthi
|
|
Re: sockmap redirect doesn't work all the time
Forrest Chen
Hi Ferenc:
The packets are really small, I just send a curl get request. Sometimes I can receive the packets from my program, I think it is because the packets arrive before I set the socket desc so the bpf program doesn't work for that and I have to handle these packets in userspace.
|
|
Re: [PATCHv5 RFC 1/3] BPF: New helper to obtain namespace data from current task.
Thanks Yonghong!. Yes, I was looking at filename_lookup today on how to do it, I'll work on that. Thank you very much.
El vie., 26 de jul. de 2019 01:18, Yonghong Song <ys114321@...> escribió: On Thu, Jul 25, 2019 at 12:11 PM Alexei Starovoitov
|
|
Re: [PATCHv5 RFC 1/3] BPF: New helper to obtain namespace data from current task.
Yonghong Song
On Thu, Jul 25, 2019 at 12:11 PM Alexei Starovoitov
<alexei.starovoitov@...> wrote: Looks like we can call filename_lookup() directly. We do not need to call getname_kernel(). We know the exact path name. We can do a atomic allocation inside the helper. Carlos, could you take a look along this line? In this way, we do not need to change any files under linux/fs.
|
|
Re: [PATCHv5 RFC 1/3] BPF: New helper to obtain namespace data from current task.
Alexei Starovoitov
On Thu, Jul 25, 2019 at 11:53 AM neirac <cneirabustos@...> wrote:
please figure out how to get pidns_info w/o calling into getname_kernel().
|
|
Re: [PATCHv5 RFC 1/3] BPF: New helper to obtain namespace data from current task.
Hey Yonghong,
toggle quoted messageShow quoted text
I have changed getname_kernel interface to specify the allocation type, all previous callers preserve GFP_KERNEL as the allocation type, after this change getname_kernel could be used with GFP_ATOMIC in ebpf helpers. If this change goes in, I could complete bpf_get_current_pidns_info helper. Let me know your thoughts. From dad6b281a744afb88660137a6a5f27057a72d7d5 Mon Sep 17 00:00:00 2001 From: Carlos <cneirabustos@...> Date: Mon, 22 Jul 2019 17:50:02 -0400 Subject: [PATCH] [bpf-next 1/1] BPF: getname_kernel specify allocation type A parameter to specify the allocation type has been added to getname_kernel, as currently all allocations done with getname_kernel could sleep, the reason for this change is that currently ebpf cannot call functions that could sleep and future work will need to call getname_kernel that currently could sleep on allocation. This change preserves the GFP_KERNEL allocation type on all existing code that calls getname_kernel. --- fs/coredump.c | 2 +- fs/exec.c | 2 +- fs/fs_parser.c | 2 +- fs/namei.c | 23 ++++++++++++++--------- fs/open.c | 2 +- include/linux/fs.h | 2 +- init/main.c | 2 +- kernel/umh.c | 2 +- 8 files changed, 21 insertions(+), 16 deletions(-) diff --git a/fs/coredump.c b/fs/coredump.c index e42e17e55bfd..5c43a32f7ba2 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -684,7 +684,7 @@ void do_coredump(const kernel_siginfo_t *siginfo) * If it doesn't exist, that's fine. If there's some * other problem, we'll catch it at the filp_open(). */ - do_unlinkat(AT_FDCWD, getname_kernel(cn.corename)); + do_unlinkat(AT_FDCWD, getname_kernel(cn.corename, GFP_KERNEL)); } /* diff --git a/fs/exec.c b/fs/exec.c index c71cbfe6826a..3811afb37d9a 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -882,7 +882,7 @@ static struct file *do_open_execat(int fd, struct filename *name, int flags) struct file *open_exec(const char *name) { - struct filename *filename = getname_kernel(name); + struct filename *filename = getname_kernel(name, GFP_KERNEL); struct file *f = ERR_CAST(filename); if (!IS_ERR(filename)) { diff --git a/fs/fs_parser.c b/fs/fs_parser.c index 0d388faa25d1..2a8f27cbbf39 100644 --- a/fs/fs_parser.c +++ b/fs/fs_parser.c @@ -248,7 +248,7 @@ int fs_lookup_param(struct fs_context *fc, switch (param->type) { case fs_value_is_string: - f = getname_kernel(param->string); + f = getname_kernel(param->string, GFP_KERNEL); if (IS_ERR(f)) return PTR_ERR(f); put_f = true; diff --git a/fs/namei.c b/fs/namei.c index 209c51a5226c..0e0a9710bdfe 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -122,6 +122,11 @@ * PATH_MAX includes the nul terminator --RR. */ +/* [July 2019 neirac] getname_kernel added allocation type parameter as + * currently all allocations on getname_kernel could sleep, but ebpf + * needs non blocking allocations. + */ + #define EMBEDDED_NAME_MAX (PATH_MAX - offsetof(struct filename, iname)) struct filename * @@ -210,12 +215,12 @@ getname(const char __user * filename) } struct filename * -getname_kernel(const char * filename) +getname_kernel(const char * filename, gfp_t flags) { struct filename *result; int len = strlen(filename) + 1; - result = __getname(); + result = kmem_cache_alloc(names_cachep, flags); if (unlikely(!result)) return ERR_PTR(-ENOMEM); @@ -225,7 +230,7 @@ getname_kernel(const char * filename) const size_t size = offsetof(struct filename, iname[1]); struct filename *tmp; - tmp = kmalloc(size, GFP_KERNEL); + tmp = kmalloc(size, flags); if (unlikely(!tmp)) { __putname(result); return ERR_PTR(-ENOMEM); @@ -2408,7 +2413,7 @@ struct dentry *kern_path_locked(const char *name, struct path *path) struct qstr last; int type; - filename = filename_parentat(AT_FDCWD, getname_kernel(name), 0, path, + filename = filename_parentat(AT_FDCWD, getname_kernel(name, GFP_KERNEL), 0, path, &last, &type); if (IS_ERR(filename)) return ERR_CAST(filename); @@ -2429,7 +2434,7 @@ struct dentry *kern_path_locked(const char *name, struct path *path) int kern_path(const char *name, unsigned int flags, struct path *path) { - return filename_lookup(AT_FDCWD, getname_kernel(name), + return filename_lookup(AT_FDCWD, getname_kernel(name, GFP_KERNEL), flags, path, NULL); } EXPORT_SYMBOL(kern_path); @@ -2448,7 +2453,7 @@ int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, { struct path root = {.mnt = mnt, .dentry = dentry}; /* the first argument of filename_lookup() is ignored with root */ - return filename_lookup(AT_FDCWD, getname_kernel(name), + return filename_lookup(AT_FDCWD, getname_kernel(name, GFP_KERNEL), flags , path, &root); } EXPORT_SYMBOL(vfs_path_lookup); @@ -2749,7 +2754,7 @@ int kern_path_mountpoint(int dfd, const char *name, struct path *path, unsigned int flags) { - return filename_mountpoint(dfd, getname_kernel(name), path, flags); + return filename_mountpoint(dfd, getname_kernel(name, GFP_KERNEL), path, flags); } EXPORT_SYMBOL(kern_path_mountpoint); @@ -3583,7 +3588,7 @@ struct file *do_file_open_root(struct dentry *dentry, struct vfsmount *mnt, if (d_is_symlink(dentry) && op->intent & LOOKUP_OPEN) return ERR_PTR(-ELOOP); - filename = getname_kernel(name); + filename = getname_kernel(name, GFP_KERNEL); if (IS_ERR(filename)) return ERR_CAST(filename); @@ -3672,7 +3677,7 @@ static struct dentry *filename_create(int dfd, struct filename *name, struct dentry *kern_path_create(int dfd, const char *pathname, struct path *path, unsigned int lookup_flags) { - return filename_create(dfd, getname_kernel(pathname), + return filename_create(dfd, getname_kernel(pathname, GFP_KERNEL), path, lookup_flags); } EXPORT_SYMBOL(kern_path_create); diff --git a/fs/open.c b/fs/open.c index b5b80469b93d..cc0e23a605f3 100644 --- a/fs/open.c +++ b/fs/open.c @@ -1030,7 +1030,7 @@ struct file *file_open_name(struct filename *name, int flags, umode_t mode) */ struct file *filp_open(const char *filename, int flags, umode_t mode) { - struct filename *name = getname_kernel(filename); + struct filename *name = getname_kernel(filename, GFP_KERNEL); struct file *file = ERR_CAST(name); if (!IS_ERR(name)) { diff --git a/include/linux/fs.h b/include/linux/fs.h index 75f2ed289a3f..826ab644f9bf 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2532,7 +2532,7 @@ extern int filp_close(struct file *, fl_owner_t id); extern struct filename *getname_flags(const char __user *, int, int *); extern struct filename *getname(const char __user *); -extern struct filename *getname_kernel(const char *); +extern struct filename *getname_kernel(const char *, gfp_t flags); extern void putname(struct filename *name); extern int finish_open(struct file *file, struct dentry *dentry, diff --git a/init/main.c b/init/main.c index ff5803b0841c..29972a5a0ebc 100644 --- a/init/main.c +++ b/init/main.c @@ -1046,7 +1046,7 @@ static int run_init_process(const char *init_filename) { argv_init[0] = init_filename; pr_info("Run %s as init process\n", init_filename); - return do_execve(getname_kernel(init_filename), + return do_execve(getname_kernel(init_filename, GFP_KERNEL), (const char __user *const __user *)argv_init, (const char __user *const __user *)envp_init); } diff --git a/kernel/umh.c b/kernel/umh.c index 7f255b5a8845..f99e08fc327c 100644 --- a/kernel/umh.c +++ b/kernel/umh.c @@ -109,7 +109,7 @@ static int call_usermodehelper_exec_async(void *data) if (!retval) current->flags |= PF_UMH; } else - retval = do_execve(getname_kernel(sub_info->path), + retval = do_execve(getname_kernel(sub_info->path, GFP_KERNEL), (const char __user *const __user *)sub_info->argv, (const char __user *const __user *)sub_info->envp); out: -- 2.11.0
On Tue, Jul 23, 2019 at 12:55:37PM -0400, Carlos Antonio Neira Bustos wrote:
Yonghong,
|
|