public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v5] Add a test case for mmap MAP_GROWSDOWN flag
Date: Fri, 11 Sep 2020 09:05:40 +0200	[thread overview]
Message-ID: <20200911070540.GA22970@dell5510> (raw)
In-Reply-To: <20200911035533.30538-1-liwang@redhat.com>

Hi Li,

> From: pravin <pravinraghul@zilogic.com>

> We assign the memory region allocated using MAP_GROWSDOWN to a thread,
> as a stack, to test the effect of MAP_GROWSDOWN. This is because the
> kernel only grows the memory region when the stack pointer, is within
> guard page, when the guard page is touched.

>   1. Map an anyonymous memory region of size X, and unmap it.
>   2. Split the unmapped memory region into two.
>   3. The lower memory region is left unmapped.
>   4. The higher memory region is mapped for use as stack, using MAP_FIXED | MAP_GROWSDOWN.
>   5. The higher memory region is provided as stack to a thread, where
>      a recursive function is invoked.
>   6. The stack grows beyond the allocated region, into the lower memory area.
>   7. If this results in the memory region being extended, into the
>      unmapped region, the test is considered to have passed.

> Also, to verify that(Test2) the stack grows to within a page of the high
> end of the next lower map?ping will result in a SIGSEGV signal.

> Resolves #300
> Signed-off-by: Pravin Raghul S. <pravinraghul@zilogic.com>
> Reviewed-by: Vijay Kumar B. <vijaykumar@zilogic.com>
> Signed-off-by: Li Wang <liwang@redhat.com>
> Cc: Cyril Hrubis <chrubis@suse.cz>

Reviewed-by: Petr Vorel <pvorel@suse.cz>
LGTM.

Just please fix using spaces instead of tabs in check_stackgrow_up() and
run_test() (I suppose your modifications to pravis's code):

mmap18.c:55: WARNING: please, no spaces at the start of a line
mmap18.c:55: WARNING: suspect code indent for conditional statements (7, 15)
mmap18.c:56: ERROR: code indent should use tabs where possible
mmap18.c:56: WARNING: please, no spaces at the start of a line
mmap18.c:57: ERROR: code indent should use tabs where possible
mmap18.c:57: WARNING: please, no spaces at the start of a line
mmap18.c:58: WARNING: please, no spaces at the start of a line
mmap18.c:60: WARNING: please, no spaces at the start of a line
mmap18.c:167: ERROR: code indent should use tabs where possible
mmap18.c:167: WARNING: please, no spaces at the start of a line
mmap18.c:169: ERROR: code indent should use tabs where possible
mmap18.c:169: WARNING: please, no spaces at the start of a line
mmap18.c:170: ERROR: code indent should use tabs where possible
mmap18.c:170: WARNING: please, no spaces at the start of a line


Kind regards,
Petr

  reply	other threads:[~2020-09-11  7:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-11  3:55 [LTP] [PATCH v5] Add a test case for mmap MAP_GROWSDOWN flag Li Wang
2020-09-11  7:05 ` Petr Vorel [this message]
2020-09-11  7:42   ` Li Wang
2020-09-11 13:08 ` Cyril Hrubis
2020-09-11 14:41   ` Li Wang
2020-09-11 14:57     ` Cyril Hrubis
2020-09-14  3:06       ` Li Wang
2020-09-14  3:40         ` Li Wang
2020-09-15 13:40         ` Cyril Hrubis
2020-09-18 11:43           ` Cyril Hrubis
2020-09-18 15:00             ` Li Wang

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=20200911070540.GA22970@dell5510 \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox