Comments (5)
The errors seems quite clear. You have to hook __bionic_bzero instead of bzero (just change the function name) and replace void with const void in malloc_usable_size.
I didn't build libqasan with android in mind, but if this solves your usecase I can push a simple patch.
from qasan.
Pull again and test if now works.
from qasan.
thanks for the patch, and there are some error in my test:
/home/zero/Documents/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android29-clang -fPIC -shared -I ../include libqasan.c hooks.c malloc.c string.c uninstrument.c patch.c -o libqasan.so -ldl -pthread
hooks.c:177:22: error: invalid application of 'sizeof' to an incomplete type 'FILE' (aka 'struct __sFILE')
QASAN_LOAD(stream, sizeof(FILE));
^ ~~~~~~
../include/qasan.h:243:45: note: expanded from macro 'QASAN_LOAD'
QASAN_CALL2(QASAN_ACTION_CHECK_LOAD, ptr, len)
^~~
../include/qasan.h:236:43: note: expanded from macro 'QASAN_CALL2'
syscall(QASAN_FAKESYS_NR, action, arg1, arg2, NULL)
^~~~
/home/zero/Documents/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/stdio.h:58:8: note: forward declaration of 'struct __sFILE'
struct __sFILE;
^
hooks.c:300:6: error: redefinition of '__bionic_bzero'
void __bionic_bzero(void *s, size_t n) {
^
/home/zero/Documents/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/strings.h:62:40: note: previous definition is here
static __inline__ __always_inline void __bionic_bzero(void* b, size_t len) {
^
2 errors generated.
it seem that __bionic_bzero is inline func in NDK, I don't know if it still work by hook __bionic_bzero .
from qasan.
checked that symbol "bzero" is not in NDK's lib, I think maybe there is no need to hook bzero func in NDK .
I removed bzero part on hook.c , the code pass compile and seem stable at fuzzing by now.
And I removed 'sizeof(FILE)' line in fgets func to pass compile .
char *fgets(char *s, int size, FILE *stream) {
void *rtv = __builtin_return_address(0);
QASAN_DEBUG("%14p: fgets(%p, %d, %p)\n", rtv, s, size, stream);
QASAN_STORE(s, size);
//QASAN_LOAD(stream, sizeof(FILE));
char *r = __lq_libc_fgets(s, size, stream);
QASAN_DEBUG("\t\t = %p\n", r);
return r;
}
qasan will lost memory read record about the FILE struct when deal with fgets func,and I wonder if we can replace sizeof(FILE) with some const int when using NDK?
from qasan.
Problably you should find the header that defines FILE and include it when __BIONIC is defined. If you get it working, please do a PR.
from qasan.
Related Issues (14)
- TODO: Implement Stack Use-After-Return
- Build error on Ubuntu 16.04 HOT 2
- Unexpeced exception when running aarch64 binary HOT 5
- SEGV when running a 32-bit binary HOT 2
- come across "Fork server handshake failed" when work with AFL++ HOT 4
- python not found and error building HOT 3
- Support for running qasan on aarch64 host
- Does QASAN now support for ARM64 binary?If it support, can it support all binarys that qemu supports(For example, ARM Trusted Firmware (ATF))?
- Usage of Full-System QASan HOT 5
- HELP : can't trigger qasan crash HOT 5
- How can I build qasan for arm? HOT 6
- Installation and usage problems for the 32-bit architectures HOT 5
- Port recent AFL++ patches like CmpLog
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qasan.