[patch] getrlimit.2: RLIMIT_STACK

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
>From 563e660d8cb46b566ea716d250cca4136a0ba88e Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@xxxxxxxxx>
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


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux