All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [PATCH 1/1] sandbox: handling out of memory
Date: Sun, 5 Jul 2020 21:37:52 -0400	[thread overview]
Message-ID: <CAPnjgZ0wdDq9ShoySGOy4RXUs+bhsdP5y-rFpTNqbZKCVC5_qA@mail.gmail.com> (raw)
In-Reply-To: <CAPnjgZ1CeLyj1dhsPjHr7yXoakxFqhXdxhTrpBKBOT1MYgitiQ@mail.gmail.com>

On 6/7/20 4:02 PM, Heinrich Schuchardt wrote:
> Am June 7, 2020 1:45:53 PM UTC schrieb Simon Glass <sjg@chromium.org>:
>> Hi Heinrich,
>>
>> On Thu, 4 Jun 2020 at 11:28, Heinrich Schuchardt <xypron.glpk@gmx.de>
>> wrote:
>>>
>>> assert() only works in debug mode. So checking a successful memory
>>> allocation should not use assert().
>>>
>>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>
>> What sort of environment are you using that returns NULL in this case?
>
> You will get NULL here if mmap() fails. This should happen if your machine has less then 128 MiB left over or you increase the RAM size of the sandbox.
>
> For testing I suggest you increase the sandbox memory size beyond the RAM and swap size of your computer.
>
> Best regards
>
> Heinrich

An excessive RAM sandbox w/o the patch:

$ ./u-boot
Segmentation fault

with the patch

$ ./u-boot
Out of memory

Best regards

Heinrich

>
>>
>> Regards,
>> Simon
>>
>>
>>> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
>>> ---
>>>  arch/sandbox/cpu/state.c | 5 ++++-
>>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>>
Applied to u-boot-dm/next, thanks!
Applied to u-boot-dm/next, thanks!

      parent reply	other threads:[~2020-07-06  1:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-04 17:28 [PATCH 1/1] sandbox: handling out of memory Heinrich Schuchardt
2020-06-07 13:45 ` Simon Glass
2020-06-07 14:02   ` Heinrich Schuchardt
2020-06-07 16:54     ` Heinrich Schuchardt
2020-07-06  1:34     ` Simon Glass
2020-07-06  1:37     ` Simon Glass [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPnjgZ0wdDq9ShoySGOy4RXUs+bhsdP5y-rFpTNqbZKCVC5_qA@mail.gmail.com \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.