[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH V5 1/6] oslib-posix: add helpers for stack alloc
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH V5 1/6] oslib-posix: add helpers for stack alloc and free |
Date: |
Tue, 12 Jul 2016 11:30:36 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 07/12/2016 10:23 AM, Peter Lieven wrote:
> the allocated stack will be adjusted to the minimum supported stack size
> by the OS and rounded up to be a multiple of the system pagesize.
> Additionally an architecture dependent guard page is added to the stack
> to catch stack overflows.
>
> Signed-off-by: Peter Lieven <address@hidden>
> ---
> include/sysemu/os-posix.h | 23 +++++++++++++++++++++++
> util/oslib-posix.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 69 insertions(+)
>
> +static size_t adjust_stack_size(size_t sz)
> +{
> +#ifdef _SC_THREAD_STACK_MIN
> + /* avoid stacks smaller than _SC_THREAD_STACK_MIN */
> + sz = MAX(MAX(sysconf(_SC_THREAD_STACK_MIN), 0), sz);
MAX(MAX(int, int), unsigned)
is not transitive, but does the job. I won't request a rewrite.
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH V5 0/6], Peter Lieven, 2016/07/12
- [Qemu-devel] [PATCH V5 5/6] oslib-posix: add a configure switch to debug stack usage, Peter Lieven, 2016/07/12
- [Qemu-devel] [PATCH V5 2/6] coroutine: add a macro for the coroutine stack size, Peter Lieven, 2016/07/12
- [Qemu-devel] [PATCH V5 1/6] oslib-posix: add helpers for stack alloc and free, Peter Lieven, 2016/07/12
- Re: [Qemu-devel] [PATCH V5 1/6] oslib-posix: add helpers for stack alloc and free,
Eric Blake <=
- [Qemu-devel] [PATCH V5 6/6] coroutine: reduce stack size to 64kB, Peter Lieven, 2016/07/12
- [Qemu-devel] [PATCH V5 3/6] coroutine-ucontext: use helper for allocating stack memory, Peter Lieven, 2016/07/12
- [Qemu-devel] [PATCH V5 4/6] coroutine-sigaltstack: use helper for allocating stack memory, Peter Lieven, 2016/07/12
- Re: [Qemu-devel] [PATCH V5 0/6] coroutine: mmap stack memory and stack size, Peter Lieven, 2016/07/27