Отсутствие динамической аллокации в embedded мире

Когда мы разрабатываем под embedded, нам приходится сталкиваться с такими флагами компиляции как -nostdlib -fno-exceptions -fno-rtti. Во многих средах нет malloc/free (new/delete) и вообще нет встроенного выделения памяти. Использование «больших» стандартных контейнеров C++ (например, std::vector) нередко исключено В результате приходится решать задачу «ручного» управления памятью. Ниже рассмотрим два подхода:

https://habr.com/ru/articles/918122/

#C++ #embedded #placement_new #heap #backend

Отсутствие динамической аллокации в embedded мире

Когда мы разрабатываем под embedded, нам приходится сталкиваться с такими флагами компиляции как -nostdlib -fno-exceptions -fno-rtti . Во многих средах нет malloc/free (new/delete) и вообще нет...

Хабр

Currently trying to tackle the #RAM consumption issue I see in #swad by introducing thread-local #pools (using simple linked lists) for frequently created and destroyed #objects like event-handler entries, timers, maybe also the connections served by a specific server ... instead of allocating a new one, the pool is asked for one, and instead of (fully) destroying one, it's returned to that pool.

It's a shot in the dark and will actually enforce memory for these is (almost) never free'd, but I hope it will avoid #heap #fragmentation. We'll see how it's going 🙈

I just stress-tested the current dev state of #swad on #Linux. The first attempt failed miserably, got a lot of errors accepting a connection. Well, this lead to another little improvement, I added another static method to my logging interface that mimics #perror: Also print the description of the system errno. With that in place, I could see the issue was "too many open files". Checking #ulimit -n gave me 1024. Seriously? 🤯 On my #FreeBSD machine, as a regular user, it's 226755. Ok, bumped that up to 8192 and then the stress test ran through without issues.

On a side note, this also made creating new timers (using #timerfd on Linux) fail, which ultimately made swad crash. I have to redesign my timer interface so that creating a timer may explicitly fail and I can react on that, aborting whatever would need that timer.

Anyways, the same test gave somewhat acceptable results: throughput of roughly 3000 req/s, response times around 500ms. Not great, but okayish, and not directly comparable because this test ran in a #bhyve vm and the requests had to pass the virtual networking.

One major issue is still the #RAM consumption. The test left swad with a resident set of > 540 MiB. I have no idea what to do about that. 😞 The code makes heavy use of "allocated objects" (every connection object with metadata and buffers, every event handler registered, every timer, and so on), so, uses the #heap a lot, but according to #valgrind, correctly frees everything. Still the resident set just keeps growing. I guess it's the classic #fragmentation issue...

🇧🇪 Belgian Roots. Global Impact. 🌍

Corelan is more than just 🍟, 🍺 & 👶🏼🚿.

We offer world-class Exploit Development Training for Windows:
🔹 Stack-based Exploit Dev
🔹 Heap Exploit Development Masterclass

Crafted in 🇪🇺, respected worldwide 🌐.

Built by a researcher, for researchers 🧠.

Support European excellence in cybersecurity!

🎯 Sign up here → https://bit.ly/corelan-training

#CyberSecurity #ExploitDevelopment #Corelan #InfoSec #InvestInEurope #MadeInBelgium #Heap #Stack #Windows

Введение в память, мотивация виртуальной, отображение между физической и виртуальной

У нас имеется физическая память, она одна для всех программ. И представьте, что вот вы разрабатываете программу, пишете алгоритмы, верстаете интерфейсы, свои контейнеры, это и так в силу несовершенства языков и сложности задач является довольно нетривиальной задачей, а теперь, задумайтесь: если вам нужно будет параллельно анализировать и запоминать, как вашей же памятью могли воспользоваться другие программы, или даже как ваше приложение пользуется ей. Как же оно получилось?

https://habr.com/ru/articles/914016/

#виртуальная_память #concurrency #C++ #регистры #rip #call_stack #heap #операционные_системы

Введение в память, мотивация виртуальной, отображение между физической и виртуальной

Для начала рассмотрите картинку ниже: Диалог программиста с операционной системой Как могли увидеть в диалогах выше виртуальная память решает куча проблем: программист не должен заботиться куда...

Хабр

Llama's Paradox - Delving deep into Llama.cpp and exploiting Llama.cpp's Heap Maze, from Heap-Overflow to Remote-Code Execution.

CC: @retr0reg

https://retr0.blog/blog/llama-rpc-rce

#llama #exploitation #heap #rce

Retr0's Register

Retr0's Threat Research

DDoSecrets publishes 410 GB of heap dumps, hacked from TeleMessage's archive server

This morning, Distributed Denial of Secrets published 410 GB of data hacked from TeleMessage, the Israeli firm that makes modified versions of Signal, WhatsApp, Telegram, and WeChat that centrally archive messages. Because the data is sensitive and full of PII, DDoSecrets is only sharing it with journalists and researchers. There's

micahflee
priority_queueにおける比較関数の渡し方(c++) - Qiita

経緯c++でヒープを実装する時に、カスタム比較関数を渡す必要性が生じたがその方法がわからなかった。(連結リストのノードの値をもとにヒープを構築するための比較関数が必要となった)// This …

Qiita
Spotting and avoiding heap fragmentation in Rust applications https://www.svix.com/blog/heap-fragmentation-in-rust-applications/ @rustlang #heap #performance
Spotting and Avoiding Heap Fragmentation in Rust Applications

One of our Rust services started to show an odd memory profile. This is the story of how we investigated the issue.

Svix Blog