Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1456)

Side by Side Diff: chrome/tools/build/mac/make_more_helpers.sh

Issue 7714018: Give plug-in processes an executable heap and disable PIE/ASLR for Native (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/tools/build/mac/make_locale_dirs.sh ('k') | content/browser/gpu/gpu_process_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:executable
+ *
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 #!/bin/bash
2
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 # Usage: make_more_helpers.sh <version> <app_name>
8 #
9 # This script creates additional helper .app bundles for Chromium, based on
10 # the existing helper .app bundle, changing their Mach-O header's flags to
11 # enable and disable various features. Based on Chromium Helper.app, it will
12 # create Chromium Helper EH.app, which has the MH_NO_HEAP_EXECUTION bit
13 # cleared to support Chromium child processes that require an executable heap,
14 # and Chromium Helper NP.app, which has the MH_PIE bit cleared to support
15 # Chromium child processes that cannot tolerate ASLR.
16 #
17 # This script expects to be called from the chrome_exe target as a postbuild,
18 # and operates directly within the built-up browser app's versioned directory.
19 #
20 # Each helper is adjusted by giving it the proper bundle name, renaming the
21 # executable, adjusting several Info.plist keys, and changing the executable's
22 # Mach-O flags.
23
24 set -eu
25
26 make_helper() {
27 local versioned_dir="${1}"
28 local app_name="${2}"
29 local feature="${3}"
30 local flags="${4}"
31
32 local helper_name="${app_name} Helper"
33 local helper_stem="${versioned_dir}/${helper_name}"
34 local original_helper="${helper_stem}.app"
35 if [[ ! -d "${original_helper}" ]]; then
36 echo "${0}: error: ${original_helper} is a required directory" >& 2
37 exit 1
38 fi
39 local original_helper_exe="${original_helper}/Contents/MacOS/${helper_name}"
40 if [[ ! -f "${original_helper_exe}" ]]; then
41 echo "${0}: error: ${original_helper_exe} is a required file" >& 2
42 exit 1
43 fi
44
45 local feature_helper="${helper_stem} ${feature}.app"
46
47 rsync -acC --delete --include '*.so' "${original_helper}/" "${feature_helper}"
48
49 local helper_feature="${helper_name} ${feature}"
50 local helper_feature_exe="${feature_helper}/Contents/MacOS/${helper_feature}"
51 mv "${feature_helper}/Contents/MacOS/${helper_name}" "${helper_feature_exe}"
52
53 local change_flags="\
54 $(dirname "${0}")/../../../../build/mac/change_mach_o_flags.py"
55 "${change_flags}" ${flags} "${helper_feature_exe}"
56
57 local feature_info="${feature_helper}/Contents/Info"
58 local feature_info_plist="${feature_info}.plist"
59
60 defaults write "${feature_info}" "CFBundleDisplayName" "${helper_feature}"
61 defaults write "${feature_info}" "CFBundleExecutable" "${helper_feature}"
62
63 cfbundleid="$(defaults read "${feature_info}" "CFBundleIdentifier")"
64 feature_cfbundleid="${cfbundleid}.${feature}"
65 defaults write "${feature_info}" "CFBundleIdentifier" "${feature_cfbundleid}"
66
67 cfbundlename="$(defaults read "${feature_info}" "CFBundleName")"
68 feature_cfbundlename="${cfbundlename} ${feature}"
69 defaults write "${feature_info}" "CFBundleName" "${feature_cfbundlename}"
70
71 # As usual, defaults might have put the plist into whatever format excites
72 # it, but Info.plists get converted back to the expected XML format.
73 plutil -convert xml1 "${feature_info_plist}"
74 }
75
76 if [[ ${#} -ne 2 ]]; then
77 echo "usage: ${0} <version> <app_name>" >& 2
78 exit 1
79 fi
80
81 VERSION="${1}"
82 APP_NAME="${2}"
83
84 CONTENTS_DIR="${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}"
85 VERSIONED_DIR="${CONTENTS_DIR}/Versions"
86 CURRENT_VERSIONED_DIR="${VERSIONED_DIR}/${VERSION}"
87
88 make_helper "${CURRENT_VERSIONED_DIR}" "${APP_NAME}" "EH" "--executable-heap"
89 make_helper "${CURRENT_VERSIONED_DIR}" "${APP_NAME}" "NP" "--no-pie"
OLDNEW
« no previous file with comments | « chrome/tools/build/mac/make_locale_dirs.sh ('k') | content/browser/gpu/gpu_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698