From patchwork Thu Jun 14 14:39:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 138574 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2202237lji; Thu, 14 Jun 2018 07:40:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJV/o6llzu6ZHN+CS4VuYkN/eh3ltQVylwJRbbBLBSqWUqEZFPQG7zL0FAlrsVHgXvtn3Vx X-Received: by 2002:a63:be0a:: with SMTP id l10-v6mr2489963pgf.87.1528987229717; Thu, 14 Jun 2018 07:40:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528987229; cv=none; d=google.com; s=arc-20160816; b=PO5myN2/5JxoJfbCdWRxW4kR0uNvLt6lHVG+4FTemoyAXzBrkw+ktoqQJ2nQUa07Lg p8062mpLiETfWnNQh8vLATPEAVizVEiHFaC9ZIlfmhYRhGcXyka7L2MVGGEFsVC/Ff1S l8Nc8QvkBJvC5r1idzZLoi9TLljtg321ANTOagkERad0e1EkuYOR6Kxm12heZd2uMx91 As88Z3jgfoNGfoUfia4LqhJwhRe3TwCc+BIO5NBTnRPw9hit+01WgMKccG56FwQAQPxS LxVMqJV9AZmbeiMl09pE1fPGiYixfA072av9RI6lL4VCM99w4eDt4XzsBHHcqZEXYzoU +Fag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=D1feyA0aAgxTbyIZhn4z5vUaXyZWPFRT9A14nU4K6N8=; b=YYmdAY04c+jc3eSeaHKmP1KiooDXyJOjVmCf6MoEj0zUZsOx0bWAkXGcDEOXf1mJO6 BoodzhGr37b13Dyy2BAFGumT7bUtiIn3naUNVM6YLeMkbC9b04Y9b3enCGVuIZLUq8uf avVERjPNmhQNl9YByD14WJyGy0zEbuH1aOAwNnTqYPjm3YBhPd+fjIIVX0utu37ccjEh tSoJxyEaXY6Ch5WZxx6mOpTVKdxRFFA+mlXR10+dwSJ1CnjlDVa1QgEZUgkKpboAhHZt 6I1FbaxSBwWlWq54TJs908x/b1LBB9Zsqbt8nRXg3eggWZ8HeKEjkD4oF616LaQSSsCx d0jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="t/FYBFqL"; 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 x69-v6si5312905pfa.108.2018.06.14.07.40.29; Thu, 14 Jun 2018 07:40:29 -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=@nifty.com header.s=dec2015msa header.b="t/FYBFqL"; 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 S965740AbeFNOk1 (ORCPT + 30 others); Thu, 14 Jun 2018 10:40:27 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:29199 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965543AbeFNOkX (ORCPT ); Thu, 14 Jun 2018 10:40:23 -0400 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-09.nifty.com with ESMTP id w5EEdw8n010795; Thu, 14 Jun 2018 23:39:59 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com w5EEdw8n010795 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1528987200; bh=D1feyA0aAgxTbyIZhn4z5vUaXyZWPFRT9A14nU4K6N8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t/FYBFqL4wb7e7xtsxvpOXpXfmRWZpAnNS7F+6DsvMVyT3v9iaOlbNdrlAzACVAbx YVYHB9JtZt4m78eAymLkL5nwPa1iEVvdrobWWddxwobTpikrY3dQ12OKLp85jlXBxP FyK2XSr2IL9/Q17ipFHEj1/uJfCFyTIwKspBX4i1TGBZjqNS/ZvvPqY2VwQP67w9WQ lav8Z331PUnjfSnT77l+4TfJZ33vQQz7A+peTWWab/cFuv1IPyB3k+FcQ7I3RzDAHq l8OXcih7geE/QkFsF2yPOC3VZS5nFnl+sHP9dpZ0it59xvl6Nnqo5w7qd2velvKrvw XqXircJX8ab6g== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: netdev@vger.kernel.org, Alexei Starovoitov , "David S . Miller" Cc: Arnd Bergmann , Geert Uytterhoeven , linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH v2 1/3] bpfilter: add bpfilter_umh to .gitignore Date: Thu, 14 Jun 2018 23:39:30 +0900 Message-Id: <1528987172-19810-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528987172-19810-1-git-send-email-yamada.masahiro@socionext.com> References: <1528987172-19810-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org bpfilter_umh is a generated file. It should be ignored by git. Signed-off-by: Masahiro Yamada --- Changes in v2: None net/bpfilter/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 net/bpfilter/.gitignore -- 2.7.4 diff --git a/net/bpfilter/.gitignore b/net/bpfilter/.gitignore new file mode 100644 index 0000000..e97084e --- /dev/null +++ b/net/bpfilter/.gitignore @@ -0,0 +1 @@ +bpfilter_umh From patchwork Thu Jun 14 14:39:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 138575 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2202308lji; Thu, 14 Jun 2018 07:40:34 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIptSn5JsyXSTuDr+4d5hMxrSmd0bWRKmf7MCj+JQgBnwszvjewCm6oHo2wX8fBK3JRj1El X-Received: by 2002:a63:583:: with SMTP id 125-v6mr2496048pgf.385.1528987233764; Thu, 14 Jun 2018 07:40:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528987233; cv=none; d=google.com; s=arc-20160816; b=T6FKg73sVGzBISOi1j/f42AP6f+G0LUupeKzbwBC7wLnxOmy4yzRzcLSbBPDrdKmGP 9KR9euQTKQuPC5va3WNqBSj6VXuBisYenwh6oO4TBpcQgfyGzzIeiMarwUctu/a/O4vU Cd6MTJRNu2i84D0efjRoVmVmiw7XsMF5M40AWhBzF3o/FEj6y0/9SFzk2wxyz9N2BLx6 w7frBQWUQYaMrU9RbUs0UQAL0loZ6C9TO3wC53ywHMGNU7UEB5Py+Orvxx+T+SFeR+gL HDpiO1OIKGFXdR4TjNzZ5riS40rChDar71jSJ9D0ybncJn0G0/CRUf+3+UA5gid4BKnf mbvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=tmTyhO6OIXehQWiorNqeVmCzDlr9Ni0o/0nc+xxAIbA=; b=ynqENt2/DpgiS9we4s+M8+jAmaisUHqYeSKKD0kOsPL2l3htLd2eolUnhzEJl4EKFe W1jU5VBCNUwurWNhyB2uIfBHmIW8P9wr8KRS9diz+czx33KjA+CVFMWMJN772JEEMxjr Y8M+Ta7M5/RV6/jd3LaK0+mzicVhxhZqlvz2aH1vEXUufbqRm95mfreJ/YjBORQMiqv7 EbDL8c7p+lyKOaejZF35BlmqQMa5K3i35zxZ8wGXM4GSRHFjYEacuHs10U0zcPxf32Ik u0kalF77hGorCPoFNvgmyieYHWmCnlnOPnGGnnk0gYiwKcVaVkAwUW5sFMdBKGAKuwjG Q4Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=pkoJvsSF; 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 x69-v6si5312905pfa.108.2018.06.14.07.40.33; Thu, 14 Jun 2018 07:40:33 -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=@nifty.com header.s=dec2015msa header.b=pkoJvsSF; 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 S965578AbeFNOkc (ORCPT + 30 others); Thu, 14 Jun 2018 10:40:32 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:29290 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965709AbeFNOk1 (ORCPT ); Thu, 14 Jun 2018 10:40:27 -0400 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-09.nifty.com with ESMTP id w5EEdw8o010795; Thu, 14 Jun 2018 23:40:00 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com w5EEdw8o010795 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1528987201; bh=tmTyhO6OIXehQWiorNqeVmCzDlr9Ni0o/0nc+xxAIbA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pkoJvsSFadrtbAU9Mq8tumtyp4drkxyk1y0sQLym7SkjsolgkVHPrOj4ccV+v5FUC uoOs9x1jU19OQ5Ybdhel62pwZ2xbXTEz+kk1+oZbJm4jkiQ24/8C/MKS0M4Kc/LgAO U4yIzx8B6AX6zkSOkCPohDpaAhylmQLTSNqtJ0At9+aBWXDpgeonELCjhBmVVigfz4 fuG775k1Z8fjhxsau73VskDuhwwVuF3+GprEsV2PrBh0PctoTEXv9jRbYPQkd42mcZ 4KtAFNozAeuSxW8qnsl3JAG/v0opiYHwrDe+URjbq4GFng+T/eG+LqPRWEMjtMGVAP 9FBlsoZgEiNbQ== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: netdev@vger.kernel.org, Alexei Starovoitov , "David S . Miller" Cc: Arnd Bergmann , Geert Uytterhoeven , linux-kernel@vger.kernel.org, Masahiro Yamada , Alexei Starovoitov , YueHaibing Subject: [PATCH v2 2/3] bpfilter: include bpfilter_umh in assembly instead of using objcopy Date: Thu, 14 Jun 2018 23:39:31 +0900 Message-Id: <1528987172-19810-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528987172-19810-1-git-send-email-yamada.masahiro@socionext.com> References: <1528987172-19810-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org What we want here is to embed a user-space program into the kernel. Instead of the complex ELF magic, let's simply wrap it in the assembly with the '.incbin' directive. Signed-off-by: Masahiro Yamada --- Changes in v2: - Rebase net/bpfilter/Makefile | 15 ++------------- net/bpfilter/bpfilter_kern.c | 11 +++++------ net/bpfilter/bpfilter_umh_blob.S | 7 +++++++ 3 files changed, 14 insertions(+), 19 deletions(-) create mode 100644 net/bpfilter/bpfilter_umh_blob.S -- 2.7.4 diff --git a/net/bpfilter/Makefile b/net/bpfilter/Makefile index e0bbe75..39c6980 100644 --- a/net/bpfilter/Makefile +++ b/net/bpfilter/Makefile @@ -15,18 +15,7 @@ ifeq ($(CONFIG_BPFILTER_UMH), y) HOSTLDFLAGS += -static endif -# a bit of elf magic to convert bpfilter_umh binary into a binary blob -# inside bpfilter_umh.o elf file referenced by -# _binary_net_bpfilter_bpfilter_umh_start symbol -# which bpfilter_kern.c passes further into umh blob loader at run-time -quiet_cmd_copy_umh = GEN $@ - cmd_copy_umh = echo ':' > $(obj)/.bpfilter_umh.o.cmd; \ - $(OBJCOPY) -I binary -O `$(OBJDUMP) -f $<|grep format|cut -d' ' -f8` \ - -B `$(OBJDUMP) -f $<|grep architecture|cut -d, -f1|cut -d' ' -f2` \ - --rename-section .data=.init.rodata $< $@ - -$(obj)/bpfilter_umh.o: $(obj)/bpfilter_umh - $(call cmd,copy_umh) +$(obj)/bpfilter_umh_blob.o: $(obj)/bpfilter_umh obj-$(CONFIG_BPFILTER_UMH) += bpfilter.o -bpfilter-objs += bpfilter_kern.o bpfilter_umh.o +bpfilter-objs += bpfilter_kern.o bpfilter_umh_blob.o diff --git a/net/bpfilter/bpfilter_kern.c b/net/bpfilter/bpfilter_kern.c index 0952257..6de3ae5 100644 --- a/net/bpfilter/bpfilter_kern.c +++ b/net/bpfilter/bpfilter_kern.c @@ -10,11 +10,8 @@ #include #include "msgfmt.h" -#define UMH_start _binary_net_bpfilter_bpfilter_umh_start -#define UMH_end _binary_net_bpfilter_bpfilter_umh_end - -extern char UMH_start; -extern char UMH_end; +extern char bpfilter_umh_start; +extern char bpfilter_umh_end; static struct umh_info info; /* since ip_getsockopt() can run in parallel, serialize access to umh */ @@ -93,7 +90,9 @@ static int __init load_umh(void) int err; /* fork usermode process */ - err = fork_usermode_blob(&UMH_start, &UMH_end - &UMH_start, &info); + err = fork_usermode_blob(&bpfilter_umh_end, + &bpfilter_umh_end - &bpfilter_umh_start, + &info); if (err) return err; pr_info("Loaded bpfilter_umh pid %d\n", info.pid); diff --git a/net/bpfilter/bpfilter_umh_blob.S b/net/bpfilter/bpfilter_umh_blob.S new file mode 100644 index 0000000..40311d1 --- /dev/null +++ b/net/bpfilter/bpfilter_umh_blob.S @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + .section .init.rodata, "a" + .global bpfilter_umh_start +bpfilter_umh_start: + .incbin "net/bpfilter/bpfilter_umh" + .global bpfilter_umh_end +bpfilter_umh_end: From patchwork Thu Jun 14 14:39:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 138577 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2202578lji; Thu, 14 Jun 2018 07:40:49 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKOHDTNO1PlMQSsqA4JuWXZIpQZ2XyS1/DPGwAxL+XcOxwFxsxorCrgaMUDSLV52YFvEmeu X-Received: by 2002:a63:8f4f:: with SMTP id r15-v6mr2592044pgn.210.1528987249205; Thu, 14 Jun 2018 07:40:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528987249; cv=none; d=google.com; s=arc-20160816; b=GQ25tTdQffyyEd07cAxKNoumHjXFhFZke2llCMgoYfH4B9I3NMrof6URBhfRhl2T3a QPy5YZEnh13vOOeK5dyu8ZPv4ALpY9beAPLoAD1aFh/ZiTuJvhV+pnmAXjoRpd35soLs M+sP7Y064l9Ns5fkYkKvY5ImPGor1UqDL+vW0FVHqiI61hd8s/xpAgNE3gAqPOZSfCSt KG6hNH6JSRgTwuoqQg5t66Ht9oeU/trk7Ue0TRC1b3crWMrbtqtcUENqT51KNzyJSOSu 2sJsVys7OpcpXLp5SdcVEIlg1DQ10lnUZAvj+myAwawU0LRMM14emsUN6JIqf9ml5FkN Urmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=3wPVYxP/Exm0IGHbViIYakieZPwAPwX6dlVC33a42To=; b=whxzJvVu/+QFkRXnHGG7c1cJNHF7o5wofTa6FcPiK6VTPOendVR7CKfvvcWEREAs1e aSp4jv43XpjyFsY92IoM51D4BLuWXfAHn/9yph6jwomgPjXn7HHwYhrh0pRA9b89bL1Z 4kFFwfjeMWmKIAwytnbZGLzYLjhTyv8TAYm63lxL/KFKeVEZSW+WY4GBEhfgwgfPZwLv 1EIIlAbvGc0UGTn57Yeuc17zcIEuuik2WBC4jBBbg5SS20s+A9FztREJen7oNKSdkaDE IIooMDgWcBiOZSgMKS5f9AboE7rrLslYLV5PWAHPhtz97NFqk85dYt3cxk6jr4h85FQn crMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=qSbj5Lyh; 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 x69-v6si5312905pfa.108.2018.06.14.07.40.48; Thu, 14 Jun 2018 07:40:49 -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=@nifty.com header.s=dec2015msa header.b=qSbj5Lyh; 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 S965754AbeFNOkp (ORCPT + 30 others); Thu, 14 Jun 2018 10:40:45 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:29581 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965517AbeFNOkk (ORCPT ); Thu, 14 Jun 2018 10:40:40 -0400 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-09.nifty.com with ESMTP id w5EEdw8p010795; Thu, 14 Jun 2018 23:40:01 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com w5EEdw8p010795 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1528987202; bh=3wPVYxP/Exm0IGHbViIYakieZPwAPwX6dlVC33a42To=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qSbj5LyhPVrLZB9sYyDjeSrrmyaD/f4i+BGGP1rye8Vo0LBAzqqwoAc1cAOrCO6Mf 3P9WQKGZh32xL35Q7FJacVcxfMoz0b6Ywe1ynSAirvoBp+WZhkar6jBA/ZRIUDZQwx W41s5eUM4HD0bmNqkkPVasLt2GUf5zv4MUnE6HULOlPesQMDEEyiUX5PNG9WBqu6x7 FEcKKtPECqKfiWVYJiWz6J+oCOvLf7Cj3oArQ8gpW/lCPiqDsU7m8evTV/x4ydc2Lk /09QepPIfro9LlwSHbpw+uw4IWuPahnKiuPDz2w6J8c8IVeSHJz0oUqVS8W4Yhgxcp Eco5ztRUluf9g== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: netdev@vger.kernel.org, Alexei Starovoitov , "David S . Miller" Cc: Arnd Bergmann , Geert Uytterhoeven , linux-kernel@vger.kernel.org, Masahiro Yamada , linux-kbuild@vger.kernel.org, Michal Marek , Daniel Borkmann Subject: [PATCH v2 3/3] bpfilter: check compiler capability in Kconfig Date: Thu, 14 Jun 2018 23:39:32 +0900 Message-Id: <1528987172-19810-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528987172-19810-1-git-send-email-yamada.masahiro@socionext.com> References: <1528987172-19810-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With the brand-new syntax extension of Kconfig, we can directly check the compiler capability in the configuration phase. If the cc-can-link.sh fails, the BPFILTER_UMH is automatically hidden by the dependency. I deleted 'default n', which is no-op. Signed-off-by: Masahiro Yamada --- Changes in v2: - newly added Makefile | 5 ----- net/Makefile | 4 ---- net/bpfilter/Kconfig | 2 +- scripts/cc-can-link.sh | 2 +- 4 files changed, 2 insertions(+), 11 deletions(-) -- 2.7.4 diff --git a/Makefile b/Makefile index 8a26b59..9ada673 100644 --- a/Makefile +++ b/Makefile @@ -507,11 +507,6 @@ ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLA KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO endif -ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/cc-can-link.sh $(CC)), y) - CC_CAN_LINK := y - export CC_CAN_LINK -endif - # The expansion should be delayed until arch/$(SRCARCH)/Makefile is included. # Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile. # CC_VERSION_TEXT is referenced from Kconfig (so it needs export), diff --git a/net/Makefile b/net/Makefile index 13ec0d5..bdaf539 100644 --- a/net/Makefile +++ b/net/Makefile @@ -20,11 +20,7 @@ obj-$(CONFIG_TLS) += tls/ obj-$(CONFIG_XFRM) += xfrm/ obj-$(CONFIG_UNIX) += unix/ obj-$(CONFIG_NET) += ipv6/ -ifneq ($(CC_CAN_LINK),y) -$(warning CC cannot link executables. Skipping bpfilter.) -else obj-$(CONFIG_BPFILTER) += bpfilter/ -endif obj-$(CONFIG_PACKET) += packet/ obj-$(CONFIG_NET_KEY) += key/ obj-$(CONFIG_BRIDGE) += bridge/ diff --git a/net/bpfilter/Kconfig b/net/bpfilter/Kconfig index a948b07..76deb66 100644 --- a/net/bpfilter/Kconfig +++ b/net/bpfilter/Kconfig @@ -1,6 +1,5 @@ menuconfig BPFILTER bool "BPF based packet filtering framework (BPFILTER)" - default n depends on NET && BPF && INET help This builds experimental bpfilter framework that is aiming to @@ -9,6 +8,7 @@ menuconfig BPFILTER if BPFILTER config BPFILTER_UMH tristate "bpfilter kernel module with user mode helper" + depends on $(success,$(srctree)/scripts/cc-can-link.sh $(CC)) default m help This builds bpfilter kernel module with embedded user mode helper diff --git a/scripts/cc-can-link.sh b/scripts/cc-can-link.sh index 208eb28..6efcead 100755 --- a/scripts/cc-can-link.sh +++ b/scripts/cc-can-link.sh @@ -1,7 +1,7 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 -cat << "END" | $@ -x c - -o /dev/null >/dev/null 2>&1 && echo "y" +cat << "END" | $@ -x c - -o /dev/null >/dev/null 2>&1 #include int main(void) {