What's the meaning “No data available(61)” during getxattr system call

两盒软妹~` 提交于 2019-12-12 01:59:36

问题


Daer all. I'm facing problem during trying Android CTS(4.4 R3).

the whole of error logs are like below:

01-22 17:19:44.844 D/        (22802): isPermittedCapBitSet():     getxattr("/system/bin/run-as") call failed: return -1 (error: No data available (61))
01-22 17:19:44.844 I/TestRunner(22802): failed: testRunAsHasCorrectCapabilities(android.permission.cts.FileSystemPermissionTest)
01-22 17:19:44.844 I/TestRunner(22802): ----- begin exception -----
01-22 17:19:44.844 I/TestRunner(22802): 
01-22 17:19:44.844 I/TestRunner(22802): junit.framework.AssertionFailedError
01-22 17:19:44.844 I/TestRunner(22802):         at junit.framework.Assert.fail(Assert.java:48)
01-22 17:19:44.844 I/TestRunner(22802):         at junit.framework.Assert.assertTrue(Assert.java:20)
01-22 17:19:44.844 I/TestRunner(22802):         at junit.framework.Assert.assertTrue(Assert.java:27)
01-22 17:19:44.844 I/TestRunner(22802):         at android.permission.cts.FileSystemPermissionTest.testRunAsHasCorrectCapabilities(FileSystemPermissionTest.java:828)
01-22 17:19:44.844 I/TestRunner(22802):         at java.lang.reflect.Method.invokeNative(Native Method)
01-22 17:19:44.844 I/TestRunner(22802):         at java.lang.reflect.Method.invoke(Method.java:515)
01-22 17:19:44.844 I/TestRunner(22802):         at junit.framework.TestCase.runTest(TestCase.java:168)
01-22 17:19:44.844 I/TestRunner(22802):         at junit.framework.TestCase.runBare(TestCase.java:134)
01-22 17:19:44.844 I/TestRunner(22802):         at junit.framework.TestResult$1.protect(TestResult.java:115)
01-22 17:19:44.844 I/TestRunner(22802):         at junit.framework.TestResult.runProtected(TestResult.java:133)
01-22 17:19:44.844 I/TestRunner(22802):         at junit.framework.TestResult.run(TestResult.java:118)
01-22 17:19:44.844 I/TestRunner(22802):         at junit.framework.TestCase.run(TestCase.java:124)
01-22 17:19:44.844 I/TestRunner(22802):         at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
01-22 17:19:44.844 I/TestRunner(22802):         at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
01-22 17:19:44.844 I/TestRunner(22802):         at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
01-22 17:19:44.844 I/TestRunner(22802):         at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)
01-22 17:19:44.844 I/TestRunner(22802): ----- end exceptbinder: release 22792:22801 transaction 150222 in, still active

I traced what function cause these errors

/cts/tests/tests/permission/jni/android_permission_cts_FileUtils.cpp

 95 static jboolean isPermittedCapBitSet(JNIEnv* env, jstring path, size_t capId)
 96 {
 97     const char* pathStr = env->GetStringUTFChars(path, NULL);
 98     jboolean ret = false;
 99 
100     struct vfs_cap_data capData;
101     memset(&capData, 0, sizeof(capData));
102 
103     ssize_t result = getxattr(pathStr, XATTR_NAME_CAPS, &capData,
104                               sizeof(capData));
105     if (result > 0) {
106       ret = (capData.data[CAP_TO_INDEX(capId)].permitted &
107              CAP_TO_MASK(capId)) != 0;
108       ALOGD("isPermittedCapBitSet(): getxattr(\"%s\") call succeeded, "
109             "cap bit %u %s",
110             pathStr, capId, ret ? "set" : "unset");
111     } else {
112       ALOGD("isPermittedCapBitSet(): getxattr(\"%s\") call failed: "
113             "return %d (error: %s (%d))\n",
114             pathStr, result, strerror(errno), errno);
115     }
116 
117     env->ReleaseStringUTFChars(path, pathStr);
118     return ret;
119 }
120 

The error made by getxattr().

I don't know what should I do. I already checked /system/bin/run-as. It exists and has connect permission and ownership

root@123:/ # ls -al /system/bin/run-as                                     
-rwxr-x--- root     shell        9500 2015-01-21 14:54 run-as

Please let me teach what should I check ? Thanks


回答1:


I think you may need to recompile your kernel with eXtended ATTRibutes (xattr) enabled. For the ext3 filesystem, the config value in .config is:

CONFIG_EXT3_FS_XATTR

But, in your linux source tree, type

make menuconfig

and use that interface to enable extended attributes for the file system(s) you are using. Then recompile your kernel after that.



来源:https://stackoverflow.com/questions/28084348/whats-the-meaning-no-data-available61-during-getxattr-system-call

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!