Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.kernel > #93951
| From | Carl Wuebker <office@wuebker.com> |
|---|---|
| Newsgroups | linux.debian.bugs.dist, linux.debian.kernel |
| Subject | Bug#1146373: linux-libc-dev: sbrk(2) allocates more than memory + swap space |
| Date | 2026-08-31 23:40 +0200 |
| Message-ID | <NyhTr-erc9-5@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
Cross-posted to 2 groups.
Package: linux-libc-dev
Version: 6.12.107-1
Severity: normal
Dear Maintainer,
The problem is that sbrk(2) checks each new request against the
machine's total RAM + swap space. It should check each new request
against total RAM + swap space - memory that has already been allocated
to the current process.
Steps to reproduce:
1. Compile & run the program below on a machine with 32 GiB memory & 24
GiB swap
--- eatmem_bad.c
#include <stdio.h>
#include <unistd.h>
intptr_t bigMem = (intptr_t) 128LL*1024*1024*1024;
int main(int argc,char *argv[]) {
intptr_t i;
unsigned long long mem;
if (argc != 1)
{ (void) fprintf(stderr,"Usage: %s\n", argv[0]); return 2; }
mem=0;
for (i = bigMem; i >= 16; i /= 2)
if (sbrk(i) != (void *) -1)
mem |= i;
(void) printf("Memory=%llu MiB\n",mem / (1024*1024));
return 0;
}
---
Expected (and correct) result:
Memory=56718 MiB
Actual result:
Memory=65535 MiB
-- System Information:
Debian Release: 13.6
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500,
'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 6.12.107+deb13-amd64 (SMP w/14 CPU threads; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE
not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
-- no debconf information
Back to linux.debian.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
Bug#1146373: linux-libc-dev: sbrk(2) allocates more than memory + swap space Carl Wuebker <office@wuebker.com> - 2026-08-31 23:40 +0200 Bug#1146373: linux-libc-dev: sbrk(2) allocates more than memory + swap space Uwe Kleine-König <ukleinek@debian.org> - 2026-09-16 20:50 +0200 Bug#1146373: linux-libc-dev: sbrk(2) allocates more than memory + swap space Uwe Kleine-König <ukleinek@debian.org> - 2026-09-23 16:30 +0200 Bug#1146373: marked as done (linux-libc-dev: sbrk(2) allocates more than memory + swap space) "Debian Bug Tracking System" <owner@bugs.debian.org> - 2026-09-25 13:40 +0200
csiph-web