public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "kees at outflux dot net" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sources.redhat.com Subject: [Bug libc/11333] New: size of struct dirent does not agree with kernel when using LFS on 32bit Date: Sat, 27 Feb 2010 05:56:00 -0000 [thread overview] Message-ID: <20100227055549.11333.kees@outflux.net> (raw) Forwarded from https://launchpad.net/bugs/392501 It seems that the actual size of "struct dirent" with LFS enabled is 280 bytes, but when defined for 32bit applications, the defined struct ends up at 276, and something (the kernel?) is still writing the remaining 4 bytes. Built on 64bit: cc -Wall -Werror -fstack-protector -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -o test-native test.c cc -Wall -Werror -fstack-protector -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -m32 -o test-m32 test.c mkdir -p bug-dir touch bug-dir/111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 ./test-native bug-dir sizeof(struct dirent): 280 ./test-m32 bug-dir sizeof(struct dirent): 276 *** stack smashing detected ***: ./test-m32 terminated Built on 32bit: cc -Wall -Werror -fstack-protector -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -o test-native test.c cc -Wall -Werror -fstack-protector -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -m32 -o test-m32 test.c mkdir -p bug-dir touch bug-dir/111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 ./test-native bug-dir sizeof(struct dirent): 276 *** stack smashing detected ***: ./test-native terminated /// test.c #include <stdio.h> #include <stdlib.h> #include <dirent.h> #include <inttypes.h> void func(const char*path) { struct dirent entry; struct dirent *result = NULL; int ret; DIR *dir = opendir(path); if(!dir) abort(); printf("sizeof(struct dirent): %" PRIuFAST32 "\n", sizeof(entry)); while (!(ret = readdir_r(dir, &entry, &result)) && result) {} } int main(int argc, const char** argv) { if(argc < 2) abort(); func(argv[1]); return 0; } -- Summary: size of struct dirent does not agree with kernel when using LFS on 32bit Product: glibc Version: 2.11 Status: NEW Severity: normal Priority: P2 Component: libc AssignedTo: drepper at redhat dot com ReportedBy: kees at outflux dot net CC: glibc-bugs at sources dot redhat dot com http://sourceware.org/bugzilla/show_bug.cgi?id=11333 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
next reply other threads:[~2010-02-27 5:56 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-02-27 5:56 kees at outflux dot net [this message] 2010-02-27 6:16 ` [Bug libc/11333] " kees at outflux dot net 2010-02-27 6:16 ` kees at outflux dot net 2010-02-27 6:38 ` kees at outflux dot net 2010-02-27 7:17 ` kees at outflux dot net 2010-04-04 6:55 ` drepper at redhat dot com 2010-04-04 17:55 ` kees at outflux dot net 2010-05-26 21:56 ` funtoos at yahoo dot com 2010-05-26 23:07 ` kees at outflux dot net
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20100227055549.11333.kees@outflux.net \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sources.redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).