[Security Discussion] Geofferey:
[MENTION=7811757]christianrodher[/MENTION]

I'm still having issues. It complained about not having bootimg.h so I found one and place it. Now it's saying this crap.

geoffereysair3:android_external_dirtycow-android-6.0 geofferey$ make build
ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk APP_PLATFORM=android-21
[arm64-v8a] Compile : cow-exec <= cow-exec.c
[arm64-v8a] Executable : cow-exec
[arm64-v8a] Install : cow-exec => libs/arm64-v8a/cow-exec
[arm64-v8a] Compile : cow-run-as <= run-as.c
[arm64-v8a] Executable : cow-run-as
[arm64-v8a] Install : cow-run-as => libs/arm64-v8a/cow-run-as
[arm64-v8a] Compile : dirtycow <= dirtycow.c
./dirtycow.c:50:36: warning: format specifies type 'int' but the argument has
type 'size_t' (aka 'unsigned long') [-Wformat]
LOGV("[*] madvise = %p %d", addr, size);
~~ ^~~~
%zu
./dirtycow.c:17:70: note: expanded from macro 'LOGV'
...{ __android_log_print(ANDROID_LOG_INFO, "exploit", __VA_ARGS__); printf(...
^~~~~~~~~~~
./dirtycow.c:50:36: warning: format specifies type 'int' but the argument has
type 'size_t' (aka 'unsigned long') [-Wformat]
LOGV("[*] madvise = %p %d", addr, size);
~~ ^~~~
%zu
./dirtycow.c:17:91: note: expanded from macro 'LOGV'
..."exploit", __VA_ARGS__); printf(__VA_ARGS__); printf("\n"); fflush(stdou...
^~~~~~~~~~~
./dirtycow.c:136:75: warning: format specifies type 'long long' but the argument
has type 'long' [-Wformat]
...new file size (%lld) and file old size (%lld) differ\n", st2.st_size, st...
~~~~ ^~~~~~~~~~~
%ld
./dirtycow.c:17:70: note: expanded from macro 'LOGV'
...{ __android_log_print(ANDROID_LOG_INFO, "exploit", __VA_ARGS__); printf(...
^~~~~~~~~~~
./dirtycow.c:136:88: warning: format specifies type 'long long' but the argument
has type 'long' [-Wformat]
...(%lld) and file old size (%lld) differ\n", st2.st_size, st.st_size);
~~~~ ^~~~~~~~~~
%ld
./dirtycow.c:17:70: note: expanded from macro 'LOGV'
...{ __android_log_print(ANDROID_LOG_INFO, "exploit", __VA_ARGS__); printf(...
^~~~~~~~~~~
./dirtycow.c:136:75: warning: format specifies type 'long long' but the argument
has type 'long' [-Wformat]
...new file size (%lld) and file old size (%lld) differ\n", st2.st_size, st...
~~~~ ^~~~~~~~~~~
%ld
./dirtycow.c:17:91: note: expanded from macro 'LOGV'
..."exploit", __VA_ARGS__); printf(__VA_ARGS__); printf("\n"); fflush(stdou...
^~~~~~~~~~~
./dirtycow.c:136:88: warning: format specifies type 'long long' but the argument
has type 'long' [-Wformat]
...(%lld) and file old size (%lld) differ\n", st2.st_size, st.st_size);
~~~~ ^~~~~~~~~~
%ld
./dirtycow.c:17:91: note: expanded from macro 'LOGV'
..."exploit", __VA_ARGS__); printf(__VA_ARGS__); printf("\n"); fflush(stdou...
^~~~~~~~~~~
./dirtycow.c:142:21: warning: format specifies type 'int' but the argument has
type 'size_t' (aka 'unsigned long') [-Wformat]
LOGV("size %d\n\n",size);
~~ ^~~~
%zu
./dirtycow.c:17:70: note: expanded from macro 'LOGV'
...{ __android_log_print(ANDROID_LOG_INFO, "exploit", __VA_ARGS__); printf(...
^~~~~~~~~~~
./dirtycow.c:142:21: warning: format specifies type 'int' but the argument has
type 'size_t' (aka 'unsigned long') [-Wformat]
LOGV("size %d\n\n",size);
~~ ^~~~
%zu
./dirtycow.c:17:91: note: expanded from macro 'LOGV'
..."exploit", __VA_ARGS__); printf(__VA_ARGS__); printf("\n"); fflush(stdou...
^~~~~~~~~~~
8 warnings generated.
[arm64-v8a] Executable : dirtycow
[arm64-v8a] Install : dirtycow => libs/arm64-v8a/dirtycow
[arm64-v8a] Compile : recowvery-applypatch <= recowvery-applypatch.c
./recowvery-applypatch.c:89:2: error: use of undeclared identifier 'boot_img'
boot_img image;
^
./recowvery-applypatch.c:95:8: warning: implicit declaration of function
'load_boot_image' is invalid in C99 [-Wimplicit-function-declaration]
ret = load_boot_image(&image, BLOCK_BOOT);
^
./recowvery-applypatch.c:95:25: error: use of undeclared identifier 'image'
ret = load_boot_image(&image, BLOCK_BOOT);
^
./recowvery-applypatch.c:104:34: error: use of undeclared identifier 'image'
LOGV("Current cmdline: \"%s\"", image.hdr.cmdline);
^
./recowvery-applypatch.c:104:34: error: use of undeclared identifier 'image'
./recowvery-applypatch.c:107:2: warning: implicit declaration of function
'bootimg_set_cmdline_arg' is invalid in C99
[-Wimplicit-function-declaration]
bootimg_set_cmdline_arg(&image, "androidboot.selinux", "permissive");
^
./recowvery-applypatch.c:107:27: error: use of undeclared identifier 'image'
bootimg_set_cmdline_arg(&image, "androidboot.selinux", "permissive");
^
./recowvery-applypatch.c:108:27: error: use of undeclared identifier 'image'
bootimg_set_cmdline_arg(&image, "enforcing", "0");
^
./recowvery-applypatch.c:110:30: error: use of undeclared identifier 'image'
LOGV("New cmdline: \"%s\"", image.hdr.cmdline);
^
./recowvery-applypatch.c:110:30: error: use of undeclared identifier 'image'
./recowvery-applypatch.c:113:8: warning: implicit declaration of function
'write_boot_image' is invalid in C99 [-Wimplicit-function-declaration]
ret = write_boot_image(&image, BLOCK_RECOVERY);
^
./recowvery-applypatch.c:113:26: error: use of undeclared identifier 'image'
ret = write_boot_image(&image, BLOCK_RECOVERY);
^
./recowvery-applypatch.c:120:2: warning: implicit declaration of function
'free_boot_image' is invalid in C99 [-Wimplicit-function-declaration]
free_boot_image(&image);
^
./recowvery-applypatch.c:120:19: error: use of undeclared identifier 'image'
free_boot_image(&image);
^
./recowvery-applypatch.c:132:19: error: use of undeclared identifier 'image'
free_boot_image(&image);
^
4 warnings and 11 errors generated.
make[1]: *** [obj/local/arm64-v8a/objs/recowvery-applypatch/recowvery-applypatch.o] Error 1
make: *** [build] Error 2
geoffereysair3:android_external_dirtycow-android-6.0 geofferey$

I modified my Andorid.mk

geoffereysair3:android_external_dirtycow-android-6.0 geofferey$ cat Android.mk
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := dirtycow
LOCAL_SRC_FILES := \
dirtycow.c
LOCAL_CFLAGS += -DDEBUG
LOCAL_SHARED_LIBRARIES := liblog
LOCAL_LDLIBS := -llog
LOCAL_SDK_VERSION := 21
include $(BUILD_EXECUTABLE)

include $(CLEAR_VARS)
LOCAL_MODULE := cow-run-as
LOCAL_MODULE_FILE := run-as
LOCAL_SRC_FILES := \
run-as.c
LOCAL_SDK_VERSION := 21
include $(BUILD_EXECUTABLE)

include $(CLEAR_VARS)
LOCAL_MODULE := cow-exec
LOCAL_SRC_FILES := \
cow-exec.c
LOCAL_CFLAGS += -DDEBUG
LOCAL_SHARED_LIBRARIES := liblog
LOCAL_LDLIBS := -llog
LOCAL_SDK_VERSION := 21
include $(BUILD_EXECUTABLE)

include $(CLEAR_VARS)
LOCAL_MODULE := recowvery-applypatch
LOCAL_SRC_FILES := \
recowvery-applypatch.c
LOCAL_C_INCLUDES := external/libbootimg
LOCAL_CFLAGS += -DDEBUG
LOCAL_SHARED_LIBRARIES := liblog
LOCAL_LDLIBS := -llog
LOCAL_STATIC_LIBRARIES := libbootimg-static
include $(BUILD_EXECUTABLE)
geoffereysair3:android_external_dirtycow-android-6.0 geofferey$