* [patch] getrlimit.2: RLIMIT_STACK
@ 2021-05-23 21:44 Bruno Haible
0 siblings, 0 replies; only message in thread
From: Bruno Haible @ 2021-05-23 21:44 UTC (permalink / raw)
To: mtk.manpages, linux-man
[-- Attachment #1: Type: text/plain, Size: 439 bytes --]
Hi,
The getrlimit(2) page says the RLIMIT_STACK applies to "the process stack".
However, in a multithreaded app, each thread has a stack. And RLIMIT_STACK
determines the size of the thread's stack (unless overridden by the
program).
I verified this through a test program on Linux/i386 and Linux/x86_64.
The code which implements this is in
- glibc/nptl/nptl-init.c for Linux,
- glibc/htl/pt-create.c for the Hurd.
Patch attached.
[-- Attachment #2: 0001-getrlimit.2-RLIMIT_STACK-applies-to-each-thread-s-st.patch --]
[-- Type: text/x-patch, Size: 1107 bytes --]
From 563e660d8cb46b566ea716d250cca4136a0ba88e Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Sun, 23 May 2021 23:37:12 +0200
Subject: [PATCH] getrlimit.2: RLIMIT_STACK applies to each thread's stack.
---
man2/getrlimit.2 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/man2/getrlimit.2 b/man2/getrlimit.2
index 648fd3c..e8a123a 100644
--- a/man2/getrlimit.2
+++ b/man2/getrlimit.2
@@ -61,7 +61,7 @@
.\" 2008-05-07, mtk / Peter Zijlstra, Added description of RLIMIT_RTTIME
.\" 2010-11-06, mtk: Added documentation of prlimit()
.\"
-.TH GETRLIMIT 2 2021-03-22 "Linux" "Linux Programmer's Manual"
+.TH GETRLIMIT 2 2021-05-23 "Linux" "Linux Programmer's Manual"
.SH NAME
getrlimit, setrlimit, prlimit \- get/set resource limits
.SH SYNOPSIS
@@ -427,7 +427,7 @@ queued to the process.
.\" that was present in kernels <= 2.6.7. MTK Dec 04
.TP
.B RLIMIT_STACK
-This is the maximum size of the process stack, in bytes.
+This is the maximum size of the stack of each thread, in bytes.
Upon reaching this limit, a
.B SIGSEGV
signal is generated.
--
2.7.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-23 22:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-23 21:44 [patch] getrlimit.2: RLIMIT_STACK Bruno Haible
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.