Calling prepare_app() from a non-main thread in a multithreaded
process could fail. While labels for other threads were being correctly
set by writing to /proc/<tid>/attr/current, the prepare_app thread used
smack_set_label_for_self() and thus /proc/self/attr/current.
This is easily fixed by reusing label_for_self_internal() so that all
threads are uniformly treated, each using its own tid.
Change-Id: Id5b3071b08057200331d64bf8d6cd172ae729df1
}
}
- if (g_p_app_label && smack_set_label_for_self(app_label.c_str()) != 0) {
- LogError("smack_set_label_for_self failed");
+ if (g_p_app_label && label_for_self_internal() != 0) {
+ LogError("label_for_self_internal failed");
goto err;
}