Modify bionic library for Android Access Control

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.