OpenMPDK / KVSSD

KV SSD host software including APIs and drivers
Other
230 stars 55 forks source link

likely data race conditions in ioctl handling #25

Open deponty opened 5 years ago

deponty commented 5 years ago

Location (Korea, USA, China, India, etc.) USA, San Diego

Describe the bug There are probably some data race conditions in the 4.15 version of the driver. The pattern:

One issue is that by the time you get the variable, another thread has the opportunity to write to it. Another issue is that 2 or more threads may read the same variable, then independently increment it and write it back out. Instead of being incremented twice, it's only incremented once. I'm not claiming that the code is incrementing a variable, I'm simply highlighting this as a potential problem. The correct pattern is:

Note: there is a spinlock acquire of a critical section that has been commented out. This is definitely a race condition.

To Reproduce Steps to reproduce the behavior:

  1. It's obvious upon reading the code

Expected behavior A clear and concise description of what you expected to happen. See above

Screenshots If applicable, add screenshots to help explain your problem. It's in the code, primarily in core.c

System environment (please complete the following information)

Workload

Additional context Add any other context about the problem here. See above

david.evans@samsung.com

ilgulove commented 5 years ago

Dear, David.

Problem is not clear,

which line in core.c?

Please, provide detailed information and it will be very helpful also test scenario and code.

thanks in advance.