libiop | C++ library for IOP-based zkSNARKs | Cryptography library
kandi X-RAY | libiop Summary
kandi X-RAY | libiop Summary
This library provides zkSNARK constructions that are transparent and post-quantum, and moreover rely only on lightweight symmetric cryptography (any cryptographic hash function).
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 libiop
libiop Key Features
libiop Examples and Code Snippets
Community Discussions
Trending Discussions on libiop
QUESTION
Hi I have Written a memory allocator, and works perfectly. I use sbrk/brk for page allocation and deallocation. But it all breaks the moment i start printing information using printfs. Googling shows that - printf internally does use sbrk also. So, another glibc function (printf) making use of sbrk modified heap segment unexpectedly - corrupting the bookkeeping the memory allocator is doing.
Reference : sbrk(0) value getting increased after calling printf basically, any other glibc function using sbrk would break my memory allocator. Can you suggest what could be the possible solution to it ?
Pasting the below backtrace showing that printf eventually calls sbrk. Even after printing is done, I see, break pointer never restores to its original point. Shouldnt printf must have restored the break pointer where it was originally in heap segment ? Any alternative to printf in this regard ?
...ANSWER
Answered 2020-Feb-10 at 15:34The comment by Ctx:
This is not possible;
sbrk()
is used by the libc memory allocator internally, so many libc functions use it implicitly. Either do not use libc at all, or do your memory allocations withmalloc()
ormmap()
.
is correct. You can only use sbrk
if you don't use malloc
, and you can't know if you use malloc
because unless documented otherwise by the implementation, anything in libc might do so.
If your libc supports replacing malloc
(note: most do) then you can write a full malloc
replacement (this includes all malloc
-family functions, not just malloc
itself) that either don't use sbrk
, or that cooperate with your use of it, and then you're free to use it. However otherwise, you simply can't use sbrk
.
Note also that in some environments, including frequently with position-independent executables (PIE), sbrk
will have little or no memory to work with and will frequently fail after only a few allocations or after none at all, because of running into memory mapped for something else. The whole concept of sbrk
is backwards and should not be used at all in modern code. For some allocator strategies, it may make sense as one choice of backend, with mmap
or something else also used. But it should never be the sole way your allocator obtains new memory, and in my opinion it's not really useful to support it at all. mmap
is better in almost all ways.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install libiop
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