lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Sun, 5 Sep 2021 07:02:48 +0800
From:   kernel test robot <lkp@...el.com>
To:     Cong Wang <xiyou.wangcong@...il.com>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: [congwang:sch_bpf 2/3] net/sched/sch_bpf.c:185:21: error: called
 object type 'int' is not a function or function pointer

tree:   https://github.com/congwang/linux.git sch_bpf
head:   f680855badd6d78b73490b5785ed3de5d68bf26b
commit: ac00415a225e3cbd2c3a7fd5f38dacdfadfcc1ac [2/3] net_sched: introduce eBPF based Qdisc
config: hexagon-buildonly-randconfig-r004-20210905 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 6fe2beba7d2a41964af658c8c59dd172683ef739)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/congwang/linux/commit/ac00415a225e3cbd2c3a7fd5f38dacdfadfcc1ac
        git remote add congwang https://github.com/congwang/linux.git
        git fetch --no-tags congwang sch_bpf
        git checkout ac00415a225e3cbd2c3a7fd5f38dacdfadfcc1ac
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=hexagon SHELL=/bin/bash net/sched/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All error/warnings (new ones prefixed by >>):

>> net/sched/sch_bpf.c:144:6: warning: variable 'cl' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (result  >= 0) {
               ^~~~~~~~~~~~
   net/sched/sch_bpf.c:164:9: note: uninitialized use occurs here
           return cl;
                  ^~
   net/sched/sch_bpf.c:144:2: note: remove the 'if' if its condition is always true
           if (result  >= 0) {
           ^~~~~~~~~~~~~~~~~~
   net/sched/sch_bpf.c:134:26: note: initialize the variable 'cl' to silence this warning
           struct sch_bpf_class *cl;
                                   ^
                                    = NULL
>> net/sched/sch_bpf.c:185:21: error: called object type 'int' is not a function or function pointer
                   res = BPF_PROG_RUN(enqueue, &ctx);
                         ~~~~~~~~~~~~^
   net/sched/sch_bpf.c:254:20: error: called object type 'int' is not a function or function pointer
           res = BPF_PROG_RUN(dequeue, &ctx);
                 ~~~~~~~~~~~~^
>> net/sched/sch_bpf.c:256:10: error: incompatible pointer types returning 'struct __sk_buff *' from a function with result type 'struct sk_buff *' [-Werror,-Wincompatible-pointer-types]
                   return ctx.skb;
                          ^~~~~~~
   net/sched/sch_bpf.c:525:24: warning: unused variable 'q' [-Wunused-variable]
           struct sch_bpf_qdisc *q = qdisc_priv(sch);
                                 ^
   2 warnings and 3 errors generated.


vim +/int +185 net/sched/sch_bpf.c

   130	
   131	static struct sch_bpf_class *sch_bpf_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
   132	{
   133		struct sch_bpf_qdisc *q = qdisc_priv(sch);
   134		struct sch_bpf_class *cl;
   135		struct tcf_proto *tcf;
   136		struct tcf_result res;
   137		int result;
   138	
   139		tcf = rcu_dereference_bh(q->filter_list);
   140		if (!tcf)
   141			return NULL;
   142		*qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
   143		result = tcf_classify(skb, NULL, tcf, &res, false);
 > 144		if (result  >= 0) {
   145	#ifdef CONFIG_NET_CLS_ACT
   146			switch (result) {
   147			case TC_ACT_QUEUED:
   148			case TC_ACT_STOLEN:
   149			case TC_ACT_TRAP:
   150				*qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
   151				fallthrough;
   152			case TC_ACT_SHOT:
   153				return NULL;
   154			}
   155	#endif
   156			cl = (void *)res.class;
   157			if (!cl) {
   158				cl = sch_bpf_find(sch, res.classid);
   159				if (!cl)
   160					return NULL;
   161			}
   162		}
   163	
   164		return cl;
   165	}
   166	
   167	static int sch_bpf_enqueue(struct sk_buff *skb, struct Qdisc *sch,
   168				   struct sk_buff **to_free)
   169	{
   170		struct sch_bpf_qdisc *q = qdisc_priv(sch);
   171		unsigned int len = qdisc_pkt_len(skb);
   172		struct sch_bpf_ctx ctx = {};
   173		struct sch_bpf_class *cl;
   174		int res = NET_XMIT_SUCCESS;
   175	
   176		cl = sch_bpf_classify(skb, sch, &res);
   177		if (!cl) {
   178			struct bpf_prog *enqueue;
   179	
   180			enqueue = rcu_dereference(q->enqueue_prog.prog);
   181			bpf_compute_data_pointers(skb);
   182	
   183			ctx.skb = (struct __sk_buff *)skb;
   184			ctx.nr_flows = q->clhash.hashelems;
 > 185			res = BPF_PROG_RUN(enqueue, &ctx);
   186			if (q->direct)
   187				return res;
   188			switch (res) {
   189			case SCH_BPF_DROP:
   190				__qdisc_drop(skb, to_free);
   191				return NET_XMIT_DROP;
   192			}
   193			cl = sch_bpf_find(sch, ctx.classid);
   194			if (!cl) {
   195				if (res & __NET_XMIT_BYPASS)
   196					qdisc_qstats_drop(sch);
   197				__qdisc_drop(skb, to_free);
   198				return res;
   199			}
   200		}
   201	
   202		if (cl->qdisc) {
   203			res = qdisc_enqueue(skb, cl->qdisc, to_free);
   204			if (res != NET_XMIT_SUCCESS) {
   205				if (net_xmit_drop_count(res)) {
   206					qdisc_qstats_drop(sch);
   207					cl->drops++;
   208				}
   209				return res;
   210			}
   211		} else {
   212			sch_bpf_skb_cb(skb)->rank = ctx.rank;
   213			pq_push(&cl->pq, &skb->pqnode);
   214		}
   215	
   216		sch->qstats.backlog += len;
   217		sch->q.qlen++;
   218		return res;
   219	}
   220	
   221	static struct sk_buff *sch_bpf_dequeue(struct Qdisc *sch)
   222	{
   223		struct sch_bpf_qdisc *q = qdisc_priv(sch);
   224		struct sk_buff *skb, *ret = NULL;
   225		struct sch_bpf_ctx ctx = {};
   226		struct bpf_prog *dequeue;
   227		struct sch_bpf_class *cl;
   228		struct pq_node *flow;
   229		s64 now;
   230		int res;
   231	
   232	requeue:
   233		flow = pq_pop(&q->flows);
   234		if (!flow)
   235			return NULL;
   236	
   237		cl = container_of(flow, struct sch_bpf_class, node);
   238		if (cl->qdisc) {
   239			skb = cl->qdisc->dequeue(cl->qdisc);
   240			ctx.classid = cl->common.classid;
   241		} else {
   242			struct pq_node *p = pq_pop(&cl->pq);
   243	
   244			if (!p)
   245				return NULL;
   246			skb = container_of(p, struct sk_buff, pqnode);
   247			ctx.classid = cl->rank;
   248		}
   249		ctx.skb = (struct __sk_buff *) skb;
   250		ctx.nr_flows = q->clhash.hashelems;
   251	
   252		dequeue = rcu_dereference(q->dequeue_prog.prog);
   253		bpf_compute_data_pointers(skb);
   254		res = BPF_PROG_RUN(dequeue, &ctx);
   255		if (q->direct)
 > 256			return ctx.skb;
   257		switch (res) {
   258		case SCH_BPF_OK:
   259			ret = skb;
   260			break;
   261		case SCH_BPF_REQUEUE:
   262			sch_bpf_skb_cb(skb)->rank = ctx.rank;
   263			cl->rank = ctx.classid;
   264			pq_push(&cl->pq, &skb->pqnode);
   265			bstats_update(&cl->bstats, skb);
   266			pq_push(&q->flows, &cl->node);
   267			goto requeue;
   268		case SCH_BPF_THROTTLE:
   269			now = ktime_get_ns();
   270			qdisc_watchdog_schedule_ns(&q->watchdog, now + ctx.delay);
   271			qdisc_qstats_overlimit(sch);
   272			cl->overlimits++;
   273			return NULL;
   274		default:
   275			kfree_skb(skb);
   276			ret = NULL;
   277		}
   278	
   279		if (pq_top(&cl->pq))
   280			pq_push(&q->flows, &cl->node);
   281		return ret;
   282	}
   283	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (31953 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ