Bug #927
closedAspectator doesn't ensure uniqueness for auxiliary generated functions
0%
Description
I noticed this when I have obtained more one problem from linking:
Linking globals named 'ldv_module_put_2': symbol multiply defined!
It comes because of different object files to be linked contains the same definition of the given function (and this function hasn't any storage class specifier)! We don't notice the problem earlier since module_put wasn't instrumented (see Bug #362). As for other functions they contain the static storage class specifier for called functions that automatically doesn't lead to the given problem.
I suggest simple obvious fix: always add the static storage class specifier for such auxiliary functions.
Note that there is no problems with actual model functions like ldv_module_put since RI takes care of it.]
The problem should be addressed in the coming aspectator porting.
Updated by Evgeny Novikov over 13 years ago
- Priority changed from High to Normal
Like #349 this issue also isn't a critical now. Even though it's very simple to be implemented.
Updated by Evgeny Novikov about 12 years ago
- Priority changed from Normal to High
ldv_mutex_lock_6(&(media_devnode_lock) /* ldv_func_arg1 */) { ldv_mutex_lock_graph_mutex(ldv_func_arg1 /* lock */) { assume(ldv_mutex_graph_mutex == 1); ldv_mutex_graph_mutex = 2; return ; } mutex_lock(ldv_func_arg1) { /* Function call is skipped due to function is undefined */} return ; }
but indeed this is related with different files defines auxiliary functions with the same signatures:
- media-device.c
void ldv_mutex_lock_6 (struct mutex *ldv_func_arg1) { typedef void ldv_func_ret_type; typedef struct mutex *ldv_func_arg_type1; ldv_mutex_lock_graph_mutex(ldv_func_arg1); mutex_lock(ldv_func_arg1); }
- media-devnode.c
void ldv_mutex_lock_6 (struct mutex *ldv_func_arg1) { typedef void ldv_func_ret_type; typedef struct mutex *ldv_func_arg_type1; ldv_mutex_lock_media_devnode_lock(ldv_func_arg1); mutex_lock(ldv_func_arg1); }
- media-entity.c
void ldv_mutex_lock_6 (struct mutex *ldv_func_arg1) { typedef void ldv_func_ret_type; typedef struct mutex *ldv_func_arg_type1; ldv_mutex_lock_graph_mutex(ldv_func_arg1); mutex_lock(ldv_func_arg1); }
These files are "linked" together by means of CIL that "merges" function definitions having the same signatures and warns users:Duplicate function skipped due to -ignoredupfn (ldv_mutex_lock_6) Duplicate function skipped due to -ignoredupfn (ldv_mutex_lock_6)
I'm going to try solution suggested in the issue description: add static storage class specifier for all auxiliary functions generated.
Updated by Evgeny Novikov about 12 years ago
Adding static and static inline specifiers, and turning off -ignoredupfn didn't help, CIL or BLAST "merges" function with the same signature from different files anyway (with static they warn about duplicates). Of course this is a bug in CIL or/and BLAST implementation but most likely we have to find appropriate solution on the basis of CIF. For instance, we can use a special file to put a current counter value there and use it for a following CIF invocations. Any thoughts?
Updated by Evgeny Novikov about 12 years ago
- Status changed from Open to Resolved
I implemented the idea of holding current unique number in a special file in commit 331ae8e of feature-2462 branch. It will be merged to master together with rerouter.
Updated by Evgeny Novikov about 12 years ago
Unfortunately there was a tricky bug in implementation. I noticed that 32_7a model hadn't any unsafe on 'drivers/media' drivers (but should have about 20). It turns out that CIF at the 4th stage didn't exchanged original function names in instrumented function calls with auxiliary ones.
Indeed each stage invokes gcc independently. Just 3d and 4th stages deal with auxiliary functions and require unique numbers. And it's important that both these stage has the same unique numbers to bind original function calls with auxiliary ones. But when 3d stage was completed file holding a current unique number was changed respectively. This led to at the 4th stage the first unique number was the last used at the 3d stage plus 1.
Bug fix is simple. Do not update unique number in the special file during the 3d stage. Commit 68ac0ac of feature-2462 implemented this fix.
Updated by Evgeny Novikov about 12 years ago
- Published in build set to 0491d9a
It was merged to master in commit 0491d9a together with feature-2462 branch.
Updated by Evgeny Novikov about 12 years ago
- Status changed from Resolved to Closed
It works stably. So close it.
Updated by Evgeny Novikov about 12 years ago
- Project changed from Linux Driver Verification to C Instrumentation Framework
- Category deleted (
15)