-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
enhance(scripts/build/termux_step_massage): check for non-position-independent executables #23604
base: master
Are you sure you want to change the base?
Conversation
…dependent executables - a [`check-pie.sh`](https://github.com/termux/termux-packages/blob/5ed8471923a57fab306148c2cdef88df49550b68/scripts/bin/check-pie.sh) exists, but it is an isolated tool, and is not connected to CI. https://github.com/termux/termux-packages/blob/5ed8471923a57fab306148c2cdef88df49550b68/scripts/bin/check-pie.sh#L1-L12 - termux#23598 could have been prevented, in retrospect, if a long time ago when `simulide` was last built, `check-pie.sh` had been connected to CI. - This is an attempt to try to copy and paste the contents of `check-pie.sh` into the symbol checks block of `termux_step_massage.sh`, in order to possbly enable it - effects: - before termux@e462a5d: ``` INFO: Running symbol checks on 1 files with nproc=32 INFO: Done ... 0s INFO: Found non-position-independent executables INFO: Showing result ERROR: ./bin/simulide is a non-position-independent executable INFO: Done ... 0s ERROR: Refer above ``` - after termux@e462a5d: ``` INFO: Running symbol checks on 1 files with nproc=32 INFO: Done ... 1s termux - build of 'simulide' done ``` - **has been tested minimally in both `$TERMUX_ON_DEVICE_BUILD=true` mode and `$TERMUX_ON_DEVICE_BUILD=false` mode, but has not been heavily tested with all packages yet**. Because `check-pie.sh` has never been connected to CI, there is a chance it might produce **false positives** with some unknown packages, in which case a `TERMUX_PKG_NO_PIE_FILES` variable would be necessary to implement, for those packages. This PR serves to float the idea to check whether this is considered worthwhile enough to try.
9cda7a2
to
4a3efc0
Compare
hmm, I copied and pasted the " |
I have been keeping this in my local folder while building some packages, to look for false positives, and I have found one false positive.
When building it with check-pie enabled, I saw this:
This happens because, these are real non-position-independent executables, but they are not actually stored into the package, ever since 2558c84 10 years ago, so they are not intended to be used on-device. But since they are removed during After seeing that happen, I checked every single other I think a pretty good way to resolve this would be to just move the command that removes the
This is the change I have tested: --- a/packages/golang/build.sh
+++ b/packages/golang/build.sh
@@ -51,8 +51,6 @@ termux_step_make_install() {
cp pkg/include/* $TERMUX_GODIR/pkg/include/
cp -Rf lib/* $TERMUX_GODIR/lib
cp -Rf misc/ $TERMUX_GODIR/
-}
-
-termux_step_post_massage() {
- find . -path '*/testdata*' -delete
+ # testdata directories are not needed on the installed system
+ find $TERMUX_GODIR/src -path '*/testdata*' -delete
} |
You can create a step with an inner function like following where packages can filter the paths that should be searched for PIEs. I doubt you will be able to override make step for all packages that have such non-PIEs files. Like |
Ok thank you, yes that would be better for code organization and flexibility, because I think it is technically not a type of symbol, it is just detected using
I expected to see much more false positives, but I am pretty surprised because I have tested quite a few packages with it now and so far the only false positive I have seen yet has been I have not yet seen any true positives (packages still containing real non-position-independent executables that made it all the way into the app), but based on what happened to There are a few fully statically linked executables ( |
check-pie.sh
exists, but it is an isolated tool, and is not connected to CI.termux-packages/scripts/bin/check-pie.sh
Lines 1 to 12 in 5ed8471
[Bug]: Can't execute the Package x11/simulide #23598 could have been prevented, in retrospect, if a long time ago when
simulide
was last built,check-pie.sh
had been connected to CI.This is an attempt to try to copy and paste the contents of
check-pie.sh
into the symbol checks block oftermux_step_massage.sh
, in order to possibly enable itEffects
$TERMUX_ON_DEVICE_BUILD=true
mode and$TERMUX_ON_DEVICE_BUILD=false
mode, but has not been heavily tested with all packages yet. Becausecheck-pie.sh
has never been connected to CI, there is a chance it might produce false positives with some unknown packages, in which case aTERMUX_PKG_NO_PIE_FILES
variable would be necessary to implement, for those packages. This PR serves to float the idea to check whether this is considered worthwhile enough to try.