api_spci_msg_recv accesses pending_and_enabled_count but doesn't lock it

47 views
Skip to first unread message

Sanguk Park

unread,
Aug 19, 2019, 1:57:53 AM8/19/19
to Hafnium
 At https://hafnium.googlesource.com/hafnium/+/refs/heads/master/src/api.c#1066 here, api_spci_msg_recv reads current->interrupts.pending_and_enabled_count but this function doesn't lock current->lock. Shouldn't it lock before read the variable?

Andrew Scull

unread,
Aug 20, 2019, 5:49:53 AM8/20/19
to Sanguk Park, Hafnium
Thanks for pointing this out, it should be locking, yes. There was also another case of the lock not being held in handler.c. I've uploaded a CL for this https://hafnium-review.googlesource.com/c/hafnium/+/6320.

Out of interest, how did you come across this issue?

On Mon, 19 Aug 2019 at 06:57, Sanguk Park <noorim...@gmail.com> wrote:
 At https://hafnium.googlesource.com/hafnium/+/refs/heads/master/src/api.c#1066 here, api_spci_msg_recv reads current->interrupts.pending_and_enabled_count but this function doesn't lock current->lock. Shouldn't it lock before read the variable?

--
You received this message because you are subscribed to the Google Groups "Hafnium" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hafnium-discu...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/hafnium-discuss/03b8c3b8-b16e-46fa-8dd7-19af91c2671d%40googlegroups.com.

Sanguk Park

unread,
Aug 20, 2019, 9:57:16 PM8/20/19
to Hafnium
Thank you for the good news!

I found this while I was porting Hafnium to Rust. Jeehoon Kang and I are currently working on this as a part of Hafnium verification.

2019년 8월 20일 화요일 오후 6시 49분 53초 UTC+9, Andrew Scull 님의 말:
Thanks for pointing this out, it should be locking, yes. There was also another case of the lock not being held in handler.c. I've uploaded a CL for this https://hafnium-review.googlesource.com/c/hafnium/+/6320.

Out of interest, how did you come across this issue?

On Mon, 19 Aug 2019 at 06:57, Sanguk Park <noori...@gmail.com> wrote:
 At https://hafnium.googlesource.com/hafnium/+/refs/heads/master/src/api.c#1066 here, api_spci_msg_recv reads current->interrupts.pending_and_enabled_count but this function doesn't lock current->lock. Shouldn't it lock before read the variable?

--
You received this message because you are subscribed to the Google Groups "Hafnium" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hafnium...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages