On Thu, Jan 18, 2024 at 3:30 PM <lizhe.67@xxxxxxxxxxxxx> wrote: > > Yes I am trying to add custom poison/unpoison functions which can monitor > memory in a fine-grained manner, and not affect the original functionality > of kasan. For example, for a 100-byte variable, I may only want to monitor > certain two bytes (byte 3 and 4) in it. According to my understanding, > kasan_poison/unpoison() can not detect the middle bytes individually. So I > don't think function kasan_poison/unpoison() can do what I want. I'm not sure this type of tracking belongs within KASAN. If there are only a few locations you want to monitor, perhaps a separate tools based on watchpoints would make more sense? Another alternative is to base this functionality on KMSAN: it already allows for bit-level precision. Plus, it would allow to only report when the marked memory is actually being used, not when it's just being copied. Perhaps Alexander can comment on whether this makes sense. If we decide to add this to KASAN or KMSAN, we need to least also add some in-tree users to demonstrate the functionality. And it would be great to find some bugs with it, but perhaps syzbot will be able to take care of that. Thank you!