PR_SET_MM_START_STACK(2const)

πŸ’– PR_SET_MM_START_STACK πŸ’–

okay bestie, so this is a page from the Linux man-pages (section 2const, the constant-definition girlies) and it's all about one very specific little knob you can twist in the kernel. buckle up πŸŽ€


🌸 NAME 🌸

PR_SET_MM_START_STACK β€” modify kernel memory map descriptor fields ✨


🫢 LIBRARY 🫢

Standard C library (libc, -lc) πŸ’…


✨ SYNOPSIS ✨

#include <linux/prctl.h>  /* Definition of PR_* constants */
#include <sys/prctl.h>

int prctl(PR_SET_MM, PR_SET_MM_START_STACK, unsigned long addr, 0L, 0L);

so yes, this is not its own function, it's a sub-operation of prctl(2) β€” you pass PR_SET_MM as the first arg (that's the "we're editing the memory map descriptors" mode 🧚) and PR_SET_MM_START_STACK as the second arg to say which field you're touching. the last three args are literally addr, 0L, 0L. no cap.


πŸ‘‘ DESCRIPTION πŸ‘‘

Set the start address of the stack. πŸ“

and bestie, heads up: the corresponding memory area must be readable and writable. like, that's the vibe check it has to pass. if it can't be read and written, we have a problem 😭


🌈 RETURN VALUE 🌈

  • On success, 0 is returned. slay. ✨
  • On error, -1 is returned, and errno is set to indicate the error. πŸ’€

πŸ”₯ ERRORS πŸ”₯

  • EINVAL β€” addr is greater than TASK_SIZE (the limit on the size of the user address space for this architecture). so, too big for this architecture's address space, and it said no πŸ™ˆ
  • EINVAL β€” The permissions of the corresponding memory area are not as required. i.e. it wasn't readable and writable like we just talked about. the memory area did NOT serve πŸ’€

πŸ¦‹ STANDARDS πŸ¦‹

Linux. 🐧 (that's the whole entry, she's lowkey iconic like that)


⭐ HISTORY ⭐

Linux 3.3. yes she's been around since 3.3, a true elder of the mmap-adjacent ecosystem πŸ‘‘


πŸŽ€ SEE ALSO πŸŽ€


and that's the whole page, bestie!! πŸ’œ this was PR_SET_MM_START_STACK(2const) from the Linux man-pages, version 6.20, dated 2026-02-08 β€” written down, loved, and explained with maximum enthusiasm. go forth and set your stack start address (readable + writable, always). mwah πŸ’…πŸŒΈπŸ«Ά

πŸ“¦ where this page comes from
  • arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • πŸ“œ the page's license: Linux-man-pages-copyleft
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms