Public bug reported:

A thread started with a minimal stack size (PTHREAD_STACK_MIN from
limits.h), can't even call fprintf(stderr, "%s", "") without
segfaulting. Took me a good while to debug this one in our embedded
software.

This program will segfault:

#include <pthread.h>
#include <stdio.h>
#include <limits.h>

static void* thread_function(void* arg)
{
   fprintf(stderr, "Hello, %s!", "World");
   return 0;
}

int main()
{
   pthread_attr_t attr;
   pthread_t thread;
   pthread_attr_init(&attr);
   pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);
   pthread_create(&thread, &attr, &thread_function, 0);
   pthread_join(thread, 0);
   return 0;
}

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: libc6-dev 2.15-0ubuntu10.4
ProcVersionSignature: Ubuntu 3.2.0-53.81-generic 3.2.50
Uname: Linux 3.2.0-53-generic i686
ApportVersion: 2.0.1-0ubuntu17.4
Architecture: i386
Date: Thu Sep 26 08:09:33 2013
InstallationMedia: Ubuntu-Server 12.04.3 LTS "Precise Pangolin" - Release i386 
(20130820.2)
MarkForUpload: True
ProcEnviron:
 LANGUAGE=en_US:en
 TERM=xterm
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: eglibc
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: eglibc (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: apport-bug i386 precise

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1231272

Title:
  Segfault in fprintf in thread with minimal stack size

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/1231272/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to