Re: [RFC][PATCH] uprobe: support for private hugetlb mappings

From: David Hildenbrand
Date: Mon Apr 22 2024 - 05:39:46 EST


On 19.04.24 20:37, Guillaume Morin wrote:
libhugetlbfs, the Intel iodlr code both allow to remap .text onto a
hugetlb private mapping. It's also pretty easy to do it manually.
One drawback of using this functionality is the lack of support for
uprobes (NOTE uprobe ignores shareable vmas)

This patch adds support for private hugetlb mappings. It does require exposing
some hugetlbfs innards and relies on copy_user_large_folio which is only
available when CONFIG_HUGETLBFS is used so I had to use an ugly #ifdef

If there is some interest in applying this patch in some form or
another, I am open to any refactoring suggestions (esp getting rid the
#ifdef in uprobes.c) . I tried to limit the
amount of branching.

All that hugetlb special casing .... oh my. What's the benefit why we should be interested in making that code less clean -- to phrase it in a nice way ;) ?

Yes, libhugetlbfs exists. But why do we have to support uprobes with it? Nobody cared until now, why care now?

--
Cheers,

David / dhildenb