The bionic library is a C library that has been "trimmed" by Google. It lacks system calls such as setxattr, getxattr, fsetxattr, and fgetxattr. To set security labels for file objects, you must add these system calls to the bionic library as follows:
1. Define external functions
First open the terminal shell and enter the command "CD android4.0/bionic/libc/include/sys/Vim xattr. H". In this header file, two external functions are defined, as shown below:
Extern int setxattr (const char * path, const char * Name, const void * value, size_t size, int flags );
Extern ssize_t getxattr (const char * path, const char * Name, void * value, size_t size );
2. Added system calls.
After saving and exiting, enter the command "CD android4.0/bionic/libc/Vim syscils. txt". This file lists all system calls and corresponding system call numbers in the bionic library. Add the followingCode:
Int setxattr (const char *, const char *, constvoid *, size_t, INT) 226
Ssize_tgetxattr (const char *, const char *, void *, size_t) 229
3. Generate System calls
After saving and exiting, enter the command "CD android4.0/bionic/libc/tools", which contains the python files checksyscils and gensyscils, enter the command "Python checksyscall" and "Python gensyscils" to generate a new system call.