public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] LTP release
Date: Wed, 9 Sep 2020 15:13:27 +0200	[thread overview]
Message-ID: <20200909131327.GA3241@yuki.lan> (raw)
In-Reply-To: <CAEemH2es3sMSfAar8Xj4_Vr+2nsD0isPws4v=8=csLyYROAQGQ@mail.gmail.com>

Hi!
> > Sounds reasonable. I tried to reserve more space for the mapping grows,
> > and that works for me:).
> >
> 
> To precisely, we could reserve 256 pages size at the end of the free-range
> memory to let the stack keep away from a preceding mapping in its growing
> then.
> (my only concern is the stack_guard_gap can be changed via kernel command
> line, but I assume that happen rarely, so here use the default 256 pages)
> 
> If there is no objection, I'd make these changes in patch V4.
> 
> --------
> 
> static void *find_free_range(size_t size)
> {
>     void *mem;
>     long stack_guard_gap = 256 * getpageszie();
> 
>     /*
>     * Since the newer kernel does not allow a MAP_GROWSDOWN mapping to grow
>     * closer than stack_guard_gap pages away from a preceding mapping.
>     * The guard then ensures that the next-highest mapped page remains more
>     * than stack_guard_gap below the lowest stack address, and if not then
>     * it will trigger a segfault. So, here let's reserve 256 pages memory
>     * spacing for stack growing safely.
>     */
>     mem = SAFE_MMAP(NULL, size + stack_guard_gap, PROT_READ | PROT_WRITE,
>                       MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
>     SAFE_MUNMAP(mem, size + stack_guard_gap);
> 
>     return mem;
> }
> 
> static void split_unmapped_plus_stack(void *start, size_t size)
> {
>     /* start           start + size
>     * +---------------------+----------------------+-----------+
>     * + unmapped            | mapped               | 256 pages |
>     * +---------------------+----------------------+-----------+
>     *                       stack
>     */

Shouldn't the 256 pages follow the unmapped part?

If I'm not mistaken if stack grows down the address decreases with stack
allocations, so it should be as:

| 256 pages | unmapped | mapped |


That would also mean that we should map the stack at address start +
total_size - size if I'm not mistaken. I guess that we can put all the
mess into a single function as well and have just allocate_stack() that
will find a suitable address, mmap the stack together, splitting this
into two functions is unnecessary confusing.

>     stack = SAFE_MMAP(start + size, size, PROT_READ | PROT_WRITE,
>                              MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS |
> MAP_GROWSDOWN,
>                              -1, 0);
> }

Also I would like to get rid of the -fno-optimize-sibling-calls in the
Makefile, this makes the test a bit fragile and less portable.

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2020-09-09 13:13 UTC|newest]

Thread overview: 197+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-08  7:31 [LTP] LTP release Cyril Hrubis
2020-09-08  7:37 ` Yang Xu
2020-09-08  7:45 ` Li Wang
2020-09-08 15:36   ` Cyril Hrubis
2020-09-09  8:46     ` Li Wang
2020-09-09 12:16       ` Li Wang
2020-09-09 13:13         ` Cyril Hrubis [this message]
2020-09-09 13:27           ` Cyril Hrubis
2020-09-10  7:19             ` Li Wang
2020-09-10  9:22               ` Li Wang
2020-09-14  7:52                 ` Cixi Geng
2020-09-14 11:00                   ` Cyril Hrubis
2020-09-14 17:51                     ` Bird, Tim
2020-09-15  1:18                       ` Cixi Geng
2020-09-15  9:59                       ` Cyril Hrubis
2020-09-10  7:12           ` Li Wang
2020-09-09 20:11 ` Petr Vorel
2020-09-10  8:45 ` Petr Vorel
2020-09-14 11:15   ` Cyril Hrubis
2020-09-14 22:30     ` Bird, Tim
2020-09-15  5:28       ` Petr Vorel
2020-09-18 14:57       ` Cyril Hrubis
2020-09-21 18:04         ` Bird, Tim
2020-09-22 18:21 ` Cyril Hrubis
2020-09-23  6:50   ` Li Wang
2020-09-23  6:58     ` Li Wang
2020-09-23  9:29       ` Petr Vorel
2020-09-23  9:42         ` Xiao Yang
2020-09-23 12:23       ` Xiao Yang
2020-09-23 12:56         ` Li Wang
  -- strict thread matches above, loose matches on Subject: below --
2023-01-16 13:31 Cyril Hrubis
2023-01-16 15:23 ` Richard Palethorpe
2023-01-16 16:31   ` Petr Vorel
2023-01-17  4:07     ` Wei Gao via ltp
2023-01-17  8:04       ` Petr Vorel
2023-01-17 11:02   ` Richard Palethorpe
2023-01-20 12:16 ` Cyril Hrubis
2023-01-24 12:47   ` Petr Vorel
2023-01-24 20:58     ` Petr Vorel
2021-05-06  7:19 [LTP] LTP Release Cyril Hrubis
2021-05-06  8:10 ` Petr Vorel
2021-05-06 13:02 ` Petr Vorel
2021-05-07 14:31   ` Petr Vorel
2021-05-10  9:11     ` Cyril Hrubis
2021-05-10 14:47       ` Petr Vorel
2021-05-10 14:58         ` Cyril Hrubis
2021-05-10 15:30           ` Martin Doucha
2021-05-10 16:49             ` Petr Vorel
2021-05-10 16:37               ` Cyril Hrubis
2021-05-10 17:24                 ` Petr Vorel
2021-05-06 15:35 ` Martin Doucha
2021-05-07  3:10 ` Li Wang
2021-05-07 12:40   ` Cyril Hrubis
2021-05-07 16:56 ` Petr Vorel
2021-05-10  7:17   ` Richard Palethorpe
2021-05-11 11:30 ` Cyril Hrubis
     [not found] <5ebe1570.1c69fb81.46edc.a08cSMTPIN_ADDED_BROKEN@mx.google.com>
2020-05-15  4:16 ` [LTP] LTP release Li Wang
2020-05-04 10:49 Cyril Hrubis
2020-05-04 11:09 ` Martin Doucha
2020-05-04 11:16   ` Cyril Hrubis
2020-05-14  9:54 ` Cyril Hrubis
2020-05-14  9:58   ` Yang Xu
2020-05-14 12:11     ` Cyril Hrubis
2020-05-14 13:45       ` Xiao Yang
2020-05-15  3:37   ` Li Wang
2019-09-06 13:07 [LTP] LTP Release Cyril Hrubis
2019-09-06 13:48 ` Richard Palethorpe
2019-09-09  7:46 ` Li Wang
2019-09-10 13:05   ` Cyril Hrubis
2019-09-26 10:43     ` Thadeu Lima de Souza Cascardo
2019-09-10  6:51 ` =?unknown-8bit?b?WWFuZy/lvpAg5p2o?=
2019-09-10 13:56   ` Cyril Hrubis
2019-09-13 13:07 ` Petr Vorel
2019-09-25 11:22 ` Cyril Hrubis
2019-09-26  8:29   ` Jan Stancek
2019-09-26  8:33     ` Cyril Hrubis
2019-09-26  8:54       ` Jan Stancek
2019-09-26  9:08         ` Cyril Hrubis
2019-09-26  9:52           ` Jan Stancek
2019-09-26  9:02   ` Li Wang
2019-04-18 11:18 Cyril Hrubis
2019-04-23  8:40 ` Petr Vorel
2019-04-26 13:12 ` Cyril Hrubis
2019-04-28  5:25   ` Li Wang
2019-04-29 11:59     ` Cyril Hrubis
2019-04-30  3:09       ` Li Wang
2019-04-29 10:20   ` Petr Vorel
2019-04-29 13:13     ` Cyril Hrubis
2019-04-29 14:33       ` Cyril Hrubis
2019-04-29 21:07         ` Petr Vorel
2019-04-30  9:05           ` Cyril Hrubis
2019-04-29 20:45       ` Petr Vorel
2019-04-30  9:04         ` Cyril Hrubis
2019-04-30 12:35           ` Petr Vorel
2019-05-14  7:16 ` Li Wang
2019-05-14 12:23   ` Cyril Hrubis
2019-05-15 13:55 ` Cyril Hrubis
2018-12-14 15:09 Cyril Hrubis
2018-12-18  9:17 ` Petr Vorel
2019-01-02 10:28 ` Cyril Hrubis
2019-01-04 15:42   ` Cyril Hrubis
2019-01-07  2:18     ` Xiao Yang
2019-01-11 13:25     ` Cyril Hrubis
2019-01-11 16:16       ` Cristian Marussi
2019-01-14 12:43         ` Petr Vorel
2018-08-30 15:53 [LTP] LTP release Cyril Hrubis
2018-08-31  5:20 ` vaishnavi.d
2017-12-20 11:33 Cyril Hrubis
2018-01-09 18:17 ` Cyril Hrubis
2018-01-09 18:47   ` Jan Stancek
2018-01-10  2:41     ` Li Wang
2018-01-10 11:26       ` Jan Stancek
2018-01-10 11:42         ` Cyril Hrubis
2018-01-12 14:33         ` Cyril Hrubis
2018-01-17 15:27           ` Cyril Hrubis
2018-01-12 14:46       ` Jan Stancek
2018-01-14  4:28         ` Li Wang
2018-01-12 13:32 ` Richard Palethorpe
2018-01-12 13:59   ` Cyril Hrubis
2017-09-07 10:59 Cyril Hrubis
2017-09-07 11:37 ` Petr Vorel
2017-09-07 19:53 ` Sandeep Patil
2017-09-08  1:49 ` Li Wang
2017-09-12  9:39 ` Richard Palethorpe
2017-09-12 12:16   ` Cyril Hrubis
2017-09-14 14:17 ` Jan Stancek
2017-09-14 15:14   ` Cyril Hrubis
     [not found] <mailman.23773.1493091760.712.ltp@lists.linux.it>
2017-04-26 15:33 ` Steve Ellcey
2017-04-24 16:25 Cyril Hrubis
2017-04-25  2:29 ` Li Wang
2017-04-26  9:08   ` Cyril Hrubis
2017-04-26 12:59     ` Jan Stancek
2017-04-27  2:51       ` Li Wang
2017-04-27  8:52         ` Jan Stancek
2017-04-25  3:42 ` Eryu Guan
2017-04-27 13:56 ` Richard Palethorpe
2017-04-27 14:02   ` Cyril Hrubis
2017-04-28 15:47 ` Cyril Hrubis
2017-05-03  7:02   ` Jan Stancek
2017-05-05 14:41   ` Cyril Hrubis
2017-05-05 15:41     ` Jan Stancek
2017-05-19  4:26       ` Daniel Sangorrin
2017-05-19  9:36         ` Cyril Hrubis
2017-05-19  9:46           ` Daniel Sangorrin
2016-09-14 11:29 [LTP] LTP Release Cyril Hrubis
2016-09-14 12:59 ` Jan Stancek
2016-09-14 13:51   ` Cyril Hrubis
2016-09-15 10:18 ` Alexey Kodanev
2016-09-19 12:11   ` Cyril Hrubis
2016-09-19 14:08     ` Alexey Kodanev
2016-09-16  8:22 ` Stanislav Kholmanskikh
2016-08-16 14:25 Cyril Hrubis
2016-08-17 14:42 ` Stanislav Kholmanskikh
2016-05-03 12:46 Cyril Hrubis
2016-05-04  2:28 ` Li Wang
2016-05-04  2:37   ` Li Wang
2016-05-04 11:56     ` Cyril Hrubis
2016-05-04 11:54   ` Cyril Hrubis
2016-05-05  6:13     ` Li Wang
2016-05-09 15:59 ` Cyril Hrubis
2016-05-09 16:12   ` Cyril Hrubis
2016-01-21 17:41 [LTP] LTP release Cyril Hrubis
2016-01-22 11:16 ` Jan Stancek
2016-01-25  9:48 ` Stanislav Kholmanskikh
2016-01-25 10:47 ` Alexey Kodanev
2016-01-25 12:20   ` Cyril Hrubis
2016-01-25 12:28 ` Cyril Hrubis
2016-01-26  6:41   ` Li Wang
2016-01-26  9:57   ` Stanislav Kholmanskikh
2015-08-13 12:30 Cyril Hrubis
2015-08-20 15:06 ` Cyril Hrubis
2015-08-31 11:23   ` Cyril Hrubis
     [not found]     ` <75454012.15990077.1441091460626.JavaMail.zimbra@redhat.com>
2015-09-01 11:43       ` Cyril Hrubis
     [not found]     ` <55E53DA4.6090005@cn.fujitsu.com>
2015-09-01 11:42       ` Cyril Hrubis
     [not found]         ` <1488894521.16163428.1441112961686.JavaMail.zimbra@redhat.com>
2015-09-01 13:14           ` Cyril Hrubis
2015-09-01 15:35       ` Cyril Hrubis
2015-09-02 11:28 ` Cyril Hrubis
2015-03-23  9:43 Cyril Hrubis
2015-04-02 10:09 ` Cyril Hrubis
     [not found]   ` <5523ED09.4050509@oracle.com>
2015-04-07 15:27     ` Cyril Hrubis
     [not found]       ` <552B91F1.3050901@oracle.com>
2015-04-14  9:19         ` Cyril Hrubis
2015-01-05 14:42 Cyril Hrubis
     [not found] ` <54B3FD5E.5040209@oracle.com>
2015-01-13  9:53   ` Cyril Hrubis
2014-12-18 13:48 Cyril Hrubis
2014-08-27  8:14 chrubis
2014-07-29 10:31 [LTP] LTP Release chrubis
2014-04-16 18:51 [LTP] LTP release chrubis
     [not found] ` <534ED26A.6040508@gmx.de>
2014-04-16 18:58   ` chrubis
2014-04-10 16:52 [LTP] LTP Release chrubis
     [not found] ` <5346F29E.7020402@oracle.com>
2014-04-14 11:58   ` chrubis
     [not found]     ` <534BE117.3070008@oracle.com>
2014-04-14 13:59       ` chrubis
2014-04-01 13:50 [LTP] LTP release Joseph Beckenbach
2014-04-01 14:22 ` chrubis
2014-03-31 16:03 [LTP] LTP Release chrubis
     [not found] ` <533A5F9C.6000907@oracle.com>
2014-04-01 10:58   ` chrubis
2014-01-14 12:05 [LTP] LTP release chrubis
2014-01-14 15:54 ` chrubis

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=20200909131327.GA3241@yuki.lan \
    --to=chrubis@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