Re: [PATCH net-next 3/3] bpf: avoid stack copy and use skb ctx for event output

From: kbuild test robot
Date: Tue Jul 12 2016 - 19:27:00 EST


Hi,

[auto build test WARNING on net-next/master]

url: https://github.com/0day-ci/linux/commits/Daniel-Borkmann/BPF-event-output-helper-improvements/20160713-065944
config: s390-allyesconfig (attached as .config)
compiler: s390x-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=s390

All warnings (new ones prefixed by >>):

kernel/trace/bpf_trace.c: In function 'bpf_perf_event_output':
kernel/trace/bpf_trace.c:284:1: warning: 'bpf_perf_event_output' uses dynamic stack allocation
}
^
kernel/trace/bpf_trace.c: In function 'bpf_event_output':
>> kernel/trace/bpf_trace.c:319:1: warning: 'bpf_event_output' uses dynamic stack allocation
}
^

vim +/bpf_event_output +319 kernel/trace/bpf_trace.c

3644f5a9 Daniel Borkmann 2016-07-13 278 if (unlikely(flags & ~(BPF_F_INDEX_MASK)))
3644f5a9 Daniel Borkmann 2016-07-13 279 return -EINVAL;
3644f5a9 Daniel Borkmann 2016-07-13 280
3644f5a9 Daniel Borkmann 2016-07-13 281 return __bpf_perf_event_output((struct pt_regs *)(long) r1,
3644f5a9 Daniel Borkmann 2016-07-13 282 (struct bpf_map *)(long) r2,
3644f5a9 Daniel Borkmann 2016-07-13 283 flags, &raw);
3644f5a9 Daniel Borkmann 2016-07-13 @284 }
3644f5a9 Daniel Borkmann 2016-07-13 285
a43eec30 Alexei Starovoitov 2015-10-20 286 static const struct bpf_func_proto bpf_perf_event_output_proto = {
a43eec30 Alexei Starovoitov 2015-10-20 287 .func = bpf_perf_event_output,
1075ef59 Alexei Starovoitov 2015-10-23 288 .gpl_only = true,
a43eec30 Alexei Starovoitov 2015-10-20 289 .ret_type = RET_INTEGER,
a43eec30 Alexei Starovoitov 2015-10-20 290 .arg1_type = ARG_PTR_TO_CTX,
a43eec30 Alexei Starovoitov 2015-10-20 291 .arg2_type = ARG_CONST_MAP_PTR,
a43eec30 Alexei Starovoitov 2015-10-20 292 .arg3_type = ARG_ANYTHING,
a43eec30 Alexei Starovoitov 2015-10-20 293 .arg4_type = ARG_PTR_TO_STACK,
a43eec30 Alexei Starovoitov 2015-10-20 294 .arg5_type = ARG_CONST_STACK_SIZE,
a43eec30 Alexei Starovoitov 2015-10-20 295 };
a43eec30 Alexei Starovoitov 2015-10-20 296
bd570ff9 Daniel Borkmann 2016-04-18 297 static DEFINE_PER_CPU(struct pt_regs, bpf_pt_regs);
bd570ff9 Daniel Borkmann 2016-04-18 298
f428cc22 Daniel Borkmann 2016-07-13 299 u64 bpf_event_output(struct bpf_map *map, u64 flags, void *meta, u64 size_meta,
f428cc22 Daniel Borkmann 2016-07-13 300 void *ctx, u64 size_ctx,
f428cc22 Daniel Borkmann 2016-07-13 301 unsigned long (*ctx_copy_cb)(void *dst, const void *src,
f428cc22 Daniel Borkmann 2016-07-13 302 unsigned long n))
bd570ff9 Daniel Borkmann 2016-04-18 303 {
bd570ff9 Daniel Borkmann 2016-04-18 304 struct pt_regs *regs = this_cpu_ptr(&bpf_pt_regs);
f428cc22 Daniel Borkmann 2016-07-13 305 struct perf_raw_record_frag frag = {
f428cc22 Daniel Borkmann 2016-07-13 306 .data = ctx,
f428cc22 Daniel Borkmann 2016-07-13 307 .copy_cb = ctx_copy_cb,
f428cc22 Daniel Borkmann 2016-07-13 308 };
f428cc22 Daniel Borkmann 2016-07-13 309 struct perf_raw_record raw = {
f428cc22 Daniel Borkmann 2016-07-13 310 .size = size_meta + size_ctx,
f428cc22 Daniel Borkmann 2016-07-13 311 .size_head = size_meta,
f428cc22 Daniel Borkmann 2016-07-13 312 .data = meta,
f428cc22 Daniel Borkmann 2016-07-13 313 .frag = size_ctx ? &frag : NULL,
f428cc22 Daniel Borkmann 2016-07-13 314 };
bd570ff9 Daniel Borkmann 2016-04-18 315
bd570ff9 Daniel Borkmann 2016-04-18 316 perf_fetch_caller_regs(regs);
bd570ff9 Daniel Borkmann 2016-04-18 317
f428cc22 Daniel Borkmann 2016-07-13 318 return __bpf_perf_event_output(regs, map, flags, &raw);
bd570ff9 Daniel Borkmann 2016-04-18 @319 }
bd570ff9 Daniel Borkmann 2016-04-18 320
606274c5 Alexei Starovoitov 2016-07-06 321 static u64 bpf_get_current_task(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5)
606274c5 Alexei Starovoitov 2016-07-06 322 {

:::::: The code at line 319 was first introduced by commit
:::::: bd570ff970a54df653b48ed0cfb373f2ebed083d bpf: add event output helper for notifications/sampling/logging

:::::: TO: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: Binary data