Re: URCU feature request?
Thobias Knudsen via lttng-dev <[email protected]> Thu, 4 Sep 2025 20:09:03 +0200
| Newsgroups | org.lttng.lists.lttng-dev |
|---|---|
| Message-ID | <CAKGpcipgGfFwastwUrFxeA=BXW5z_9+C2PGuDyR1pQF8rtQe-Q@mail.gmail.com> |
--000000000000831509063dfd9e41 Content-Type: text/plain; charset="UTF-8" > One thing you could do is to make something like an rcu_assign_data() > that does the assignment and checks rcu_read_ongoing(). Alternatively, > if you are willing to put infrequent random delays in rcu_read_unlock(), > an address sanitizer might detect the resulting use-after-free. Sorry for being late to answer :/ I have thought of that but it's so easy to just not use rcu_assign_data() or a equivalent read function to check if the read is done within a read section. Maybe it's the best possible option Thanks Thobias tor. 4. sep. 2025 kl. 20:06 skrev Thobias Knudsen <[email protected]>: > > I am confuse about the overall discussion here. Are we talking about > > static checking of RCU pointers usage or runtime checking? > > > > Is is possible to see the implementation you made so I can understand > > better? > > Sorry for being late to answer :/ > The library overrides a subset of urcu and lfht functions with macros and > replaces them with other functions which checks in runtime if the functions > are called in the correct order. > here is the code: https://github.com/ThobiasKnudsen/urcu_lfht_safe > > > ons. 3. sep. 2025 kl. 03:35 skrev Olivier Dion <[email protected]>: > >> On Tue, 02 Sep 2025, Thobias Knudsen via lttng-dev < >> [email protected]> wrote: >> > Yes but all read/write operations doesn't have the syntax of a function >> as >> > you used in the example here i.e. use(...). When it is a function you >> can >> > easily just change the implementation to check if it is called inside a >> > read section. Some reads and writes are usually done by this syntax (a >> = b) >> > and '=' cannot be overridden. >> > >> > BTW just saying that what we're talking about now is not the original >> > topic, but if someone has an elegant solution to this that would be >> > nice! >> >> I am confuse about the overall discussion here. Are we talking about >> static checking of RCU pointers usage or runtime checking? >> >> Is is possible to see the implementation you made so I can understand >> better? >> >> Thanks, >> Olivier >> -- >> Olivier Dion >> EfficiOS Inc. >> https://www.efficios.com >> >> --000000000000831509063dfd9e41 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">> One thing you could do is to make something like an r= cu_assign_data()<br>> that does the assignment and checks rcu_read_ongoi= ng().=C2=A0 Alternatively,<br>> if you are willing to put infrequent ran= dom delays in rcu_read_unlock(),<br>> an address sanitizer might detect = the resulting use-after-free.<div><br></div><div>Sorry for being late to an= swer :/</div><div>I have thought of that but it's so easy to just not u= se rcu_assign_data() or a equivalent=C2=A0read function to check if the rea= d is done within a read section. Maybe it's the best possible option</d= iv><div><br></div><div>Thanks</div><div>Thobias</div></div><br><div class= =3D"gmail_quote gmail_quote_container"><div dir=3D"ltr" class=3D"gmail_attr= ">tor. 4. sep. 2025 kl. 20:06 skrev Thobias Knudsen <<a href=3D"mailto:t= [email protected]">[email protected]</a>>:<br></div><blockquote class=3D"= gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(20= 4,204,204);padding-left:1ex"><div dir=3D"ltr"><div>> I am confuse about = the overall discussion here.=C2=A0 Are we talking about<br>> static chec= king of RCU pointers usage or runtime checking?<br>>=C2=A0<br>> Is is= possible to see the implementation you made so I can understand<br>> be= tter?</div><div><br></div>Sorry for being late to answer=C2=A0:/<div>The li= brary overrides a subset of urcu and lfht functions with macros and replace= s them with other functions which checks in runtime if the=C2=A0functions a= re called in the correct order.</div><div>here is the code:=C2=A0<a href=3D= "https://github.com/ThobiasKnudsen/urcu_lfht_safe" target=3D"_blank">https:= //github.com/ThobiasKnudsen/urcu_lfht_safe</a><br><div><br></div></div></di= v><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">ons.= 3. sep. 2025 kl. 03:35 skrev Olivier Dion <<a href=3D"mailto:odion@effi= cios.com" target=3D"_blank">[email protected]</a>>:<br></div><blockquot= e class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px s= olid rgb(204,204,204);padding-left:1ex">On Tue, 02 Sep 2025, Thobias Knudse= n via lttng-dev <<a href=3D"mailto:[email protected]" target=3D"= _blank">[email protected]</a>> wrote:<br> > Yes but all read/write operations doesn't have the syntax of a fun= ction as<br> > you used in the example here i.e. use(...). When it is a function you = can<br> > easily just change the implementation to check if it is called inside = a<br> > read section. Some reads and writes are usually done by this syntax (a= =3D b)<br> > and '=3D' cannot be overridden.<br> ><br> > BTW just saying that what we're talking about now is not the origi= nal<br> > topic, but if someone has an elegant solution to this that would be<br= > > nice!<br> <br> I am confuse about the overall discussion here.=C2=A0 Are we talking about<= br> static checking of RCU pointers usage or runtime checking?<br> <br> Is is possible to see the implementation you made so I can understand<br> better?<br> <br> Thanks,<br> Olivier<br> -- <br> Olivier Dion<br> EfficiOS Inc.<br> <a href=3D"https://www.efficios.com" rel=3D"noreferrer" target=3D"_blank">h= ttps://www.efficios.com</a><br> <br> </blockquote></div> </blockquote></div> --000000000000831509063dfd9e41--