diff options
| author | Andy Whitcroft <apw@canonical.com> | 2011-09-16 08:20:31 -0400 |
|---|---|---|
| committer | Leann Ogasawara <leann.ogasawara@canonical.com> | 2011-09-16 12:58:57 -0400 |
| commit | 4fe31cee83c91b6dacdaa3448a1e0e69126efb25 (patch) | |
| tree | fd1c63d65a37426da244d0cec48949348e2e822c /scripts | |
| parent | 2c0baa0bed5f6b374d069074bd29d8a1a9dbab01 (diff) | |
UBUNTU: SAUCE: headers_install: fix #include "..." usage for userspace
When headers are converted to userspace headers they may include
relative includes. For example x86 has the following in its
asm/posix_types.h:
# ifdef __i386__
# include "posix_types_32.h"
# else
# include "posix_types_64.h"
# endif
However this is not safe in the face of the gcc option -I- which removes
"the directory the file I am being included from" from the search list.
Convert these references to <dir/...> form avoiding this.
BugLink: http://bugs.launchpad.net/bugs/824377
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/Makefile.headersinst | 4 | ||||
| -rw-r--r-- | scripts/headers_install.pl | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index a57f5bd5a13..b4018c57989 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst | |||
| @@ -50,8 +50,8 @@ printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@)) | |||
| 50 | quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ | 50 | quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ |
| 51 | file$(if $(word 2, $(all-files)),s)) | 51 | file$(if $(word 2, $(all-files)),s)) |
| 52 | cmd_install = \ | 52 | cmd_install = \ |
| 53 | $(PERL) $< $(srctree)/$(obj) $(install) $(SRCARCH) $(header-y); \ | 53 | $(PERL) $< $(srctree)/$(obj) $(install) $(SRCARCH) $(printdir) $(header-y); \ |
| 54 | $(PERL) $< $(objtree)/$(obj) $(install) $(SRCARCH) $(objhdr-y); \ | 54 | $(PERL) $< $(objtree)/$(obj) $(install) $(SRCARCH) $(printdir) $(objhdr-y); \ |
| 55 | for F in $(wrapper-files); do \ | 55 | for F in $(wrapper-files); do \ |
| 56 | echo "\#include <asm-generic/$$F>" > $(install)/$$F; \ | 56 | echo "\#include <asm-generic/$$F>" > $(install)/$$F; \ |
| 57 | done; \ | 57 | done; \ |
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl index efb3be10d42..0425f5fd19e 100644 --- a/scripts/headers_install.pl +++ b/scripts/headers_install.pl | |||
| @@ -18,7 +18,9 @@ | |||
| 18 | 18 | ||
| 19 | use strict; | 19 | use strict; |
| 20 | 20 | ||
| 21 | my ($readdir, $installdir, $arch, @files) = @ARGV; | 21 | my ($readdir, $installdir, $arch, $printdir, @files) = @ARGV; |
| 22 | |||
| 23 | $printdir =~ s@^include/@@; | ||
| 22 | 24 | ||
| 23 | my $unifdef = "scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__"; | 25 | my $unifdef = "scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__"; |
| 24 | 26 | ||
| @@ -30,6 +32,10 @@ foreach my $file (@files) { | |||
| 30 | open(my $out, '>', $tmpfile) | 32 | open(my $out, '>', $tmpfile) |
| 31 | or die "$tmpfile: $!\n"; | 33 | or die "$tmpfile: $!\n"; |
| 32 | while (my $line = <$in>) { | 34 | while (my $line = <$in>) { |
| 35 | # Any #include which uses "" and does not have a path needs | ||
| 36 | # rewriting so that the resultant user space headers are | ||
| 37 | # safe against the use of -I-. | ||
| 38 | $line =~ s/^(\s*#\s*include\s+)"([^\/]*?)"/$1<$printdir\/$2>/; | ||
| 33 | $line =~ s/([\s(])__user\s/$1/g; | 39 | $line =~ s/([\s(])__user\s/$1/g; |
| 34 | $line =~ s/([\s(])__force\s/$1/g; | 40 | $line =~ s/([\s(])__force\s/$1/g; |
| 35 | $line =~ s/([\s(])__iomem\s/$1/g; | 41 | $line =~ s/([\s(])__iomem\s/$1/g; |
