Questions tagged [stack]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
29 views

How to get linux stack bounds?

How can I get the address bounds of the Linux stack using syscalls without resorting to using exception handlers? I can get the stack size using getrlimit, but it doesn't say where the stack starts ...
user avatar
  • 11
-1 votes
1 answer
72 views

Why is Linux stack size limit so low on 64-bit machines?

As far as I know the Linux stack size limit is 8 MB, but on 64-bit machines there's no reason why it couldn't be massively increased, e.g. to 4 GB. This would allow programmers to mostly not worry ...
user avatar
  • 414
4 votes
2 answers
460 views

Why is the stack argument required for the clone wrapper?

I've been carefully reading the linux man page for clone(), and I understand the difference between the clone() wrapper and the "raw" system call. But what I don't understand is why the ...
user avatar
0 votes
2 answers
67 views

To get in variable, a directory've been pushd [duplicate]

How do I use, i.e. to have in bash variable, a directory just've been pushd, and not to do popd command ?
user avatar
0 votes
2 answers
100 views

Where are the files related to the stack on a Unix OS?

I am running Arch Linux, 64bit latest update on one of my computers. I am currently a Computer Science student and we had a test yesterday where we were to implement a dynamic stack using linked lists....
user avatar
  • 151
0 votes
1 answer
3k views

rhel 7 setting stack size to unlimited

I have some old code that needs the stack to not be limited to 8192kb in order for it to run. I am used to doing this in /etc/security/limits.conf * stack hard unlimited * stack soft ...
user avatar
  • 4,111
3 votes
1 answer
310 views

Unlimited stack size with pthreads

My default stack size (according to ulimit -s) is 8192 kB, so naturally the code below segfaults when I try to run it. Also, naturally, it works fine if I do a 'ulimit -s 9000'. However, when I do a '...
user avatar
0 votes
1 answer
20 views

Sequence of events and OS involvement when a process goes beyond its allocated stack

My understanding is that the Linux kernel allocates a stack to every process before it starts, and this initial size is configurable. A process can PUSH data to the stack directly via CPU instructions,...
user avatar
  • 1,544
0 votes
1 answer
53 views

Arbitrary code execution despite Data Execution Prevention

Nowadays with protections like W^X , is it still possible to successfully exploit buffer overflows with for example NOP Slide ?
user avatar
5 votes
1 answer
230 views

Why does bash's tab completion trigger the stack protector?

I'm using bash 5.0.16 (and bash-completion 2.10) on Manjaro. Today, I absentmindedly hit the tab key while moving some files, and was greeted with an unexpected message: [charles@wirepile some_dir]$ ...
user avatar
2 votes
1 answer
162 views

Is it safe to use the .bss section as a static stack?

(This is in the context of x86-64 Linux.) I am trying to write a high-reliability userland executable, and I have total control over the generated assembly. I don't want to rely on automatic stack ...
user avatar
1 vote
1 answer
2k views

How to view Stack Trace of a process?

I have seen this answer and according to that Stack Trace can be seen like: $ cat /proc/<PID>/stack [<ffffffff81012b72>] save_stack_trace_tsk+0x22/0x40 [<ffffffff81213abe>] ...
user avatar
  • 113
1 vote
1 answer
550 views

What data structure is the stack using in Linux?

I have looked in several places such as here but none explain in detail the structs used for implementing the stack itself (the place where "tasks" (processes/threads) store their nested call ...
user avatar
  • 375
4 votes
1 answer
483 views

Are stack canaries shared via threads?

As far as I understand, stack canaries work as fllows: Upon program startup a random value is generated and stored in the thread local storage (%fs:0x28). This random value is then pushed onto the ...
user avatar
10 votes
2 answers
3k views

How does the ELF loader determine the initial stack size?

I'm studying the ELF specification (http://www.skyfree.org/linux/references/ELF_Format.pdf), and one point that is not clear to me about the program loading process is how the stack is initialized, ...
user avatar
0 votes
1 answer
337 views

AIX process stack watermark

Does exist any tool/command for checking the maximum that a process stack has used? I need that to tune the stack size configuration for a program.
user avatar
1 vote
1 answer
2k views

How does Linux Kernel switches from kernel stack to interrupt stack?

What happens when a user mode task is interrupted ? I know for a fact that the CPU switches to the kernel mode stack by refring the TSS. But when and how does the kernel switches to the IRQ stack?
user avatar
13 votes
2 answers
12k views

Why on modern Linux, the default stack size is so huge - 8MB (even 10 on some distributions)

For example, on OSX, it's even less than 512k. Is there any recommended size, having in mind, that the app does not use recursion and does not allocate a lot of stack variables? I know the question ...
user avatar
20 votes
2 answers
7k views

What sets fs:[0x28] (stack canary)?

From this post it is shown that FS:[0x28] is a stack-canary. I'm generating that same code using GCC on this function, void foo () { char a[500] = {}; printf("%s", a); } Specifically, I'm ...
user avatar
  • 22.4k
2 votes
1 answer
3k views

pstack not printing stack output [closed]

I am running pstack to find function stack for my application running on two machines (both RHEL) In one of my machine it is working as expected [root@civ4cez191 bin]# pstack 22947 Thread 2 (Thread ...
user avatar
  • 121
1 vote
0 answers
193 views

How can I find the deepest and most stack-hungry call chains in a program?

I have a program written in OCaml that tends to stack-overflow on platforms with small stacks. Rather than ulimiting the program to find and solve stack overflows one by one, I'd like to get a sorted ...
user avatar
  • 444
1 vote
1 answer
5k views

GDB command to print the address of starting of buffer (stack)

For gdb debugger (gdb) p &buffer This command is used to print the content of starting of buffer (stack), or print the address? If it is content, how to print the address?
user avatar
  • 153
-1 votes
2 answers
841 views

fork() and execve() efficiency [closed]

In terms of memory allocation efficiency is it right to say that after a fork() in the code of the child if I execute a program with execve() this would be more efficient than the same program ...
user avatar
4 votes
1 answer
6k views

program stack size

I learned default stack size for each process is limited to 8MB and mmap_base is calculated based on stack size in rlimit and random value. Code below is mmap_base function which calculates mmap_base ...
user avatar
0 votes
1 answer
985 views

Top: DATA = RES + stack + what?

I've analyzed memory consumption of a java program on Linux Mint. I used top to capture memory statistics (memory used by program and also system-wide indicators like total_mem_used and mem_free). The ...
user avatar
  • 101
1 vote
1 answer
281 views

Could the stack be swapped to disk on Linux and can it be prevented

On Linux, is it possible that memory pages that contain the process stack get swapped to disk? If so, is there a way to prevent that, either at compile time or at runtime. I'm asking because of a ...
user avatar
  • 253
4 votes
2 answers
941 views

Memory Randomization in Linux

I created a simple C program and every time I load it in GDB, I see the same memory addresses allocated to the instructions of the program. For example, a function what() always loads at memory ...
user avatar
  • 1,044
1 vote
1 answer
843 views

What is the relationship between the stack and the process table?

According to Wikipedia and many other sources, Since PCB contains the critical information for the process, it must be kept in an area of memory protected from normal user access. In some ...
user avatar
2 votes
1 answer
593 views

Why must the stack VMA be executable?

I am currently reading Linux Kernel Development by Robert Love. In the chapter "15 The Process Address Space" he prints the memory map of a process. user@machine:~$ pmap 1424 #all the processes ...
user avatar
1 vote
1 answer
90 views

Can you translate stack data? What is the data? [closed]

What I want to know is how is the data in a stack translated. We can see the data like: 0x80808080 but does it have a meaning? What parts of the numbers stand for something different? And what does '...
user avatar
1 vote
1 answer
97 views

bash - isolating uppercase words

So, I have a directory containing around 50 directories having for name 3 letter uppercase words: AXC BCC EFC amongst other directories. I have already done a find to seek these 3 letter directories ...
user avatar
2 votes
2 answers
747 views

Main stacks in Linux

What are the main stacks in Linux? What I mean is, for example when an interrupt occurs what stack will be used for it, and what is the difference between user process and kernel process stacks?
user avatar
0 votes
1 answer
68 views

Match the three columns in 2 annotation files and print those lines to a new output file

I have 2 files, file 1 and file 2 with the same column numbers. Column one has the chromosome number, column two has the promoter start site and column three has the promoter stop site. I want to ...
user avatar
  • 1
-1 votes
2 answers
109 views

First match if we are on the first line of input, if so print the whole line, else print the first word followed by a comma

for eg: CREATE TABLE MWWDATA.ACK997 ( AKTYPE CHAR(2) DEFAULT '' NOT NULL , AKNUM CHAR(9) DEFAULT '' NOT NULL ); CREATE TABLE MWWDATA.APREIDEXC ( EMPLID NUMBER(15, 0) DEFAULT NULL ); I ...
user avatar
  • 23
0 votes
3 answers
53 views

i want to print the line which starts with a paricular word and in the rest records print only 1st field

for eg: CREATE TABLE MWWDATA."VTCat02" ( "ID" NUMBER(10) DEFAULT NULL , "Cat" VARCHAR2(255) DEFAULT NULL , "Style_Code" VARCHAR2(255) DEFAULT NULL , "Vendor_Style_#" VARCHAR2(255) ...
user avatar
  • 23
0 votes
1 answer
565 views

I want to delete from particular words in all the line if that particular word is present

eg: CREATE VIEW AIPKEYITEM.SEASONGROUPNETSALES ( CALENDARID , PRODUCTGROUPID FOR COLUMN PRDGRPID , NETSALESDOLLARS FOR COLUMN NETSA00001 , NETSALESUNITS FOR COLUMN NETSA00002 ) AS SELECT ...
user avatar
  • 23
11 votes
1 answer
21k views

How can I monitor per process/per thread memory consumption (divided into heap, stack, data, code)?

Before jumping in and writing my own code, I want to find out if there is GNU/Linux software that is able to output something similar to QNX's showmem. For each thread of each process that is running,...
user avatar
  • 111
21 votes
3 answers
21k views

How does stack allocation work in Linux?

Does the OS reserve the fixed amount of valid virtual space for stack or something else? Am I able to produce a stack overflow just by using big local variables? I've wrote a small C program to test ...
user avatar
  • 452
2 votes
1 answer
4k views

Ulimit unlimited stack behavior oddity

I am running an application on a Solaris 10 system. Yesterday we have set the process stack size to unlimited: ulimit -s unlimited Today during the load the process would not come up reporting that ...
user avatar
  • 5,745