2 system packages exchanging uids on startup

86 views
Skip to first unread message

Mark G. Whitney

unread,
Apr 13, 2011, 9:30:21 AM4/13/11
to android-platform
I am working on a Froyo (2.2.1_r1) device where we have added 2
additional system packages. After initializing the system image,
where part of the process involves copying the 2 apks to /system/app,
one of the units has developed a pathological behavior where the 2
additional packages keep exchanging UIDs every time it powers up:

01-01 00:00:23.085 I/PackageManager( 1615): Features:
01-01 00:00:23.539 D/dalvikvm( 1615): GC_FOR_MALLOC freed 5910
objects / 245024 bytes in 182ms hsize: 100663296
01-01 00:00:23.867 W/PackageManager( 1615): Running ENG build: no pre-
dexopt!
01-01 00:00:24.093 D/PackageManager( 1615): Scanning app dir /system/
framework
01-01 00:00:24.640 D/PackageManager( 1615): Scanning app dir /system/
app
01-01 00:00:26.429 D/dalvikvm( 1615): GC_FOR_MALLOC freed 6424
objects / 350904 bytes in 138ms hsize: 100663296
01-01 00:00:28.250 W/PackageManager( 1615): System package <app1> has
changed from uid: 10016 to 10015; old data erased
01-01 00:00:28.351 I/PackageParser( 1615): <app2>: compat added
android.permission.WRITE_EXTERNAL_STORAGE
android.permission.READ_PHONE_STATE
01-01 00:00:28.382 W/PackageManager( 1615): System package <app2> has
changed from uid: 10015 to 10016; old data erased

So app2 and app1 keep exchanging uids 10015 and 10016 every time the
device starts up. The problem with this, of course, is that the 2 app
data directories both get deleted each time this happens. I should
also mention we do not do anything with the 2 apk files after they are
put there: no updates, etc.

If I kill system_server from the console to force an android runtime
restart, the above problem does not occur, only on a device reset.
Also, I have provisioned many other devices with the same system
filesystem and none of them have exhibited the above behavior, so the
behavior might be triggered by some peculiarity in how the files are
copied/laid out on the device (we are using built-in NAND flash with
yaffs2).

Why would android be re-initializing my 2 apps' UIDs on every boot,
when they already appear to be assigned a UID in /data/system/
packages.xml?

Dianne Hackborn

unread,
Apr 13, 2011, 12:23:42 PM4/13/11
to android-...@googlegroups.com, Mark G. Whitney
I have never seen anything like that before.  I suggest putting logs in PackageManagerService around the code the emits those messages to see why this is happening.  (There may be some existing logs you can turn on with the final boolean constants at the top of the class.)

The only things I can think to look at is some strange setup going on with the apps involving android:sharedUserId, <original-package>, or other things that impact uid assignment.


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.




--
Dianne Hackborn
Android framework engineer
hac...@android.com

Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails.  All such questions should be posted on public forums, where I and others can see and answer them.

Mark G. Whitney

unread,
Apr 13, 2011, 1:49:28 PM4/13/11
to android-platform

On Apr 13, 12:23 pm, Dianne Hackborn <hack...@android.com> wrote:
> I have never seen anything like that before.  I suggest putting logs in
> PackageManagerService around the code the emits those messages to see why
> this is happening.  (There may be some existing logs you can turn on with
> the final boolean constants at the top of the class.)

Thanks. I will try adding more logging and enabling the Config.LOGV-
guarded logging.

>
> The only things I can think to look at is some strange setup going on with
> the apps involving android:sharedUserId, <original-package>, or other things
> that impact uid assignment.

I am not using a shared user id for these 2 particular packages, if
that matters.

Since I posted this, I did some more investigation and it now looks
like this might be a problem with our yaffs2 partition, not in
PackageManager. It looks like there are 2 different /data/system's
with different inodes that yaffs is oscillating between for some
reason. So this is probably not a problem in the android runtime,
sorry for the false alarm.

I assume that if there is no /data/system/packages.xml file and
android generates a new one, it is more or less random what UIDs get
assigned to what packages (and it could vary from time to time),
right?

Anyway, here is the post to the yaffs list, in case anyone is
interested:

http://www.yaffs.net/lurker/message/20110413.170054.cb3358fa.en.html

Thanks again.

Dianne Hackborn

unread,
Apr 13, 2011, 5:04:48 PM4/13/11
to android-...@googlegroups.com, Mark G. Whitney
On Wed, Apr 13, 2011 at 10:49 AM, Mark G. Whitney <markw...@gmail.com> wrote:
I assume that if there is no /data/system/packages.xml file and
android generates a new one, it is more or less random what UIDs get
assigned to what packages (and it could vary from time to time),
right?

Yep, it will just be whatever order the filesystem returns them when it scans the directory.

Reply all
Reply to author
Forward
0 new messages