Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Fri, 8 Jun 2012 00:51:48 +0800
From: orc <orc@...server.ru>
To: musl@...ts.openwall.com
Cc: Rich Felker <dalias@...ifal.cx>
Subject: bug? sysinfo() and getopt_long() misbehavior

I have built a musl-enabled system and encountered some bugs:

- sysinfo() incorrectly works. The result is busybox' free misbehaving:
% ./busybox free -m
             total         used         free       shared      buffers
Mem:           476          476            0          183        10489
-/+ buffers:      17592186034402        10489
Swap:        10135        10135            0

gdb shows garbage in struct after free calls sysinfo() with musl.

Reproducible with:
% cat procs.c 
#include <stdio.h>
#include <sys/sysinfo.h>

int main(void)
{
	struct sysinfo info;

	if(sysinfo(&info) == 0)
		printf("procs: %d\n", info.procs);
	return 0;
}
% gcc procs.c # glibc
% ./a.out
procs: 120
% musl-gcc procs.c # musl
% ./a.out
procs: -149225472

- (did not investigated properly) possible getopt_long() misbehavior, or
  just miscompile. The result is that iptables and gnu sed misbehaving
  at command line arguments:
% sed -i '/test/d' ttnosuchfile
sed: can't find label for jump to `tnosuchfile'
% sed '/test/d' -i ttnosuchfile
sed: can't read -i: No such file or directory
sed: can't read ttnosuchfile: No such file or directory
# iptables -vnL
iptables v1.4.12.1: unknown arguments found on commandline
Try `iptables -h' or 'iptables --help' for more information.
# iptables --version
iptables v1.4.12.1: unknown arguments found on commandline
Try `iptables -h' or 'iptables --help' for more information.

Both sed and iptables were compiled with -D_GNU_SOURCE defined.

Unfortunately I don't actually know how to fix these two.

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.