From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: Cyrill Gorcunov <gorcunov@gmail.com>, tml <tarantool-patches@dev.tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v8 1/2] fiber: set diagnostics at madvise/mprotect failure Date: Thu, 20 Feb 2020 22:30:48 +0100 [thread overview] Message-ID: <dbe56094-4c1d-38be-4b6b-7144a2bdf1c5@tarantool.org> (raw) In-Reply-To: <20200214132220.29830-2-gorcunov@gmail.com> Hi! Thanks for the patch! > diff --git a/src/lib/core/fiber.c b/src/lib/core/fiber.c > index 00ae8cded..f10687b29 100644 > --- a/src/lib/core/fiber.c > +++ b/src/lib/core/fiber.c > @@ -1007,6 +1035,8 @@ fiber_stack_watermark_create(struct fiber *fiber) > static void > fiber_stack_destroy(struct fiber *fiber, struct slab_cache *slabc) > { > + static const int mprotect_flags = PROT_READ | PROT_WRITE; > + Well, seems like you won't change this. Ok, since I can't do anything about that, I have nothing to do but to say the patchset is ok. > if (fiber->stack != NULL) { > VALGRIND_STACK_DEREGISTER(fiber->stack_id); > #if ENABLE_ASAN > @@ -1017,7 +1047,22 @@ fiber_stack_destroy(struct fiber *fiber, struct slab_cache *slabc) > guard = page_align_down(fiber->stack - page_size); > else > guard = page_align_up(fiber->stack + fiber->stack_size); > - fiber_mprotect(guard, page_size, PROT_READ | PROT_WRITE); > + > + if (fiber_mprotect(guard, page_size, mprotect_flags) != 0) { > + /* > + * FIXME: We need some intelligent handling: > + * say put this slab into a queue and retry > + * to setup the original protection back in > + * background. > + * > + * Note that in case if we're called from > + * fiber_stack_create() the @a mprotect_flags is You could just say "protection flags are the same as the slab..." instead of mentioning a variable here. If you didn't think that enum would be good here.
next prev parent reply other threads:[~2020-02-20 21:30 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-02-14 13:22 [Tarantool-patches] [PATCH v8 0/2] fiber: Handle stack madvise/mprotect errors Cyrill Gorcunov 2020-02-14 13:22 ` [Tarantool-patches] [PATCH v8 1/2] fiber: set diagnostics at madvise/mprotect failure Cyrill Gorcunov 2020-02-20 21:30 ` Vladislav Shpilevoy [this message] 2020-02-14 13:22 ` [Tarantool-patches] [PATCH v8 2/2] fiber: leak slab if unable to bring prots back Cyrill Gorcunov 2020-02-14 14:17 ` Konstantin Osipov 2020-02-14 14:22 ` Cyrill Gorcunov 2020-02-14 14:29 ` Konstantin Osipov 2020-02-14 14:31 ` Cyrill Gorcunov 2020-02-20 21:00 ` Alexander Turenko 2020-02-21 7:15 ` Konstantin Osipov 2020-02-24 19:25 ` [Tarantool-patches] [PATCH v8 0/2] fiber: Handle stack madvise/mprotect errors Kirill Yukhin 2020-02-24 19:31 ` Cyrill Gorcunov
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=dbe56094-4c1d-38be-4b6b-7144a2bdf1c5@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=gorcunov@gmail.com \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v8 1/2] fiber: set diagnostics at madvise/mprotect failure' \ /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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox