From: Cho Woong Suk Date: Mon, 25 Jul 2016 07:46:58 +0000 (+0900) Subject: add User execute label for wrt-loader X-Git-Tag: accepted/tizen/common/20160907.154811~8^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c5315d8accf8fcea00bada6021b19a48cd881747;p=platform%2Fframework%2Fweb%2Fcrosswalk-tizen.git add User execute label for wrt-loader Change-Id: Ifb239cf3818e844501dc73a04d0a11443e975612 --- diff --git a/loader/loader.gyp b/loader/loader.gyp new file mode 100644 index 0000000..baa7456 --- /dev/null +++ b/loader/loader.gyp @@ -0,0 +1,22 @@ +{ + 'includes':[ + '../build/common.gypi', + ], + 'targets': [ + { + 'target_name': 'wrt-loader', + 'type': 'executable', + 'sources': [ + 'wrt_loader.cc', + ], + 'variables': { + 'packages': [ + 'dlog', + ], + }, + 'libraries' : [ + '-ldl', + ], + }, # end of target 'wrt-loader' + ], +} diff --git a/loader/wrt_loader.cc b/loader/wrt_loader.cc new file mode 100644 index 0000000..6696498 --- /dev/null +++ b/loader/wrt_loader.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include +#include + +// loader file must have "User" execute label, because launchpad daemon runs +// with "System::Privileged" label. +int main(int argc, char* argv[]) { + void* handle = dlopen("/usr/bin/xwalk_runtime", RTLD_LAZY); + if (!handle) { + dlog_print(DLOG_DEBUG, "XWALK", "Error loading xwalk_runtime"); + return false; + } + + typedef int (*MAIN_FUNC)(int argc, char* argv[]); + + MAIN_FUNC real_main = reinterpret_cast(dlsym(handle, "main")); + if (!real_main) { + dlog_print(DLOG_DEBUG, "XWALK", "Error loading real_main"); + return false; + } + + int ret = real_main(argc, argv); + dlclose(handle); + + return ret; +} diff --git a/packaging/crosswalk-tizen.manifest b/packaging/crosswalk-tizen.manifest index 75b0fa5..87c6236 100644 --- a/packaging/crosswalk-tizen.manifest +++ b/packaging/crosswalk-tizen.manifest @@ -2,4 +2,7 @@ + + + diff --git a/packaging/crosswalk-tizen.spec b/packaging/crosswalk-tizen.spec index 523d7da..a0f33f6 100755 --- a/packaging/crosswalk-tizen.spec +++ b/packaging/crosswalk-tizen.spec @@ -154,7 +154,6 @@ install -p -m 644 out/Default/gen/splash_screen.json %{buildroot}%{extension_pat # xwalk_runtime install -p -m 755 out/Default/xwalk_runtime %{buildroot}%{_bindir} ln -s %{_bindir}/xwalk_runtime %{buildroot}%{_bindir}/wrt -ln -s %{_bindir}/xwalk_runtime %{buildroot}%{_bindir}/wrt-loader # xwalk extension shared install -p -m 644 out/Default/lib/libxwalk_extension_shared.so %{buildroot}%{_libdir} @@ -168,6 +167,9 @@ install -p -m 644 out/Default/gen/*.edj %{buildroot}%{_datadir}/edje/xwalk # xwalk_injected_bundle install -p -m 755 out/Default/lib/libxwalk_injected_bundle.so %{buildroot}%{_libdir} +# wrt-loader +install -p -m 755 out/Default/wrt-loader %{buildroot}%{_bindir} + %clean rm -fr %{buildroot} diff --git a/runtime/browser/runtime_process.cc b/runtime/browser/runtime_process.cc index fd63a6c..b92a23f 100755 --- a/runtime/browser/runtime_process.cc +++ b/runtime/browser/runtime_process.cc @@ -136,6 +136,7 @@ int real_main(int argc, char* argv[]) { return EXIT_SUCCESS; } +__attribute__((visibility("default"))) int main(int argc, char* argv[]) { if (strcmp(argv[0], "/usr/bin/wrt-loader") == 0) { elm_init(argc, argv); diff --git a/runtime/runtime.gyp b/runtime/runtime.gyp index d3a2299..3802152 100755 --- a/runtime/runtime.gyp +++ b/runtime/runtime.gyp @@ -46,6 +46,9 @@ 'browser/preload_manager.h', 'browser/preload_manager.cc', ], + 'ldflags': [ + '-pie', + ], 'variables': { 'packages': [ 'capi-appfw-application', diff --git a/xwalk_tizen.gyp b/xwalk_tizen.gyp index caf8a2c..4c6f3a9 100644 --- a/xwalk_tizen.gyp +++ b/xwalk_tizen.gyp @@ -7,6 +7,7 @@ 'common/common.gyp:*', 'extensions/extensions.gyp:*', 'runtime/runtime.gyp:*', + 'loader/loader.gyp:*', ], }, # end of target 'xwalk_tizen' ], # end of targets