-
Notifications
You must be signed in to change notification settings - Fork 192
fix(common-files/building-system-patches/disable-apparmor): more aggressive method of disabling AppArmor #2395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
robertkirkman
merged 1 commit into
termux-user-repository:master
from
robertkirkman:disable-apparmor-aggressively
Apr 1, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
43 changes: 36 additions & 7 deletions
43
common-files/building-system-patches/0008-disable-apparmor.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,48 @@ | ||
| --- a/scripts/build/toolchain/termux_setup_toolchain_29.sh | ||
| +++ b/scripts/build/toolchain/termux_setup_toolchain_29.sh | ||
| @@ -133,7 +133,7 @@ termux_setup_toolchain_29() { | ||
| [ -d "${TERMUX_STANDALONE_TOOLCHAIN}-work" ] || mkdir -p "${TERMUX_STANDALONE_TOOLCHAIN}-work" | ||
|
|
||
|
|
||
| - if ! mountpoint -q "${TERMUX_STANDALONE_TOOLCHAIN}"; then | ||
| + if false; then | ||
| fuse-overlayfs \ | ||
| "${TERMUX_STANDALONE_TOOLCHAIN}" \ | ||
| -o lowerdir="${NDK}/toolchains/llvm/prebuilt/linux-x86_64" \ | ||
| @@ -145,12 +145,17 @@ termux_setup_toolchain_29() { | ||
| return | ||
| fi | ||
|
|
||
| + rm -rf "${TERMUX_STANDALONE_TOOLCHAIN}" | ||
| + | ||
| local _NDK_ARCHNAME=$TERMUX_ARCH | ||
| if [ "$TERMUX_ARCH" = "aarch64" ]; then | ||
| _NDK_ARCHNAME=arm64 | ||
| elif [ "$TERMUX_ARCH" = "i686" ]; then | ||
| _NDK_ARCHNAME=x86 | ||
| fi | ||
| + cp "$NDK/toolchains/llvm/prebuilt/linux-x86_64" "${TERMUX_STANDALONE_TOOLCHAIN}" -r | ||
| + cp "$NDK/source.properties" "${TERMUX_STANDALONE_TOOLCHAIN}" | ||
| + | ||
| # Remove android-support header wrapping not needed on android-21: | ||
| rm -Rf $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/local | ||
|
|
||
| --- a/scripts/run-docker.sh | ||
| +++ b/scripts/run-docker.sh | ||
| @@ -96,7 +96,7 @@ if [ "$UNAME" = Darwin ]; then | ||
| @@ -92,7 +92,7 @@ if [ "$UNAME" = Darwin ]; then | ||
| SEC_OPT="" | ||
| else | ||
| REPOROOT="$(dirname $(readlink -f $0))/../" | ||
| - SEC_OPT=" --security-opt seccomp=$REPOROOT/scripts/profile.json --security-opt apparmor=_custom-termux-package-builder-$CONTAINER_NAME --cap-add CAP_SYS_ADMIN --device /dev/fuse" | ||
| + SEC_OPT=" --privileged --security-opt seccomp=unconfined --cap-add CAP_SYS_ADMIN --device /dev/fuse" | ||
| + SEC_OPT=" --security-opt seccomp=$REPOROOT/scripts/profile.json" | ||
| fi | ||
|
|
||
| if [ "${CI:-}" = "true" ]; then | ||
| @@ -135,6 +135,7 @@ APPARMOR_PARSER="" | ||
| if command -v apparmor_parser > /dev/null; then | ||
| APPARMOR_PARSER="apparmor_parser" | ||
| @@ -138,6 +138,7 @@ if [ -z "$APPARMOR_PARSER" ] || ! $SUDO aa-status --enabled; then | ||
| echo " Avoid executing untrusted code in the container" | ||
| APPARMOR_PARSER="" | ||
| fi | ||
| +APPARMOR_PARSER="" | ||
|
|
||
| if [ -z "$APPARMOR_PARSER" ] || ! $SUDO aa-status --enabled; then | ||
| echo "WARNING: apparmor_parser not found, AppArmor profiles will not be loaded!" | ||
| load_apparmor_profile() { | ||
| local profile_path="$1" | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR ensures that TUR entirely doesn't depend on FUSE. I think a more robust approach would be to unmount the filesystem first, to check if it is currently mounted.
Currently, I use a virtual machine to build packages. There will be some problems if I attempt to build a package using TUR immediately after having previously built a package using
termux-packages.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for explaining that.
in my workflow, problems do not occur when I build a TUR package immediately after building a termux-packages package. That might be because of my practice of invariably using a unique
CONTAINER_NAMEwith every differentscriptsfolder that I manually set every time I download a new copy of thescriptsfolder. The reason I do that is because I consistently observed many problems occurring in the past as a result of attempting to share the same container for multiple separatescriptsfolders, that do not only have to do with AppArmor or fuse-overlayfs. However, I understand that not everyone finds it convenient to always use a differentCONTAINER_NAMEwith every copy of thescriptsfolder.In my opinion, this patch to disable both AppArmor and fuse-overlayfs should be a command line argument to the
run-docker.shscript (andbuild-package.shscript) in upstream, but I'm not sure if thunder-coding would approve of that or not (because they wanted to encourage the use of both AppArmor and fuse-overlayfs in the main repository). I will try, and find out.If this mode were a command line argument to the
run-docker.shscript (andbuild-package.shscript) in upstream, then do you think that would solve your problem, because we could both use that command line argument while building our TUR and local packages, and then you wouldn't have a problem with building packages using TUR immediately after building packages using termux-packages, or am I not yet understanding the problem correctly?