bss | Better Style Sheets | Style Language library
kandi X-RAY | bss Summary
kandi X-RAY | bss Summary
🎨 Better Style Sheets
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of bss
bss Key Features
bss Examples and Code Snippets
Community Discussions
Trending Discussions on bss
QUESTION
I am studying ROP on Arm64, I posted my thread here Return Oriented Programming on ARM (64-bit)
However a new/separate issue about choosing rop gadgets has arisen which requires the opening of a new thread. So to sum up i am studying ROP vulnerability on ARM 64 bit and i am trying to test it using a very simple c code (attached to the previous thread). I'am using ropper tool in order to search for gadgets to build my rop chain. But when i overflow the pc with the address of the gadget i got this within gdb:
...ANSWER
Answered 2021-Jun-13 at 14:57Your gadget is at 0x55555558f8
.
Ropper shows the addresses of gadgets the way the ELF header describes the memory layout of the binary. According to that header:
- The file contents 0x0-0xadc are to be mapped as
r-x
at address 0x0. - The file contents 0xdb8-0x1048 are to be mapped as
rw-
at address 0x10db8.
Account for page boundaries and you get one page mapping file offset 0x0 to address 0x0 as executable and two pages mapping file offset 0x0 to address 0x10000 as writeable.
From your GDB dump, these mappings are created at 0x5555555000 and 0x5555565000 in the live process, respectively.
QUESTION
I am trying very hard to understand how to use a linker file, but my brain is apparently not getting it at all. I am using an STM32L476, which has two RAM regions, RAM and RAM2 (memory definition below). I would like to put a buffer into RAM2, but there is no section for RAM2 in the default linker script that is generated by Cube. Seems like a good exercise for me. I really thought that the following would do the trick, where all I've added is the .sensor_buffer section:
...ANSWER
Answered 2021-Jun-06 at 16:30You have an error somewhere else. Maybe you simply do not use this linker script (you forgot to add or change the name in the command line)
I have compiled it and linked it without any problems with CubeIDE (I use 100 and 100 in the buffer declarations as I do not know the values of your macros [100x100 = 0x2710])
QUESTION
I'm doing an assignment for Assembly programming, and I can't get past this problem. The task is to write a program, in which user types a password, console shows '*' instead of typed letters. After typing said password user presses ENTER which "sets" the password, and requires the user to type the same password again to check if it's the same as set before.
I got this code to work which reads keystrokes, saves typed password and then writes it in the console. But I can't get it to stop on pressed ENTER. (it is set to register only 12 letters now)
...ANSWER
Answered 2021-Jun-02 at 15:05(Fetching a very old and dusty book from the bookshelf...)
QUESTION
Are we enclosing the variable or register in brackets to specify a pointer in assembly?
Example1;
...ANSWER
Answered 2021-May-28 at 14:02Are we enclosing the variable or registrar in brackets to specify a pointer in assembly?
Example1;
QUESTION
Background information:
I'm using 64 bit Arch on an x86 system.
I'm not using libc or any language that depends on libc. I'm using a proprietary research language. I am making my syscalls through inline assembly.
I'm writing an experimental custom allocator for a research project, so a portable solution is a nice-to-have, but not a requirement.
My programs are statically linked and I am willing and able to rewrite the libraries I'm using to account for a given solution.
According to this SO post: Where is the stack memory allocated from for a Linux process? A program's virtual address space is organized like this:
...ANSWER
Answered 2021-Jun-01 at 12:46After a lot of testing I've found the solution I proposed in the question does work. I've been using cat /proc//maps
to check my custom allocator, and it's behaving as I expected. To reiterate the solution:
To find the lower bound use
sbrk(0)
, make sure the ptr is page aligned, and then ensure thatbrk
andsbrk
are never called again.To safely approximate the upper bound find the stack size with
getrlimit
, subtract that from a ptr into the stack, page align the ptr, and then never change the stack size withsetrlimit
.
If you might need to touch brk
, sbrk
, or setrlimit
, then you can also add some padding to the lower bound and subtract some padding from the upper bound. You can dynamically compute a safe amount of padding by finding how much memory the system has with /proc/meminfo
, or if you don't need a general solution you can just over-approximate how much you'll need based on what you're doing.
QUESTION
Edit: Still No answer works, the output is:
...ANSWER
Answered 2021-May-27 at 20:53I think your arithmetic has gone wrong.
The first LOAD segment is loaded at address 0x400000 and has size 0x1d14, so it indeed includes the 10 bytes starting at 0x401bc0, at offset 0x401bc0 - 0x400000 = 0x1bc0
into this segment. The segment starts at offset 0 in the file, so you need to look at offset 0x1bc0
in the file, not offset 0xbc0
. And 0x1bc0
is decimal 7104
.
(And 0xbc0
in decimal is 3008, not 4660. A good fact to memorize for mental arithmetic is that 0x1000 = 4096
is one page. So 0x1bc0
must be between 4096 and 8192, and likewise 0xbc0
must be less than 4096. That's how I could tell at a glance that something was wrong with your math.)
QUESTION
Update: Writing this out allowed me to spot where I was going wrong, but not why. I am obviously calling fgets in the wrong way, because after five calls I get to the address 0x221000 which is where the mmapped memory is - I am writing at higher addresses - but I don't know why that that is happening. Could someone explain?
This is a bit complex and I'm at a loss to see why this behaviour is seen: I don't know if I have got the basics wrong or if it's a feature of Spike/PK.
To note: the libc here is provided by newlib and the code is compiled as riscv64-unknown-elf.
Short version I have input code written in RISC-V assembly that previously ran smoothly, but since I introduced a system call to mmap it crashes the fifth time it is executed. Is the problem because I have got the wrong sequence of calls or possibly an issue with the Spike emulator and PK proxy kernel?
Long explanation
I am writing a Forth-like threaded interpreted language. It is currently targeted at the PK proxy kernel on the Spike emulator, but hopefully soon to run on 'real' hardware. The code is at https://github.com/mcmenaminadrian/riscyforth
The TIL implements an endless loop to pick up input calling, in sequence, a routine to get the filepointer for standard input and then a routine to get the input.
To get the standard input filepointer (which is stored on the stack):
...ANSWER
Answered 2021-Apr-20 at 07:11By repeatedly opening the file my code was eating up more and more memory and eventually overwrote part of the memory range allocated via mmap. I solved this by storing the value of the file pointer in the .bss (inputfileptr) and only opening it once:
QUESTION
I am writing a Forth-like language for RISC-V and naturally that means I need to have a way to allow the users to define new words and execute them.
But I am struggling to find a way that will allow users to execute dynamically generated code without using privileged instructions to change a page's status. Is there any way to do this - for example, can I define a large empty section in .text (as opposed to .bss which is what I am currently doing)?
Or do I have to write an explicit trap handler?
Update: I am using the pk proxy kernel with Spike. I am executing an mprotect system call against either a buffer created in the .bss section or an allocation in the .text section.
In either case the mprotect call fails - returning -EACCES. (So using the .bss version fails on any attempt to execute the new code and using the .text version fails when I attempt to write the new code.)
It seems I cannot mark a page as R/W/X - and this might be fundamental. Is there a way round this (there surely must be!)
...ANSWER
Answered 2021-Apr-18 at 16:08The answer to this problem was to use mmap to map in a range of addresses with the appropriate READ, WRITE and EXECUTE permissions.
QUESTION
By default, different threads also have different stacks. Is it possible to make them share the same thread? For example: I want to call a function in thread A, but the argument for that function call was pushed onto the stack in thread B. Since those threads do not share a stack, the function call in thread A will fail.
example code:
...ANSWER
Answered 2021-May-19 at 19:47Stacks are just part of memory and threads share their entire address space.
Threads have their own stacks the way hotel guests have their own rooms, except all the doors are unlocked. Each guest is generally expected to use and stay in their own room, but nothing stops them from walking into another person's room and messing with the other person's stuff. If invited in, this is completely acceptable.
You can safely access an object on one thread's stack from another thread so long as the access would be thread safe if the object wasn't on the stack and you ensure the stack frame continues to exist until the object is no longer accessed.
QUESTION
edit: I added an image of the error shown in gdb I am having a problem with my assembly code. This code once worked for me and it gave out the right outputs that I need (mainly string1 as I need to change its vowel characters to some other character). A few hours later, however, it stopped working and is now dumping a segmentation fault.
...ANSWER
Answered 2021-May-15 at 11:50Turns out the code wasnt really working in the first place lol. The value of rcx
in the loop in str_copy
is an address and the values of rdi
and rsi
are not getting switched so if anything, nothing right is happening in that part of the code. To solve this, I initialized another register with the same value of rcx
and another function that swaps the address of rdi
and rsi
so I can copy the contents of string2
to string1
as shown by the function below
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install bss
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page