# Re: \[PATCH v19 5/8\] mm: introduce memfd\_secret system call to create "secret" memory areas

- From: David Hildenbrand \<hidden\>
- Date: 2021-05-18 10:06:55 
- List: linux-api
- Page: https://ratatoskr.run/linux-api/2021/05/206158
- Thread: https://ratatoskr.run/linux-api/2021/05/205953/t.md

```text
On 18.05.21 11:59, Michal Hocko wrote:
> On Sun 16-05-21 10:29:24, Mike Rapoport wrote:
>> On Fri, May 14, 2021 at 11:25:43AM +0200, David Hildenbrand wrote:
> [...]
>>>> +		if (!page)
>>>> +			return VM_FAULT_OOM;
>>>> +
>>>> +		err = set_direct_map_invalid_noflush(page, 1);
>>>> +		if (err) {
>>>> +			put_page(page);
>>>> +			return vmf_error(err);
>>>
>>> Would we want to translate that to a proper VM_FAULT_..., which would most
>>> probably be VM_FAULT_OOM when we fail to allocate a pagetable?
>>
>> That's what vmf_error does, it translates -ESOMETHING to VM_FAULT_XYZ.
>
> I haven't read through the rest but this has just caught my attention.
> Is it really reasonable to trigger the oom killer when you cannot
> invalidate the direct mapping. From a quick look at the code it is quite
> unlikely to se ENOMEM from that path (it allocates small pages) but this
> can become quite sublte over time. Shouldn't this simply SIGBUS if it
> cannot manipulate the direct mapping regardless of the underlying reason
> for that?
>

OTOH, it means our kernel zones are depleted, so we'd better reclaim somehow ...

-- 
Thanks,

David / dhildenb

```
