Skip to content
Commit eef2c431 authored by Martin Storsjo's avatar Martin Storsjo Committed by Narayan Kamath
Browse files

Store inodes in unsigned long long

In 32 bit ABIs, ino_t is a 32 bit type, while the st_ino field
in struct stat is 64 bits wide in both 32 and 64 bit processes.
This means that struct stat can expose inode numbers that are
truncated when stored in an ino_t.

The SDCard fuse daemon (/system/bin/sdcard) uses raw pointer
values as inode numbers, so on 64 bit devices, we're very likely
to observe inodes that need > 32 bits to represent.

The fileHasMoved function in sqlite compares the stored
inode value with a new one from stat, and when the stored
value is truncated, this check will falsely indicate that
the file has been moved. When the fileHasMoved function
triggers, other functions start returning errors indicating
that the database is in read-only mode.

NOTE: Bionic differs from glibc in that struct stat's st_ino
is *always* 64 bits wide, and not the same width as ino_t.

bug: https://code.google.com/p/android/issues/detail?id=79994
bug: 18434265

Change-Id: Id79a866c8891d6df47e4eec17ad9eb48e4cb0138
parent 54948bb3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment