bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [linux-next:master 11808/13503] kernel/bpf/syscall.c:154: undefined reference to `vmalloc_user_node_flags'
       [not found] <201911231924.k1adA4Qy%lkp@intel.com>
@ 2019-11-23 17:37 ` Andrii Nakryiko
       [not found]   ` <1a9bdba3-ccbf-95d0-6033-467fa0f7eddd@intel.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Andrii Nakryiko @ 2019-11-23 17:37 UTC (permalink / raw)
  To: kbuild test robot
  Cc: kbuild-all, Daniel Borkmann, hannes, Alexei Starovoitov,
	andrii.nakryiko, bpf

On 11/23/19 3:44 AM, kbuild test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   b9d3d01405061bb42358fe53f824e894a1922ced
> commit: fc9702273e2edb90400a34b3be76f7b08fa3344b [11808/13503] bpf: Add mmap() support for BPF_MAP_TYPE_ARRAY
> config: arm-randconfig-a001-20191123 (attached as .config)
> compiler: arm-linux-gnueabi-gcc (GCC) 7.4.0
> reproduce:
>          wget https://urldefense.proofpoint.com/v2/url?u=https-3A__raw.githubusercontent.com_intel_lkp-2Dtests_master_sbin_make.cross&d=DwIBAg&c=5VD0RTtNlTh3ycd41b3MUw&r=vxqvl81C2rT6GOGdPyz8iQ&m=OyqPkKr2ayhE9rsjQ3V9TjPHNWGAzMj67odoKch8_YM&s=JuUtGb4L_bH6ANKEMAgVL3zSBnFkOW4jhVP9W3WBHBM&e=  -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          git checkout fc9702273e2edb90400a34b3be76f7b08fa3344b
>          # save the attached .config to linux build tree
>          GCC_VERSION=7.4.0 make.cross ARCH=arm
> 
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>):
> 
>     arm-linux-gnueabi-ld: section .data VMA [0000000000808000,00000000008829bf] overlaps section .ARM.unwind_idx VMA [00000000007d7000,000000000080b8ef]
>     arm-linux-gnueabi-ld: section .ARM.unwind_tab VMA [000000000080b8f0,000000000080febb] overlaps section .data VMA [0000000000808000,00000000008829bf]
>     kernel/bpf/syscall.o: In function `__bpf_map_area_alloc':
>>> kernel/bpf/syscall.c:154: undefined reference to `vmalloc_user_node_flags'
> 

Can't repro this with given config on x86_64. Trying to make make.cross 
work for me still. Any ideas why this is happening? I see that 
__vmalloc_node_flags_caller that we also use if #ifdef'ed as static 
inline in include/linux/vmalloc.h if no CONFIG_MMU is defined. Are we 
missing some config dependency or should I do the same trick as 
__vmalloc_node_flags_caller does?

Also. Daniel, when I tried to build latest bpf-next with this config, I 
got another compilation error, related to your recent patch, you might 
want to take a look as well:

   CC      kernel/tracepoint.o
   CC      kernel/elfcore.o
/data/users/andriin/linux/kernel/bpf/verifier.c: In function 
‘fixup_bpf_calls’:
/data/users/andriin/linux/kernel/bpf/verifier.c:9132:25: error: implicit 
declaration of function ‘bpf_jit_blinding_enabled’; did you mean 
‘bpf_jit_kallsyms_enabled’? [-Werror=implicit-function-declaration]
   bool expect_blinding = bpf_jit_blinding_enabled(prog);
                          ^~~~~~~~~~~~~~~~~~~~~~~~
                          bpf_jit_kallsyms_enabled
   CC      kernel/irq_work.o
   CC      kernel/crash_dump.o

> vim +154 kernel/bpf/syscall.c
> 
>     129	
>     130	static void *__bpf_map_area_alloc(size_t size, int numa_node, bool mmapable)
>     131	{
>     132		/* We really just want to fail instead of triggering OOM killer
>     133		 * under memory pressure, therefore we set __GFP_NORETRY to kmalloc,
>     134		 * which is used for lower order allocation requests.
>     135		 *
>     136		 * It has been observed that higher order allocation requests done by
>     137		 * vmalloc with __GFP_NORETRY being set might fail due to not trying
>     138		 * to reclaim memory from the page cache, thus we set
>     139		 * __GFP_RETRY_MAYFAIL to avoid such situations.
>     140		 */
>     141	
>     142		const gfp_t flags = __GFP_NOWARN | __GFP_ZERO;
>     143		void *area;
>     144	
>     145		/* kmalloc()'ed memory can't be mmap()'ed */
>     146		if (!mmapable && size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER)) {
>     147			area = kmalloc_node(size, GFP_USER | __GFP_NORETRY | flags,
>     148					    numa_node);
>     149			if (area != NULL)
>     150				return area;
>     151		}
>     152		if (mmapable) {
>     153			BUG_ON(!PAGE_ALIGNED(size));
>   > 154			return vmalloc_user_node_flags(size, numa_node, GFP_KERNEL |
>     155						       __GFP_RETRY_MAYFAIL | flags);
>     156		}
>     157		return __vmalloc_node_flags_caller(size, numa_node,
>     158						   GFP_KERNEL | __GFP_RETRY_MAYFAIL |
>     159						   flags, __builtin_return_address(0));
>     160	}
>     161	
> 
> ---
> 0-DAY kernel test infrastructure                 Open Source Technology Center
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.01.org_hyperkitty_list_kbuild-2Dall-40lists.01.org&d=DwIBAg&c=5VD0RTtNlTh3ycd41b3MUw&r=vxqvl81C2rT6GOGdPyz8iQ&m=OyqPkKr2ayhE9rsjQ3V9TjPHNWGAzMj67odoKch8_YM&s=zQax2z98Tn-V1wcH0rtwmJ0iA9DpFhqbVNzexx7wOWw&e=  Intel Corporation
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [kbuild-all] Re: [linux-next:master 11808/13503] kernel/bpf/syscall.c:154: undefined reference to `vmalloc_user_node_flags'
       [not found]   ` <1a9bdba3-ccbf-95d0-6033-467fa0f7eddd@intel.com>
@ 2019-11-25 17:53     ` Andrii Nakryiko
  0 siblings, 0 replies; 2+ messages in thread
From: Andrii Nakryiko @ 2019-11-25 17:53 UTC (permalink / raw)
  To: Rong Chen
  Cc: Andrii Nakryiko, kbuild test robot, kbuild-all, Daniel Borkmann,
	hannes, Alexei Starovoitov, bpf

On Sun, Nov 24, 2019 at 11:43 PM Rong Chen <rong.a.chen@intel.com> wrote:
>
>
>
> On 11/24/19 1:37 AM, Andrii Nakryiko wrote:
>
> On 11/23/19 3:44 AM, kbuild test robot wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   b9d3d01405061bb42358fe53f824e894a1922ced
> commit: fc9702273e2edb90400a34b3be76f7b08fa3344b [11808/13503] bpf: Add mmap() support for BPF_MAP_TYPE_ARRAY
> config: arm-randconfig-a001-20191123 (attached as .config)
> compiler: arm-linux-gnueabi-gcc (GCC) 7.4.0
> reproduce:
>          wget https://urldefense.proofpoint.com/v2/url?u=https-3A__raw.githubusercontent.com_intel_lkp-2Dtests_master_sbin_make.cross&d=DwIBAg&c=5VD0RTtNlTh3ycd41b3MUw&r=vxqvl81C2rT6GOGdPyz8iQ&m=OyqPkKr2ayhE9rsjQ3V9TjPHNWGAzMj67odoKch8_YM&s=JuUtGb4L_bH6ANKEMAgVL3zSBnFkOW4jhVP9W3WBHBM&e=  -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          git checkout fc9702273e2edb90400a34b3be76f7b08fa3344b
>          # save the attached .config to linux build tree
>          GCC_VERSION=7.4.0 make.cross ARCH=arm
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
>
> All errors (new ones prefixed by >>):
>
>     arm-linux-gnueabi-ld: section .data VMA [0000000000808000,00000000008829bf] overlaps section .ARM.unwind_idx VMA [00000000007d7000,000000000080b8ef]
>     arm-linux-gnueabi-ld: section .ARM.unwind_tab VMA [000000000080b8f0,000000000080febb] overlaps section .data VMA [0000000000808000,00000000008829bf]
>     kernel/bpf/syscall.o: In function `__bpf_map_area_alloc':
>
> kernel/bpf/syscall.c:154: undefined reference to `vmalloc_user_node_flags'
>
> Can't repro this with given config on x86_64. Trying to make make.cross
> work for me still. Any ideas why this is happening?
>
>
> Hi Andrii,
>
> We can reproduce it with make.cross command.

Yeah, I was able to repro (and submitted fix already), once I realized
that out-of-source tree compilation wasn't supported.

>
> xsang@xsang-OptiPlex-9020:~/OLT-10114/linux-next$ GCC_VERSION=7.4.0 make.cross ARCH=arm
> make CONFIG_OF_ALL_DTBS=y CONFIG_DTC=y CROSS_COMPILE=/home/xsang/0day/gcc-7.4.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi- --jobs=16 ARCH=arm
> ...
>   CC      include/uapi/linux/netfilter/ipset/ip_set_hash.h.s
>   GEN     .version
>   CHK     include/generated/compile.h
>   LD      vmlinux.o
>   MODPOST vmlinux.o
> WARNING: "return_address" [vmlinux] is a static EXPORT_SYMBOL_GPL
>   MODINFO modules.builtin.modinfo
>   LD      .tmp_vmlinux1
> /home/xsang/0day/gcc-7.4.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld: section .data VMA [0000000000808000,00000000008829bf] overlaps section .init.text VMA [00000000007f4db0,0000000000814207]
> /home/xsang/0day/gcc-7.4.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld: section .exit.text VMA [0000000000814208,0000000000817593] overlaps section .data VMA [0000000000808000,00000000008829bf]

These two were still happening, but even before my patch, so this must
be some other issue.

> kernel/bpf/syscall.o: In function `__bpf_map_area_alloc':
> /home/xsang/OLT-10114/linux-next/kernel/bpf/syscall.c:154: undefined reference to `vmalloc_user_node_flags'
> Makefile:1074: recipe for target 'vmlinux' failed
> make: *** [vmlinux] Error 1
>
>
> Best Regards,
> Rong Chen
>
> I see that
> __vmalloc_node_flags_caller that we also use if #ifdef'ed as static
> inline in include/linux/vmalloc.h if no CONFIG_MMU is defined. Are we
> missing some config dependency or should I do the same trick as
> __vmalloc_node_flags_caller does?
>
> Also. Daniel, when I tried to build latest bpf-next with this config, I
> got another compilation error, related to your recent patch, you might
> want to take a look as well:
>
>    CC      kernel/tracepoint.o
>    CC      kernel/elfcore.o
> /data/users/andriin/linux/kernel/bpf/verifier.c: In function
> ‘fixup_bpf_calls’:
> /data/users/andriin/linux/kernel/bpf/verifier.c:9132:25: error: implicit
> declaration of function ‘bpf_jit_blinding_enabled’; did you mean
> ‘bpf_jit_kallsyms_enabled’? [-Werror=implicit-function-declaration]
>    bool expect_blinding = bpf_jit_blinding_enabled(prog);
>                           ^~~~~~~~~~~~~~~~~~~~~~~~
>                           bpf_jit_kallsyms_enabled
>    CC      kernel/irq_work.o
>    CC      kernel/crash_dump.o
>
> vim +154 kernel/bpf/syscall.c
>
>     129
>     130 static void *__bpf_map_area_alloc(size_t size, int numa_node, bool mmapable)
>     131 {
>     132 /* We really just want to fail instead of triggering OOM killer
>     133 * under memory pressure, therefore we set __GFP_NORETRY to kmalloc,
>     134 * which is used for lower order allocation requests.
>     135 *
>     136 * It has been observed that higher order allocation requests done by
>     137 * vmalloc with __GFP_NORETRY being set might fail due to not trying
>     138 * to reclaim memory from the page cache, thus we set
>     139 * __GFP_RETRY_MAYFAIL to avoid such situations.
>     140 */
>     141
>     142 const gfp_t flags = __GFP_NOWARN | __GFP_ZERO;
>     143 void *area;
>     144
>     145 /* kmalloc()'ed memory can't be mmap()'ed */
>     146 if (!mmapable && size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER)) {
>     147 area = kmalloc_node(size, GFP_USER | __GFP_NORETRY | flags,
>     148    numa_node);
>     149 if (area != NULL)
>     150 return area;
>     151 }
>     152 if (mmapable) {
>     153 BUG_ON(!PAGE_ALIGNED(size));
>   > 154 return vmalloc_user_node_flags(size, numa_node, GFP_KERNEL |
>     155       __GFP_RETRY_MAYFAIL | flags);
>     156 }
>     157 return __vmalloc_node_flags_caller(size, numa_node,
>     158   GFP_KERNEL | __GFP_RETRY_MAYFAIL |
>     159   flags, __builtin_return_address(0));
>     160 }
>     161
>
> ---
> 0-DAY kernel test infrastructure                 Open Source Technology Center
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.01.org_hyperkitty_list_kbuild-2Dall-40lists.01.org&d=DwIBAg&c=5VD0RTtNlTh3ycd41b3MUw&r=vxqvl81C2rT6GOGdPyz8iQ&m=OyqPkKr2ayhE9rsjQ3V9TjPHNWGAzMj67odoKch8_YM&s=zQax2z98Tn-V1wcH0rtwmJ0iA9DpFhqbVNzexx7wOWw&e=  Intel Corporation
>
> _______________________________________________
> kbuild-all mailing list -- kbuild-all@lists.01.org
> To unsubscribe send an email to kbuild-all-leave@lists.01.org
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-25 17:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <201911231924.k1adA4Qy%lkp@intel.com>
2019-11-23 17:37 ` [linux-next:master 11808/13503] kernel/bpf/syscall.c:154: undefined reference to `vmalloc_user_node_flags' Andrii Nakryiko
     [not found]   ` <1a9bdba3-ccbf-95d0-6033-467fa0f7eddd@intel.com>
2019-11-25 17:53     ` [kbuild-all] " Andrii Nakryiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).