Skip to content

Commit

Permalink
Migrate to Cmake and ensure -fstack-protector-all is being applied (#…
Browse files Browse the repository at this point in the history
…171)

Co-authored-by: Scott Alexander-Bown <scottyab@users.noreply.github.com>
Co-authored-by: mat <admin@stealthcopter.com>
  • Loading branch information
3 people authored May 22, 2021
1 parent 88dbbd2 commit 2fae04b
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 66 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ subprojects {
ext.buildToolsVer = "30.0.0"
ext.minSdkVer = 15
ext.targetSdkVer = 30
ext.ndkVersionVar = '22.1.7171670'

}

Expand Down
12 changes: 7 additions & 5 deletions changes.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
Change Log

#v0.0.9
#0.1.0
* Add fstack protector #136 @slawert

#0.0.9
* Support for Android TV devices #129 @deepakpk009
* Add additional dangerous apps packages #145 @Fi5t
* Add fstack protector #136 @slawert
* ~Add fstack protector #136 @slawert~ Note this was found in #170 to have not been applied and fixed in 0.1.0

#v0.0.8
#0.0.8

* Removed busybox from the default root checking methods
* Additional root app packages added
* Use PATH environment variable to find places su binaries might be hiding
* Updated sample app to AndroidX

#v0.0.7
#0.0.7

* Added a check to see if the native library is available to prevent crashing
* Automatic building of native binaries if NDK is present

#v0.0.6
#0.0.6

* more su directory checks
* fix crash when native lib load fails
Expand Down
36 changes: 10 additions & 26 deletions rootbeerlib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ apply plugin: 'com.github.dcendents.android-maven'
android {
compileSdkVersion compileSdkVer
buildToolsVersion buildToolsVer
ndkVersion ndkVersionVar

defaultConfig {
minSdkVersion minSdkVer
targetSdkVersion targetSdkVer
versionCode 1
versionName "1.0"

ndk {
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
}
}

buildTypes {
Expand All @@ -19,38 +24,17 @@ android {
}
}


try {
// If NDK Exists, compile our native binaries
logger.debug("Found NDK" + android.getNdkDirectory())

externalNativeBuild {
ndkBuild {
path 'src/main/jni/Android.mk'
}
}
}
catch (InvalidUserDataException e){
// Otherwise disable automatic ndk-build and use pre-compiled .so files
// logger.error(e.toString())
logger.debug("NDK Not Present")

sourceSets {
main {
jni.srcDirs = []
}
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
}
}

packagingOptions {
// In case there are both compiled .so files and provided .so files, pick the first (should be generated)
pickFirst('lib/*/libtool-checker.so')
}
}

dependencies {
testImplementation 'junit:junit:4.13'
testImplementation 'org.mockito:mockito-core:3.1.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:3.9.0'
}

apply from: '../gradle-mvn-push.gradle'
6 changes: 2 additions & 4 deletions rootbeerlib/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.scottyab.rootbeer">

<application />
<manifest package="com.scottyab.rootbeer">

<application />
</manifest>
11 changes: 11 additions & 0 deletions rootbeerlib/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.4.1)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-all")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-all")

add_library(toolChecker SHARED
toolChecker.cpp)

target_link_libraries(toolChecker
android
log)
File renamed without changes.
File renamed without changes.
30 changes: 0 additions & 30 deletions rootbeerlib/src/main/jni/Android.mk

This file was deleted.

1 change: 0 additions & 1 deletion rootbeerlib/src/main/jni/Application.mk

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file removed rootbeerlib/src/main/jniLibs/x86/libtool-checker.so
Binary file not shown.
Binary file not shown.

0 comments on commit 2fae04b

Please sign in to comment.