stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Nicolas Dichtel <nicolas.dichtel@6wind.com>,
	Bruce Ashfield <bruce.ashfield@windriver.com>,
	Michal Marek <mmarek@suse.cz>, Wang Nan <wangnan0@huawei.com>
Subject: [PATCH 3.10 05/41] kbuild: fix make headers_install when path is too long
Date: Fri, 11 Apr 2014 09:09:36 -0700	[thread overview]
Message-ID: <20140411160933.244697152@linuxfoundation.org> (raw)
In-Reply-To: <20140411160932.865173041@linuxfoundation.org>

3.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Nicolas Dichtel <nicolas.dichtel@6wind.com>

commit c0ff68f1611d6855a06d672989ad5cfea160a4eb upstream.

If headers_install is executed from a deep/long directory structure, the
shell's maximum argument length can be execeeded, which breaks the operation
with:

| make[2]: execvp: /bin/sh: Argument list too long
| make[2]: ***

Instead of passing each files name with the entire path, I give only the file
name without the source path and give this path as a new argument to
headers_install.pl.

Because there is three possible paths, I have tree input-files list, one per
path.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Tested-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Cc: Wang Nan <wangnan0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 scripts/Makefile.headersinst |   20 ++++++++++++++------
 scripts/headers_install.sh   |    7 +++++--
 2 files changed, 19 insertions(+), 8 deletions(-)

--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -47,18 +47,24 @@ header-y      := $(filter-out $(generic-
 all-files     := $(header-y) $(genhdr-y) $(wrapper-files)
 output-files  := $(addprefix $(installdir)/, $(all-files))
 
-input-files   := $(foreach hdr, $(header-y), \
+input-files1  := $(foreach hdr, $(header-y), \
 		   $(if $(wildcard $(srcdir)/$(hdr)), \
-			$(wildcard $(srcdir)/$(hdr)), \
+			$(wildcard $(srcdir)/$(hdr))) \
+		   )
+input-files1-name := $(notdir $(input-files1))
+input-files2  := $(foreach hdr, $(header-y), \
+		   $(if  $(wildcard $(srcdir)/$(hdr)),, \
 			$(if $(wildcard $(oldsrcdir)/$(hdr)), \
 				$(wildcard $(oldsrcdir)/$(hdr)), \
 				$(error Missing UAPI file $(srcdir)/$(hdr))) \
-		   )) \
-		 $(foreach hdr, $(genhdr-y), \
+		   ))
+input-files2-name := $(notdir $(input-files2))
+input-files3  := $(foreach hdr, $(genhdr-y), \
 		   $(if	$(wildcard $(gendir)/$(hdr)), \
 			$(wildcard $(gendir)/$(hdr)), \
 			$(error Missing generated UAPI file $(gendir)/$(hdr)) \
 		   ))
+input-files3-name := $(notdir $(input-files3))
 
 # Work out what needs to be removed
 oldheaders    := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h))
@@ -72,7 +78,9 @@ printdir = $(patsubst $(INSTALL_HDR_PATH
 quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
                             file$(if $(word 2, $(all-files)),s))
       cmd_install = \
-        $(CONFIG_SHELL) $< $(installdir) $(input-files); \
+        $(CONFIG_SHELL) $< $(installdir) $(srcdir) $(input-files1-name); \
+        $(CONFIG_SHELL) $< $(installdir) $(oldsrcdir) $(input-files2-name); \
+        $(CONFIG_SHELL) $< $(installdir) $(gendir) $(input-files3-name); \
         for F in $(wrapper-files); do                                   \
                 echo "\#include <asm-generic/$$F>" > $(installdir)/$$F;    \
         done;                                                           \
@@ -98,7 +106,7 @@ __headersinst: $(subdirs) $(install-file
 	@:
 
 targets += $(install-file)
-$(install-file): scripts/headers_install.sh $(input-files) FORCE
+$(install-file): scripts/headers_install.sh $(input-files1) $(input-files2) $(input-files3) FORCE
 	$(if $(unwanted),$(call cmd,remove),)
 	$(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
 	$(call if_changed,install)
--- a/scripts/headers_install.sh
+++ b/scripts/headers_install.sh
@@ -2,7 +2,7 @@
 
 if [ $# -lt 1 ]
 then
-	echo "Usage: headers_install.sh OUTDIR [FILES...]
+	echo "Usage: headers_install.sh OUTDIR SRCDIR [FILES...]
 	echo
 	echo "Prepares kernel header files for use by user space, by removing"
 	echo "all compiler.h definitions and #includes, removing any"
@@ -10,6 +10,7 @@ then
 	echo "asm/inline/volatile keywords."
 	echo
 	echo "OUTDIR: directory to write each userspace header FILE to."
+	echo "SRCDIR: source directory where files are picked."
 	echo "FILES:  list of header files to operate on."
 
 	exit 1
@@ -19,6 +20,8 @@ fi
 
 OUTDIR="$1"
 shift
+SRCDIR="$1"
+shift
 
 # Iterate through files listed on command line
 
@@ -34,7 +37,7 @@ do
 		-e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \
 		-e 's/(^|[ \t(])(inline|asm|volatile)([ \t(]|$)/\1__\2__\3/g' \
 		-e 's@#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @' \
-		"$i" > "$OUTDIR/$FILE.sed" || exit 1
+		"$SRCDIR/$i" > "$OUTDIR/$FILE.sed" || exit 1
 	scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$FILE.sed" \
 		> "$OUTDIR/$FILE"
 	[ $? -gt 1 ] && exit 1



  parent reply	other threads:[~2014-04-11 16:09 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-11 16:09 [PATCH 3.10 00/41] 3.10.37-stable review Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 01/41] selinux: correctly label /proc inodes in use before the policy is loaded Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 02/41] powernow-k6: disable cache when changing frequency Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 03/41] powernow-k6: correctly initialize default parameters Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 04/41] powernow-k6: reorder frequencies Greg Kroah-Hartman
2014-04-11 16:09 ` Greg Kroah-Hartman [this message]
2014-04-11 16:09 ` [PATCH 3.10 06/41] cpuidle: Check the result of cpuidle_get_driver() against NULL Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 07/41] net: fix for a race condition in the inet frag code Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 08/41] net: sctp: fix skb leakage in COOKIE ECHO path of chunk->auth_chunk Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 09/41] bridge: multicast: add sanity check for query source addresses Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 10/41] inet: frag: make sure forced eviction removes all frags Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 11/41] net: unix: non blocking recvmsg() should not return -EINTR Greg Kroah-Hartman
2014-04-11 16:21   ` Rainer Weikusat
2014-04-11 16:09 ` [PATCH 3.10 12/41] ipv6: Fix exthdrs offload registration Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 13/41] ipv6: dont set DST_NOCOUNT for remotely added routes Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 14/41] vlan: Set correct source MAC address with TX VLAN offload enabled Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 15/41] tcp: tcp_release_cb() should release socket ownership Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 16/41] net: socket: error on a negative msg_namelen Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 17/41] ipv6: Avoid unnecessary temporary addresses being generated Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 18/41] ipv6: ip6_append_data_mtu do not handle the mtu of the second fragment properly Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 19/41] vxlan: fix potential NULL dereference in arp_reduce() Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 20/41] rtnetlink: fix fdb notification flags Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 21/41] ipmr: fix mfc " Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 22/41] ip6mr: " Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 23/41] netpoll: fix the skb check in pkt_is_ns Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 24/41] tg3: Do not include vlan acceleration features in vlan_features Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 25/41] usbnet: include wait queue head in device structure Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 26/41] vlan: Set hard_header_len according to available acceleration Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 27/41] vhost: fix total length when packets are too short Greg Kroah-Hartman
2014-04-11 16:09 ` [PATCH 3.10 28/41] vhost: validate vhost_get_vq_desc return value Greg Kroah-Hartman
2014-04-11 16:10 ` [PATCH 3.10 29/41] xen-netback: remove pointless clause from if statement Greg Kroah-Hartman
2014-04-11 16:10 ` [PATCH 3.10 30/41] ipv6: some ipv6 statistic counters failed to disable bh Greg Kroah-Hartman
2014-04-11 16:10 ` [PATCH 3.10 31/41] netlink: dont compare the nul-termination in nla_strcmp Greg Kroah-Hartman
2014-04-11 16:10 ` [PATCH 3.10 32/41] isdnloop: Validate NUL-terminated strings from user Greg Kroah-Hartman
2014-04-11 16:10 ` [PATCH 3.10 33/41] isdnloop: several buffer overflows Greg Kroah-Hartman
2014-04-11 16:10 ` [PATCH 3.10 34/41] rds: prevent dereference of a NULL device in rds_iw_laddr_check Greg Kroah-Hartman
2014-04-11 16:10 ` [PATCH 3.10 35/41] ARC: [nsimosci] Change .dts to use generic 8250 UART Greg Kroah-Hartman
2014-04-11 16:10 ` [PATCH 3.10 36/41] ARC: [nsimosci] Unbork console Greg Kroah-Hartman
2014-04-11 16:10 ` [PATCH 3.10 37/41] futex: Allow architectures to skip futex_atomic_cmpxchg_inatomic() test Greg Kroah-Hartman
2014-04-11 16:10 ` [PATCH 3.10 38/41] m68k: Skip " Greg Kroah-Hartman
2014-04-11 16:10 ` [PATCH 3.10 39/41] crypto: ghash-clmulni-intel - use C implementation for setkey() Greg Kroah-Hartman
2014-04-11 16:10 ` [PATCH 3.10 40/41] cpufreq: Fix governor start/stop race condition Greg Kroah-Hartman
2014-04-11 16:10 ` [PATCH 3.10 41/41] cpufreq: Fix timer/workqueue corruption due to double queueing Greg Kroah-Hartman
2014-04-11 21:44 ` [PATCH 3.10 00/41] 3.10.37-stable review Guenter Roeck
2014-04-11 23:45 ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140411160933.244697152@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=bruce.ashfield@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    --cc=nicolas.dichtel@6wind.com \
    --cc=stable@vger.kernel.org \
    --cc=wangnan0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).