Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp239377ybi; Wed, 29 May 2019 20:25:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZrODqozdbKjqslcEaQ4CR+0rDyZ1P70BLWQYet1HzJ3w29Qtm99IidqrdTAbWU29BScUP X-Received: by 2002:aa7:8582:: with SMTP id w2mr1503853pfn.204.1559186735256; Wed, 29 May 2019 20:25:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559186735; cv=none; d=google.com; s=arc-20160816; b=IO0/A520H4EPbzN9E86d28z4TCYjJ6FTkFnDcfn7UIPorogheLzH1v1NYFvdNIT8Vr yNEQjzA9fBT1tx/daFeLlWMdXeLmoj1aR4z/uu22xlDJM1Q9PCBdKMyWkJyIXSPTGo+y wk2Mvz+MRCDuu9yTuQ2dGVfx8/WSX/kfoKVrAMkopNBcgGKJhfayV2BFxgn0fMpZgecv BmDy3eyQQ2Uyg0oI/HE2Ew8yGDEn4Vm+3h7rAcHALRTDrN74uGKC3o5OVWKoHr/+Mk4o bBpdneMJ+ohQ6xvgIyEntSLPFstoSel1z0XCbvgxcurzLnhBVrD7TAGDV/C5wgexjPG+ b6qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+0xqMFhWIiQqbHHA3Kv7eSAcGmPWWtqBmV3FELUYi6A=; b=xoekKJzeHTey29IYfqwgg9L802Hm/i9LDGqowPcnTWf841wp7DHSOg5NzNwQiBeYHX DS0bDANY1n6dcKyyGNxbrlp2Go7aZ8mSMQjpWEk8269BVxv52xQP8AZ5LLso3sudiXIB 0pZ0Erj2YpfUoXjst9UJUknCb7ntRlIMFOc8KccjMI3HWH2IKmn/AeSXcDMx0ciPRkIE YXJbWvDLNydG+GifzMPepbVJi4Ics2tCQLc/yryS4PIq3UyoHjsxQsOLnoyAVDUyTyn5 AQwf1NjNbyNM8arLERhOc93fWJyxSBIVp8LQBjbOK2g4qJqkVZdgdurGUmTv8PqlKgpN GSKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Wu7TDdJr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d3si1935845pgg.378.2019.05.29.20.25.17; Wed, 29 May 2019 20:25:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Wu7TDdJr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732274AbfE3DWc (ORCPT + 99 others); Wed, 29 May 2019 23:22:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:43894 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730800AbfE3DQq (ORCPT ); Wed, 29 May 2019 23:16:46 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 208AB2461E; Thu, 30 May 2019 03:16:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186206; bh=TNOZSDXwP8xmsxJb5/sSE6vY5iXMrQUbVKK/nw3wRZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wu7TDdJrze8YUZvJjsnlmrZtL15JBGr+gOSN9AiWC+BwYrPLkgDIuiOEw/LXdu0zu QIy3Fdzg3ct4RVNwK6Tr/86tqjmh/JywvH3NtrlnbrfbHsugWOhEIy1dxrrvMC27OL OqVlio38XHN0J9iqwym6RqIHDh5eBVYSZ7Tk9wHw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Daniel T. Lee" , Yonghong Song , Daniel Borkmann , Sasha Levin Subject: [PATCH 4.19 093/276] libbpf: fix samples/bpf build failure due to undefined UINT32_MAX Date: Wed, 29 May 2019 20:04:11 -0700 Message-Id: <20190530030532.001609492@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030523.133519668@linuxfoundation.org> References: <20190530030523.133519668@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 32e621e55496a0009f44fe4914cd4a23cade4984 ] Currently, building bpf samples will cause the following error. ./tools/lib/bpf/bpf.h:132:27: error: 'UINT32_MAX' undeclared here (not in a function) .. #define BPF_LOG_BUF_SIZE (UINT32_MAX >> 8) /* verifier maximum in kernels <= 5.1 */ ^ ./samples/bpf/bpf_load.h:31:25: note: in expansion of macro 'BPF_LOG_BUF_SIZE' extern char bpf_log_buf[BPF_LOG_BUF_SIZE]; ^~~~~~~~~~~~~~~~ Due to commit 4519efa6f8ea ("libbpf: fix BPF_LOG_BUF_SIZE off-by-one error") hard-coded size of BPF_LOG_BUF_SIZE has been replaced with UINT32_MAX which is defined in header. Even with this change, bpf selftests are running fine since these are built with clang and it includes header(-idirafter) from clang/6.0.0/include. (it has ) clang -I. -I./include/uapi -I../../../include/uapi -idirafter /usr/local/include -idirafter /usr/include \ -idirafter /usr/lib/llvm-6.0/lib/clang/6.0.0/include -idirafter /usr/include/x86_64-linux-gnu \ -Wno-compare-distinct-pointer-types -O2 -target bpf -emit-llvm -c progs/test_sysctl_prog.c -o - | \ llc -march=bpf -mcpu=generic -filetype=obj -o /linux/tools/testing/selftests/bpf/test_sysctl_prog.o But bpf samples are compiled with GCC, and it only searches and includes headers declared at the target file. As '#include ' hasn't been declared in tools/lib/bpf/bpf.h, it causes build failure of bpf samples. gcc -Wp,-MD,./samples/bpf/.sockex3_user.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes \ -O2 -fomit-frame-pointer -std=gnu89 -I./usr/include -I./tools/lib/ -I./tools/testing/selftests/bpf/ \ -I./tools/ lib/ -I./tools/include -I./tools/perf -c -o ./samples/bpf/sockex3_user.o ./samples/bpf/sockex3_user.c; This commit add declaration of '#include ' to tools/lib/bpf/bpf.h to fix this problem. Signed-off-by: Daniel T. Lee Acked-by: Yonghong Song Signed-off-by: Daniel Borkmann Signed-off-by: Sasha Levin --- tools/lib/bpf/bpf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h index 6f38164b26181..c3145ab3bdcac 100644 --- a/tools/lib/bpf/bpf.h +++ b/tools/lib/bpf/bpf.h @@ -26,6 +26,7 @@ #include #include #include +#include struct bpf_create_map_attr { const char *name; -- 2.20.1