Quote:
Originally Posted by heroma
You say with “good programming practice and a correct design” we can guarantee the datas inside critical section. OK,Thanks. But I have a question about security of these datas and scheduling of scheduler.In sched.c scheduler invokes two functions release_kernel_lock() and reaquire_kernel_lock(). If scheduler retrieve BKL with release_kernel_lock(), BKL is free now and another process can catchs it or can manipulates the datas that previous process was doing something on them. I can’t understand the manner of scheduler with BKL.how a good programming guarantees the security? Please help me in this problem.
|
You wrote "If scheduler retrieve BKL with release_kernel_lock(), BKL is free now and another process can catchs it or can manipulates the datas that previous process was doing something on them."
Did you mean "If scheduler *releases* BKL with release_kernel_lock(), BKL is free now and another process can catchs it or can manipulates the datas that previous process was doing something on them."
If that is what you meant to write, then my comments I made before (which you replied to now) are about as good of an explanation as I can provide.
The point is that good programming practice dictates that everybody agrees to update certain resources ONLY WHILE HOLDING THE BKL! If anybody will write code that updates those resources while NOT holding the BKL then we will have corruption, race conditions, etc. (Bad programming practice!)
You said "BKL is free now and another process can catchs it or can manipulates the datas that previous process was doing something on them"
That is correct, and that is exactly my point. Don't free the BKL until you have committed or backed-out your updates. If you do it correctly, anybody who follows the same rules can get the BKL and expect to be able to synchronously update the same resource. Only by this protocol (everybody agrees to use the BKL and agrees NOT TO UPDATE THIS DATA without it) can you guarantee consistent data.
I can't say any more than this, as I have no knowledge of the Linux kernel.