Feature #7909
openAdd model for macro IDR_INIT (rule specification linux:lib:idr)
Added by Evgeny Novikov almost 8 years ago. Updated almost 8 years ago.
0%
Description
This looks like there are many false alarms due to lack of this model on many various versions of the Linux kernel including 3.14. In addition corresponding test cases should be added (at least safe shouldn't be detected in case of absence of the model).
Updated by Vitaly Mordan almost 8 years ago
For kernels ~2.6.33 fixed in branch fix_153_2.6.33.
Updated by Evgeny Novikov almost 8 years ago
I still don't observe a test case so the issue wasn't fixed.
Updated by Vitaly Mordan almost 8 years ago
Tests are executed in 3.14, this problem can not be found there. Test will be pointless.
Updated by Evgeny Novikov almost 8 years ago
Updated by Evgeny Novikov almost 8 years ago
The model implemented is incorrect, since usually DEFINE_IDR is used in the global scope, while you modeled it as a function call. The test case is incorrect because of you mixed declarations (DEFINE_IDR) and expressions. Most likely you didn't even try your model on real Linux kernel modules with false alarms.
Updated by Vitaly Mordan almost 8 years ago
The real problem is that klever does not support static initialization by such macros, as old LDV Tools did:
[% FOREACH sign = static_inits; PROCESS make_human_sign %]
One more degradation of klever.
Updated by Vitaly Mordan almost 8 years ago
I changed rule linux:idr by allowing multiple inits.
Now there is another false positive (module drivers/scsi/sg.ko), it looks like because of EMG.
Updated by Evgeny Novikov almost 8 years ago
I don't see any changes in this branch in the repository. Also I hope that you fix and try the developed test case.
Updated by Evgeny Novikov almost 8 years ago
Updated by Vitaly Mordan almost 8 years ago
Commited again.
Rule linux:idr and its tests are adjusted.
Updated by Evgeny Novikov almost 8 years ago
- Status changed from New to Resolved
- Assignee changed from Vitaly Mordan to Evgeny Novikov
I made everything required in branch fix-linux-lib-idr. Correct tests are passed. The false alarm for Linux 2.6.33 has gone. But instead 4 new interesting unsafes were reported. Ilja Zakharov will review and print statistics here. After that we will decide what to do further.
Updated by Vitaly Mordan almost 8 years ago
Of course, you made it incorrect.
If you initialize each idr with
ldv_idr_sg_index_idr = LDV_INITIALIZED
you need to check this value in ldv_check_final_state as well instead of LDV_NOT_INITIALIZED.
Updated by Vitaly Mordan almost 8 years ago
Evgeny Novikov wrote:
I made everything required in branch fix-linux-lib-idr. Correct tests are passed. The false alarm for Linux 2.6.33 has gone. But instead 4 new interesting unsafes were reported. Ilja Zakharov will review and print statistics here. After that we will decide what to do further.
All those unsafes are false alarms.
Updated by Alexey Khoroshilov almost 8 years ago
- Status changed from Resolved to Open
Updated by Evgeny Novikov almost 8 years ago
- Assignee deleted (
Evgeny Novikov) - Priority changed from Immediate to High
One day one will eventually spend much time to fix this rule specification.