* [PATCH] add kernel log when allocate a new virtual mapping failed because of overcommit
@ 2021-06-30 7:44 Xu Huijie
2021-06-30 13:29 ` Matthew Wilcox
0 siblings, 1 reply; 2+ messages in thread
From: Xu Huijie @ 2021-06-30 7:44 UTC (permalink / raw)
To: linux-mm; +Cc: wuxu.wu
From: xuhuijie <xuhuijie2@huawei.com>
diff --git a/mm/mmap.c b/mm/mmap.c
index aa9de981b..f019fc6b2 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1758,8 +1758,10 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
*/
if (accountable_mapping(file, vm_flags)) {
charged = len >> PAGE_SHIFT;
- if (security_vm_enough_memory_mm(mm, charged))
+ if (security_vm_enough_memory_mm(mm, charged)) {
+ pr_err("Unable to allocate a new virtual mapping because of the overcommit\n");
return -ENOMEM;
+ }
vm_flags |= VM_ACCOUNT;
}
--
2.23.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] add kernel log when allocate a new virtual mapping failed because of overcommit
2021-06-30 7:44 [PATCH] add kernel log when allocate a new virtual mapping failed because of overcommit Xu Huijie
@ 2021-06-30 13:29 ` Matthew Wilcox
0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2021-06-30 13:29 UTC (permalink / raw)
To: Xu Huijie; +Cc: linux-mm, wuxu.wu
On Wed, Jun 30, 2021 at 03:44:33PM +0800, Xu Huijie wrote:
> From: xuhuijie <xuhuijie2@huawei.com>
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index aa9de981b..f019fc6b2 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -1758,8 +1758,10 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
> */
> if (accountable_mapping(file, vm_flags)) {
> charged = len >> PAGE_SHIFT;
> - if (security_vm_enough_memory_mm(mm, charged))
> + if (security_vm_enough_memory_mm(mm, charged)) {
> + pr_err("Unable to allocate a new virtual mapping because of the overcommit\n");
No, we don't let unprivileged processes flood the kernel logs. If this
is genuinely useful, something like pr_info_ratelimited() might be
appropriate. It certainly doesn't rise to the level of "error".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-30 13:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-30 7:44 [PATCH] add kernel log when allocate a new virtual mapping failed because of overcommit Xu Huijie
2021-06-30 13:29 ` Matthew Wilcox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox