All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: Always print RLIMIT_DATA warning
@ 2018-02-06 16:45 ` David Woodhouse
  0 siblings, 0 replies; 8+ messages in thread
From: David Woodhouse @ 2018-02-06 16:45 UTC (permalink / raw)
  To: Konstantin Khlebnikov, Andrew Morton, Cyrill Gorcunov,
	Linus Torvalds, Vegard Nossum, Peter Zijlstra, Vladimir Davydov,
	Andy Lutomirski, Quentin Casasnovas, Kees Cook, Willy Tarreau,
	Pavel Emelyanov, Laura Abbott, linux-kernel, linux-mm

The documentation for ignore_rlimit_data says that it will print a warning
at first misuse. Yet it doesn't seem to do that. Fix the code to print
the warning even when we allow the process to continue.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
We should probably also do what Linus suggested in 
https://lkml.org/lkml/2016/9/16/585

 mm/mmap.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 9efdc021..dd76ea3 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -3184,13 +3184,15 @@ bool may_expand_vm(struct mm_struct *mm, vm_flags_t flags, unsigned long npages)
 		if (rlimit(RLIMIT_DATA) == 0 &&
 		    mm->data_vm + npages <= rlimit_max(RLIMIT_DATA) >> PAGE_SHIFT)
 			return true;
-		if (!ignore_rlimit_data) {
-			pr_warn_once("%s (%d): VmData %lu exceed data ulimit %lu. Update limits or use boot option ignore_rlimit_data.\n",
-				     current->comm, current->pid,
-				     (mm->data_vm + npages) << PAGE_SHIFT,
-				     rlimit(RLIMIT_DATA));
+
+		pr_warn_once("%s (%d): VmData %lu exceed data ulimit %lu. Update limits%s.\n",
+			     current->comm, current->pid,
+			     (mm->data_vm + npages) << PAGE_SHIFT,
+			     rlimit(RLIMIT_DATA),
+			     ignore_rlimit_data ? "" : " or use boot option ignore_rlimit_data");
+
+		if (!ignore_rlimit_data)
 			return false;
-		}
 	}
 
 	return true;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] mm: Always print RLIMIT_DATA warning
@ 2018-02-06 16:45 ` David Woodhouse
  0 siblings, 0 replies; 8+ messages in thread
From: David Woodhouse @ 2018-02-06 16:45 UTC (permalink / raw)
  To: Konstantin Khlebnikov, Andrew Morton, Cyrill Gorcunov,
	Linus Torvalds, Vegard Nossum, Peter Zijlstra, Vladimir Davydov,
	Andy Lutomirski, Quentin Casasnovas, Kees Cook, Willy Tarreau,
	Pavel Emelyanov, Laura Abbott, linux-kernel, linux-mm

The documentation for ignore_rlimit_data says that it will print a warning
at first misuse. Yet it doesn't seem to do that. Fix the code to print
the warning even when we allow the process to continue.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
We should probably also do what Linus suggested in 
https://lkml.org/lkml/2016/9/16/585

 mm/mmap.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 9efdc021..dd76ea3 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -3184,13 +3184,15 @@ bool may_expand_vm(struct mm_struct *mm, vm_flags_t flags, unsigned long npages)
 		if (rlimit(RLIMIT_DATA) == 0 &&
 		    mm->data_vm + npages <= rlimit_max(RLIMIT_DATA) >> PAGE_SHIFT)
 			return true;
-		if (!ignore_rlimit_data) {
-			pr_warn_once("%s (%d): VmData %lu exceed data ulimit %lu. Update limits or use boot option ignore_rlimit_data.\n",
-				     current->comm, current->pid,
-				     (mm->data_vm + npages) << PAGE_SHIFT,
-				     rlimit(RLIMIT_DATA));
+
+		pr_warn_once("%s (%d): VmData %lu exceed data ulimit %lu. Update limits%s.\n",
+			     current->comm, current->pid,
+			     (mm->data_vm + npages) << PAGE_SHIFT,
+			     rlimit(RLIMIT_DATA),
+			     ignore_rlimit_data ? "" : " or use boot option ignore_rlimit_data");
+
+		if (!ignore_rlimit_data)
 			return false;
-		}
 	}
 
 	return true;
-- 
2.7.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] mm: Always print RLIMIT_DATA warning
  2018-02-06 16:45 ` David Woodhouse
@ 2018-02-06 17:27   ` Cyrill Gorcunov
  -1 siblings, 0 replies; 8+ messages in thread
From: Cyrill Gorcunov @ 2018-02-06 17:27 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Konstantin Khlebnikov, Andrew Morton, Linus Torvalds,
	Vegard Nossum, Peter Zijlstra, Vladimir Davydov, Andy Lutomirski,
	Quentin Casasnovas, Kees Cook, Willy Tarreau, Pavel Emelyanov,
	Laura Abbott, linux-kernel, linux-mm

On Tue, Feb 06, 2018 at 04:45:05PM +0000, David Woodhouse wrote:
> The documentation for ignore_rlimit_data says that it will print a warning
> at first misuse. Yet it doesn't seem to do that. Fix the code to print
> the warning even when we allow the process to continue.
> 
> Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
> ---
> We should probably also do what Linus suggested in 
> https://lkml.org/lkml/2016/9/16/585
> 

Might be typo in docs I guess, Kostya?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] mm: Always print RLIMIT_DATA warning
@ 2018-02-06 17:27   ` Cyrill Gorcunov
  0 siblings, 0 replies; 8+ messages in thread
From: Cyrill Gorcunov @ 2018-02-06 17:27 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Konstantin Khlebnikov, Andrew Morton, Linus Torvalds,
	Vegard Nossum, Peter Zijlstra, Vladimir Davydov, Andy Lutomirski,
	Quentin Casasnovas, Kees Cook, Willy Tarreau, Pavel Emelyanov,
	Laura Abbott, linux-kernel, linux-mm

On Tue, Feb 06, 2018 at 04:45:05PM +0000, David Woodhouse wrote:
> The documentation for ignore_rlimit_data says that it will print a warning
> at first misuse. Yet it doesn't seem to do that. Fix the code to print
> the warning even when we allow the process to continue.
> 
> Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
> ---
> We should probably also do what Linus suggested in 
> https://lkml.org/lkml/2016/9/16/585
> 

Might be typo in docs I guess, Kostya?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] mm: Always print RLIMIT_DATA warning
  2018-02-06 17:27   ` Cyrill Gorcunov
  (?)
@ 2018-02-06 17:30   ` David Woodhouse
  -1 siblings, 0 replies; 8+ messages in thread
From: David Woodhouse @ 2018-02-06 17:30 UTC (permalink / raw)
  To: Cyrill Gorcunov
  Cc: Konstantin Khlebnikov, Andrew Morton, Linus Torvalds,
	Vegard Nossum, Peter Zijlstra, Vladimir Davydov, Andy Lutomirski,
	Quentin Casasnovas, Kees Cook, Willy Tarreau, Pavel Emelyanov,
	Laura Abbott, linux-kernel, linux-mm

[-- Attachment #1: Type: text/plain, Size: 634 bytes --]



On Tue, 2018-02-06 at 20:27 +0300, Cyrill Gorcunov wrote:
> On Tue, Feb 06, 2018 at 04:45:05PM +0000, David Woodhouse wrote:
> > 
> > The documentation for ignore_rlimit_data says that it will print a warning
> > at first misuse. Yet it doesn't seem to do that. Fix the code to print
> > the warning even when we allow the process to continue.
> > 
> > Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
> > ---
> > We should probably also do what Linus suggested in 
> > https://lkml.org/lkml/2016/9/16/585
> > 
> Might be typo in docs I guess, Kostya?

I prefer the documented behaviour to the actual behaviour :)

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5213 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] mm: Always print RLIMIT_DATA warning
  2018-02-06 16:45 ` David Woodhouse
@ 2018-02-06 17:48   ` Konstantin Khlebnikov
  -1 siblings, 0 replies; 8+ messages in thread
From: Konstantin Khlebnikov @ 2018-02-06 17:48 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Andrew Morton, Cyrill Gorcunov, Linus Torvalds, Vegard Nossum,
	Peter Zijlstra, Vladimir Davydov, Andy Lutomirski,
	Quentin Casasnovas, Kees Cook, Willy Tarreau, Pavel Emelyanov,
	Laura Abbott, Linux Kernel Mailing List, linux-mm

On Tue, Feb 6, 2018 at 7:45 PM, David Woodhouse <dwmw@amazon.co.uk> wrote:
> The documentation for ignore_rlimit_data says that it will print a warning
> at first misuse. Yet it doesn't seem to do that. Fix the code to print
> the warning even when we allow the process to continue.

Ack. But I think this was a misprint in docs.
Anyway, this knob is a kludge so we might warn once even if it is set.

So, somebody still have problems with this change?
I remember concerns about that "warn_once" isn't enough to detect
what's going wrong.
And probably we should invent  "warn_sometimes".

>
> Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
> ---
> We should probably also do what Linus suggested in
> https://lkml.org/lkml/2016/9/16/585
>
>  mm/mmap.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 9efdc021..dd76ea3 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -3184,13 +3184,15 @@ bool may_expand_vm(struct mm_struct *mm, vm_flags_t flags, unsigned long npages)
>                 if (rlimit(RLIMIT_DATA) == 0 &&
>                     mm->data_vm + npages <= rlimit_max(RLIMIT_DATA) >> PAGE_SHIFT)
>                         return true;
> -               if (!ignore_rlimit_data) {
> -                       pr_warn_once("%s (%d): VmData %lu exceed data ulimit %lu. Update limits or use boot option ignore_rlimit_data.\n",
> -                                    current->comm, current->pid,
> -                                    (mm->data_vm + npages) << PAGE_SHIFT,
> -                                    rlimit(RLIMIT_DATA));
> +
> +               pr_warn_once("%s (%d): VmData %lu exceed data ulimit %lu. Update limits%s.\n",
> +                            current->comm, current->pid,
> +                            (mm->data_vm + npages) << PAGE_SHIFT,
> +                            rlimit(RLIMIT_DATA),
> +                            ignore_rlimit_data ? "" : " or use boot option ignore_rlimit_data");
> +
> +               if (!ignore_rlimit_data)
>                         return false;
> -               }
>         }
>
>         return true;
> --
> 2.7.4
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] mm: Always print RLIMIT_DATA warning
@ 2018-02-06 17:48   ` Konstantin Khlebnikov
  0 siblings, 0 replies; 8+ messages in thread
From: Konstantin Khlebnikov @ 2018-02-06 17:48 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Andrew Morton, Cyrill Gorcunov, Linus Torvalds, Vegard Nossum,
	Peter Zijlstra, Vladimir Davydov, Andy Lutomirski,
	Quentin Casasnovas, Kees Cook, Willy Tarreau, Pavel Emelyanov,
	Laura Abbott, Linux Kernel Mailing List, linux-mm

On Tue, Feb 6, 2018 at 7:45 PM, David Woodhouse <dwmw@amazon.co.uk> wrote:
> The documentation for ignore_rlimit_data says that it will print a warning
> at first misuse. Yet it doesn't seem to do that. Fix the code to print
> the warning even when we allow the process to continue.

Ack. But I think this was a misprint in docs.
Anyway, this knob is a kludge so we might warn once even if it is set.

So, somebody still have problems with this change?
I remember concerns about that "warn_once" isn't enough to detect
what's going wrong.
And probably we should invent  "warn_sometimes".

>
> Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
> ---
> We should probably also do what Linus suggested in
> https://lkml.org/lkml/2016/9/16/585
>
>  mm/mmap.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 9efdc021..dd76ea3 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -3184,13 +3184,15 @@ bool may_expand_vm(struct mm_struct *mm, vm_flags_t flags, unsigned long npages)
>                 if (rlimit(RLIMIT_DATA) == 0 &&
>                     mm->data_vm + npages <= rlimit_max(RLIMIT_DATA) >> PAGE_SHIFT)
>                         return true;
> -               if (!ignore_rlimit_data) {
> -                       pr_warn_once("%s (%d): VmData %lu exceed data ulimit %lu. Update limits or use boot option ignore_rlimit_data.\n",
> -                                    current->comm, current->pid,
> -                                    (mm->data_vm + npages) << PAGE_SHIFT,
> -                                    rlimit(RLIMIT_DATA));
> +
> +               pr_warn_once("%s (%d): VmData %lu exceed data ulimit %lu. Update limits%s.\n",
> +                            current->comm, current->pid,
> +                            (mm->data_vm + npages) << PAGE_SHIFT,
> +                            rlimit(RLIMIT_DATA),
> +                            ignore_rlimit_data ? "" : " or use boot option ignore_rlimit_data");
> +
> +               if (!ignore_rlimit_data)
>                         return false;
> -               }
>         }
>
>         return true;
> --
> 2.7.4
>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] mm: Always print RLIMIT_DATA warning
  2018-02-06 17:48   ` Konstantin Khlebnikov
  (?)
@ 2018-02-07 13:03   ` David Woodhouse
  -1 siblings, 0 replies; 8+ messages in thread
From: David Woodhouse @ 2018-02-07 13:03 UTC (permalink / raw)
  To: Konstantin Khlebnikov
  Cc: Andrew Morton, Cyrill Gorcunov, Linus Torvalds, Vegard Nossum,
	Peter Zijlstra, Vladimir Davydov, Andy Lutomirski,
	Quentin Casasnovas, Kees Cook, Willy Tarreau, Pavel Emelyanov,
	Laura Abbott, Linux Kernel Mailing List, linux-mm

[-- Attachment #1: Type: text/plain, Size: 1027 bytes --]



On Tue, 2018-02-06 at 20:48 +0300, Konstantin Khlebnikov wrote:
> On Tue, Feb 6, 2018 at 7:45 PM, David Woodhouse <dwmw@amazon.co.uk> wrote:
> > 
> > The documentation for ignore_rlimit_data says that it will print a warning
> > at first misuse. Yet it doesn't seem to do that. Fix the code to print
> > the warning even when we allow the process to continue.
>
> Ack. But I think this was a misprint in docs.
> Anyway, this knob is a kludge so we might warn once even if it is set.

Right. I think we definitely should. Otherwise, once set, there's no
real path to ever being able to *unset* it. Nothing well ever get
fixed.

> So, somebody still have problems with this change?
> I remember concerns about that "warn_once" isn't enough to detect
> what's going wrong.
> And probably we should invent  "warn_sometimes".

That was covered by "should probably also do what Linus suggested…":

> > ---
> > We should probably also do what Linus suggested in
> > https://lkml.org/lkml/2016/9/16/585

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5213 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-02-07 13:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-06 16:45 [PATCH] mm: Always print RLIMIT_DATA warning David Woodhouse
2018-02-06 16:45 ` David Woodhouse
2018-02-06 17:27 ` Cyrill Gorcunov
2018-02-06 17:27   ` Cyrill Gorcunov
2018-02-06 17:30   ` David Woodhouse
2018-02-06 17:48 ` Konstantin Khlebnikov
2018-02-06 17:48   ` Konstantin Khlebnikov
2018-02-07 13:03   ` David Woodhouse

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.