summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChan Lee <chan45.lee@samsung.com>2017-08-25 10:46:44 +0900
committerDongkyun Son <dongkyun.s@samsung.com>2024-05-09 13:35:58 +0900
commit9f3f17da36aa3d44feb366ed55cfa22618c690e1 (patch)
tree450561195dd52c8194a34ba7aab7bb9c662efe70
parent9a7f938387eceb60b1c4613af72c3da65c279a80 (diff)
downloadgcc-9f3f17da36aa3d44feb366ed55cfa22618c690e1.tar.gz
gcc-9f3f17da36aa3d44feb366ed55cfa22618c690e1.tar.bz2
gcc-9f3f17da36aa3d44feb366ed55cfa22618c690e1.zip
packaging: Set shadow address space to unlimited for ASan
Currently, at the beginning of gbs build, shadow address space is set according to the environment of the host machine. It makes ASan build fail because ASan needs a whole shadow address space. Actually ASan tries to set the value to unlimited at init time( ASanInitInternal() ) but it failes because of lack of permission like below. [ 39s] ==6800==ERROR: AddressSanitizer setrlimit() failed 1 The value could be set at package install time because the user is 'root' at this time. Using ulimit can only set the value for current user('root') not 'abuild' which is the user at build time so we need to set /etc/security/limits.conf directly. Change-Id: Ia03911a37a689c186d0e028d01b665cf6a0c3073 Signed-off-by: Chan Lee <chan45.lee@samsung.com>
-rw-r--r--packaging/gcc-aarch64.spec5
-rw-r--r--packaging/gcc-armv7l.spec5
-rw-r--r--packaging/linaro-gcc.spec5
3 files changed, 15 insertions, 0 deletions
diff --git a/packaging/gcc-aarch64.spec b/packaging/gcc-aarch64.spec
index cd7301d8206..dcb6c48bdc4 100644
--- a/packaging/gcc-aarch64.spec
+++ b/packaging/gcc-aarch64.spec
@@ -671,6 +671,9 @@ cat >> /usr/lib/rpm/tizen_macros << EOF
%%gcc_unforce_options \\
%%gcc_force_options %%asan_force_options -fcommon
EOF
+# ASan needs a whole shadow address space
+# Using ulimit can only set the value for current user so we need to set /etc/security/limits.conf directly.
+sed '/End of file/i\abuild\tsoft\tas\t-1\nabuild\thard\tas\t-1' -i /etc/security/limits.conf
%preun -n asan-force-options
# Restore read-only mode
@@ -679,6 +682,8 @@ chmod a-w %{libsubdir}
[ -d /emul/ ] && chmod a-w /emul/usr/bin/ && chmod a-w /emul/home/abuild/rpmbuild/BUILD/gcc-%{version}/obj/gcc/ \
&& find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a-w
/usr/bin/gcc-unforce-options
+# Restore limit configurations set for ASan
+sed '/abuild/d' -i /etc/security/limits.conf
%package -n ubsan-force-options
Summary: Scripts to enable automatic package sanitization
diff --git a/packaging/gcc-armv7l.spec b/packaging/gcc-armv7l.spec
index 79ce827d1f0..0dbf0e8fa17 100644
--- a/packaging/gcc-armv7l.spec
+++ b/packaging/gcc-armv7l.spec
@@ -671,6 +671,9 @@ cat >> /usr/lib/rpm/tizen_macros << EOF
%%gcc_unforce_options \\
%%gcc_force_options %%asan_force_options -fcommon
EOF
+# ASan needs a whole shadow address space
+# Using ulimit can only set the value for current user so we need to set /etc/security/limits.conf directly.
+sed '/End of file/i\abuild\tsoft\tas\t-1\nabuild\thard\tas\t-1' -i /etc/security/limits.conf
%preun -n asan-force-options
# Restore read-only mode
@@ -679,6 +682,8 @@ chmod a-w %{libsubdir}
[ -d /emul/ ] && chmod a-w /emul/usr/bin/ && chmod a-w /emul/home/abuild/rpmbuild/BUILD/gcc-%{version}/obj/gcc/ \
&& find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a-w
/usr/bin/gcc-unforce-options
+# Restore limit configurations set for ASan
+sed '/abuild/d' -i /etc/security/limits.conf
%package -n ubsan-force-options
Summary: Scripts to enable automatic package sanitization
diff --git a/packaging/linaro-gcc.spec b/packaging/linaro-gcc.spec
index 17293f17539..85db17665c7 100644
--- a/packaging/linaro-gcc.spec
+++ b/packaging/linaro-gcc.spec
@@ -668,6 +668,9 @@ cat >> /usr/lib/rpm/tizen_macros << EOF
%%gcc_unforce_options \\
%%gcc_force_options %%asan_force_options -fcommon
EOF
+# ASan needs a whole shadow address space
+# Using ulimit can only set the value for current user so we need to set /etc/security/limits.conf directly.
+sed '/End of file/i\abuild\tsoft\tas\t-1\nabuild\thard\tas\t-1' -i /etc/security/limits.conf
%preun -n asan-force-options
# Restore read-only mode
@@ -676,6 +679,8 @@ chmod a-w %{libsubdir}
[ -d /emul/ ] && chmod a-w /emul/usr/bin/ && chmod a-w /emul/home/abuild/rpmbuild/BUILD/gcc-%{version}/obj/gcc/ \
&& find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a-w
/usr/bin/gcc-unforce-options
+# Restore limit configurations set for ASan
+sed '/abuild/d' -i /etc/security/limits.conf
%package -n ubsan-force-options
Summary: Scripts to enable automatic package sanitization