Debian Bug report logs - #413471
gethostbyname_r on Sparc has alignement bug that crashes MySQL

version graph

Package: libc6; Maintainer for libc6 is GNU Libc Maintainers <debian-glibc@lists.debian.org>; Source for libc6 is src:eglibc.

Reported by: Daniel Smolik <marvin@sitour.cz>

Date: Mon, 5 Mar 2007 10:48:05 UTC

Severity: important

Tags: confirmed, upstream

Merged with 334339, 419459

Found in versions glibc/2.3.2.ds1-22sarge6, glibc/2.3.6.ds1-13

Fixed in versions glibc/2.5-3, glibc/2.3.6.ds1-13etch1

Done: Aurelien Jarno <aurel32@debian.org>

Bug is archived. No further changes may be made.

Forwarded to http://bugs.mysql.com/bug.php?id=14080

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Christian Hammers <ch@debian.org>:
Bug#413471; Package mysql-client-5.0. Full text and rfc822 format available.

Acknowledgement sent to Daniel Smolik <marvin@sitour.cz>:
New Bug report received and forwarded. Copy sent to Christian Hammers <ch@debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Daniel Smolik <marvin@sitour.cz>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: mysql-client-5.0: mysql client crash with SIGBUS when try connect to remote DB on Debian SPARC If I try connect to DB on remote host mysql client crashes with SIGBUS. When access DB localy works.
Date: Mon, 05 Mar 2007 11:44:26 +0100
Package: mysql-client-5.0
Version: 5.0.32-7
Severity: normal

Strace shows this:
open("/etc/hosts", O_RDONLY)            = 4
fcntl64(4, F_GETFD)                     = 0
fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
fstat64(4, {st_mode=S_IFREG|0644, st_size=273, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf7f7a000
read(4, "127.0.0.1\tlocalhost\n192.168.1.11"..., 8192) = 273
--- SIGBUS (Bus error) @ 0 (0) ---
+++ killed by SIGBUS +++
Process 16727 detached



-- System Information:
Debian Release: 4.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: sparc (sparc64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.20-i2cdbg
Locale: LANG=cs_CZ, LC_CTYPE=cs_CZ (charmap=ISO-8859-2)

Versions of packages mysql-client-5.0 depends on:
ii  debianutils                 2.17.5       Miscellaneous utilities specific t
ii  libc6                       2.3.6.ds1-13 GNU C Library: Shared libraries
ii  libdbd-mysql-perl           3.0008-1     A Perl5 database interface to the 
ii  libdbi-perl                 1.53-1       Perl5 database interface by Tim Bu
ii  libgcc1                     1:4.1.1-21   GCC support library
ii  libmysqlclient15off         5.0.32-7     mysql database client library
ii  libncurses5                 5.5-5        Shared libraries for terminal hand
ii  libreadline5                5.2-2        GNU readline and history libraries
ii  libstdc++6                  4.1.1-21     The GNU Standard C++ Library v3
ii  libwrap0                    7.6.dbs-13   Wietse Venema's TCP wrappers libra
ii  mysql-common                5.0.32-7     mysql database common files (e.g. 
ii  perl                        5.8.8-7      Larry Wall's Practical Extraction 
ii  zlib1g                      1:1.2.3-13   compression library - runtime

mysql-client-5.0 recommends no packages.

-- no debconf information



Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#413471; Package mysql-client-5.0. Full text and rfc822 format available.

Acknowledgement sent to Christian Hammers <ch@debian.org>:
Extra info received and forwarded to list. Full text and rfc822 format available.

Message #10 received at 413471@bugs.debian.org (full text, mbox):

From: Christian Hammers <ch@debian.org>
To: 413471@bugs.debian.org
Subject: Re: Bug#413471: mysql-client-5.0: mysql client crash with SIGBUS when try connect to remote DB on Debian SPARC
Date: Mon, 5 Mar 2007 12:27:59 +0100
tags 413471 + moreinfo
stop

Hello

On 2007-03-05 Debian BTS wrote:
> If I try connect to DB on remote host mysql client crashes with SIGBUS.
> When access DB localy works.

> Strace shows this:
> open("/etc/hosts", O_RDONLY)            = 4
> fcntl64(4, F_GETFD)                     = 0
> fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
> fstat64(4, {st_mode=S_IFREG|0644, st_size=273, ...}) = 0
> mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf7f7a000
> read(4, "127.0.0.1\tlocalhost\n192.168.1.11"..., 8192) = 273
> --- SIGBUS (Bus error) @ 0 (0) ---
> +++ killed by SIGBUS +++
> Process 16727 detached

Please
 - try if "strace -f /usr/bin/mysql" shows more info
 - send me your /etc/hosts
 - try "gdb /usr/bin/mysql" then "run" and if it crashs enter "backtrace"
 - do "grep mysql /var/log/syslog" on the server side and send me the output
 - do "telnet serverhost 3306" (replace "serverhost") and show me what it says,
   i.e. if it is reachable and which version number it prints.

bye,

-christian-



Information forwarded to debian-bugs-dist@lists.debian.org, Christian Hammers <ch@debian.org>:
Bug#413471; Package mysql-client-5.0. Full text and rfc822 format available.

Acknowledgement sent to Daniel Smolik <marvin@mydatex.cz>:
Extra info received and forwarded to list. Copy sent to Christian Hammers <ch@debian.org>. Full text and rfc822 format available.

Message #15 received at 413471@bugs.debian.org (full text, mbox):

From: Daniel Smolik <marvin@mydatex.cz>
To: 413471@bugs.debian.org
Subject: php crashed too
Date: Mon, 05 Mar 2007 12:43:56 +0100
If I try run select from php to remote DB. Script crashed too in the 
same way as mysql client.

Dan




Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#413471; Package mysql-client-5.0. Full text and rfc822 format available.

Acknowledgement sent to Christian Hammers <ch@debian.org>:
Extra info received and forwarded to list. Full text and rfc822 format available.

Message #20 received at 413471@bugs.debian.org (full text, mbox):

From: Christian Hammers <ch@debian.org>
To: 413471@bugs.debian.org
Subject: Re: Bug#413471: php crashed too
Date: Mon, 5 Mar 2007 13:45:33 +0100

On 2007-03-05 Daniel Smolik wrote:
> If I try run select from php to remote DB. Script crashed too in the 
> same way as mysql client.

That's very likely as both /usr/bin/mysql and /usr/lib/php*/mysql.so are 
dynamically linked against the same /usr/lib/libmysqlclient.so.15.0.0.

But send me the infos I asked for in my other mail, maybe we can find the 
problem then.

bye,

-christian-



Information forwarded to debian-bugs-dist@lists.debian.org, Christian Hammers <ch@debian.org>:
Bug#413471; Package mysql-client-5.0. Full text and rfc822 format available.

Acknowledgement sent to Daniel Smolik <marvin@mydatex.cz>:
Extra info received and forwarded to list. Copy sent to Christian Hammers <ch@debian.org>. Full text and rfc822 format available.

Message #25 received at 413471@bugs.debian.org (full text, mbox):

From: Daniel Smolik <marvin@mydatex.cz>
To: 413471@bugs.debian.org
Subject: gdb bt for this bug
Date: Mon, 05 Mar 2007 19:43:19 +0100
Hi,
I install dbg version of libc and provide gdb backtrace here is a output.



rogram received signal SIGBUS, Bus error.
[Switching to Thread 16384 (LWP 22172)]
0xf783b608 in internal_getent () from /lib/libnss_files.so.2
(gdb) bt
#0  0xf783b608 in internal_getent () from /lib/libnss_files.so.2
#1  0xf783bf6c in _nss_files_gethostbyname_r () from /lib/libnss_files.so.2
#2  0xf795790c in gethostbyname_r@@GLIBC_2.1.2 () from /lib/libc.so.6
#3  0xf7c9c098 in my_gethostbyname_r () from /usr/lib/libmysqlclient.so.15
#4  0xf7cb97b4 in mysql_real_connect () from /usr/lib/libmysqlclient.so.15
#5  0x00014ca0 in ?? ()
#6  0x00014ca0 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)


If I put wrong password program crash in another function. It looks like 
some memory corruption.


			Regards
					Dan



Information forwarded to debian-bugs-dist@lists.debian.org, Christian Hammers <ch@debian.org>:
Bug#413471; Package mysql-client-5.0. Full text and rfc822 format available.

Acknowledgement sent to Daniel Smolik <marvin@mydatex.cz>:
Extra info received and forwarded to list. Copy sent to Christian Hammers <ch@debian.org>. Full text and rfc822 format available.

Message #30 received at 413471@bugs.debian.org (full text, mbox):

From: Daniel Smolik <marvin@mydatex.cz>
To: 413471@bugs.debian.org
Subject: aditional info
Date: Mon, 05 Mar 2007 20:01:58 +0100
Sorry for my delayed reply but I didn't recive any email from you.
I only recive confirmation email from bug system.
I read your post on web.
strace -f  mysql -u ustredna -p ustredna -h e450
----cut---


open("/etc/resolv.conf", O_RDONLY)      = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=256, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) 
= 0xf7f72000
read(4, "# Dynamic resolv.conf(5) file fo"..., 8192) = 256
read(4, "", 8192)                       = 0
close(4)                                = 0
munmap(0xf7f72000, 8192)                = 0
socket(PF_FILE, SOCK_STREAM, 0)         = 4
fcntl64(4, F_GETFL)                     = 0x2 (flags O_RDWR)
fcntl64(4, F_SETFL, O_RDWR|O_NONBLOCK)  = 0
connect(4, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 
ENOENT (No such file or directory)
close(4)                                = 0
socket(PF_FILE, SOCK_STREAM, 0)         = 4
fcntl64(4, F_GETFL)                     = 0x2 (flags O_RDWR)
fcntl64(4, F_SETFL, O_RDWR|O_NONBLOCK)  = 0
connect(4, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 
ENOENT (No such file or directory)
close(4)                                = 0
open("/etc/host.conf", O_RDONLY)        = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=9, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) 
= 0xf7f72000
read(4, "multi on\n", 4096)             = 9
read(4, "", 4096)                       = 0
close(4)                                = 0
munmap(0xf7f72000, 8192)                = 0
open("/etc/hosts", O_RDONLY)            = 4
fcntl64(4, F_GETFD)                     = 0
fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
fstat64(4, {st_mode=S_IFREG|0644, st_size=253, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) 
= 0xf7f72000
read(4, "127.0.0.1\tlocalhost.localdomain\t"..., 4096) = 253
--- SIGBUS (Bus error) @ 0 (0) ---
+++ killed by SIGBUS +++
Process 22250 detached

----cut-------


 cat /etc/hosts
127.0.0.1       localhost.localdomain   localhost       sunik

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts



Mar  5 11:28:20 e450 mysqld[3790]: 070305 11:28:20 [Note] 
/usr/sbin/mysqld: Normal shutdown
Mar  5 11:28:20 e450 mysqld[3790]:
Mar  5 11:28:20 e450 mysqld[3790]: 070305 11:28:20  InnoDB: Starting 
shutdown...
Mar  5 11:28:22 e450 mysqld[3790]: 070305 11:28:22  InnoDB: Shutdown 
completed; log sequence number 0 43655
Mar  5 11:28:22 e450 mysqld[3790]: 070305 11:28:22 [Note] 
/usr/sbin/mysqld: Shutdown complete
Mar  5 11:28:22 e450 mysqld[3790]:
Mar  5 11:28:22 e450 mysqld_safe[27782]: ended
Mar  5 11:28:22 e450 mysqld_safe[27853]: started
Mar  5 11:28:23 e450 mysqld[27856]: 070305 11:28:23  InnoDB: Started; 
log sequence number 0 43655
Mar  5 11:28:23 e450 mysqld[27856]: 070305 11:28:23 [Note] 
/usr/sbin/mysqld: ready for connections.
Mar  5 11:28:23 e450 mysqld[27856]: Version: '5.0.32-Debian_7-log' 
socket: '/var/run/mysqld/mysqld.sock'  port: 3306
Mar  5 11:28:24 e450 /etc/mysql/debian-start[27894]: Upgrading MySQL 
tables if necessary.
Mar  5 11:28:27 e450 /etc/mysql/debian-start[27902]: Checking for 
crashed MySQL tables.

telnet  e450 3306
Trying 192.168.1.109...
Connected to e450.sitour.cz.
Escape character is '^]'.
A
5.0.32-Debian_7-log)t0/<}&?,I3cz[9JHiYb_

If you want more let me please know.

			Thanks
					Dan























Information forwarded to debian-bugs-dist@lists.debian.org, Christian Hammers <ch@debian.org>:
Bug#413471; Package mysql-client-5.0. Full text and rfc822 format available.

Acknowledgement sent to Daniel Smolik <marvin@mydatex.cz>:
Extra info received and forwarded to list. Copy sent to Christian Hammers <ch@debian.org>. Full text and rfc822 format available.

Message #35 received at 413471@bugs.debian.org (full text, mbox):

From: Daniel Smolik <marvin@mydatex.cz>
To: 413471@bugs.debian.org
Subject: Aditional info
Date: Wed, 07 Mar 2007 21:20:19 +0100
Hi,
when I connect to remote DB on Sparc from my NN (i386) Debian Sid all 
works. I have tested Mysql pkg. from experimental and crashed too.
Downgrade to 4.1 solve problem.

			Dan



-- 
Mydatex s r.o.
http://www.mydatex.cz
email: smolik@mydatex.cz
mob: 604200362
tel: 226210085



Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#413471; Package mysql-client-5.0. Full text and rfc822 format available.

Acknowledgement sent to Christian Hammers <ch@debian.org>:
Extra info received and forwarded to list. Full text and rfc822 format available.

Message #40 received at 413471@bugs.debian.org (full text, mbox):

From: Christian Hammers <ch@debian.org>
To: Daniel Smolik <marvin@mydatex.cz>, 413471@bugs.debian.org
Subject: Re: Bug#413471: gdb bt for this bug
Date: Wed, 14 Mar 2007 01:50:24 +0100
Hello

Sorry, I still have no idea why mysql crashes for you. Please send me
your /etc/nsswitch.conf. If that also gives us no idea, I forward the
bug to bugs.mysql.com.

bye,

-christian-



Information forwarded to debian-bugs-dist@lists.debian.org, Christian Hammers <ch@debian.org>:
Bug#413471; Package mysql-client-5.0. Full text and rfc822 format available.

Acknowledgement sent to Daniel Smolik <marvin@mydatex.cz>:
Extra info received and forwarded to list. Copy sent to Christian Hammers <ch@debian.org>. Full text and rfc822 format available.

Message #45 received at 413471@bugs.debian.org (full text, mbox):

From: Daniel Smolik <marvin@mydatex.cz>
To: Christian Hammers <ch@debian.org>
Cc: 413471@bugs.debian.org
Subject: Re: Bug#413471: gdb bt for this bug
Date: Wed, 14 Mar 2007 08:00:42 +0100
Christian Hammers napsal(a):
> Hello
> 
> Sorry, I still have no idea why mysql crashes for you. Please send me
> your /etc/nsswitch.conf. If that also gives us no idea, I forward the
> bug to bugs.mysql.com.
> 
> bye,
> 
> -christian-

Yes I understand. This bug, I think, is little/big  endian related. On 
i386 it works but on Sun not. There is my nsswitch.conf.



# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat
group:          compat
shadow:         compat

hosts:          files dns
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

I try experiment  with resolving order but nothing helps. Only mysql 
crashes in another function. This  crash shows some memory corruption 
problem in mysql code I mean.



		Regards
				Dan







Information forwarded to debian-bugs-dist@lists.debian.org, Christian Hammers <ch@debian.org>:
Bug#413471; Package mysql-client-5.0. Full text and rfc822 format available.

Acknowledgement sent to Daniel Smolik <marvin@mydatex.cz>:
Extra info received and forwarded to list. Copy sent to Christian Hammers <ch@debian.org>. Full text and rfc822 format available.

Message #50 received at 413471@bugs.debian.org (full text, mbox):

From: Daniel Smolik <marvin@mydatex.cz>
To: Christian Hammers <ch@debian.org>
Cc: 413471@bugs.debian.org
Subject: Re: Bug#413471: gdb bt for this bug
Date: Mon, 26 Mar 2007 13:55:18 +0200
Christian Hammers napsal(a):
> Hello
> 
> Sorry, I still have no idea why mysql crashes for you. Please send me
> your /etc/nsswitch.conf. If that also gives us no idea, I forward the
> bug to bugs.mysql.com.
> 
> bye,
> 
> -christian-
Hi Christian,
I have found soution for this bug. Today JKB on Debina Sparc list 
published similar problem and workaroud. But he says that this problem 
is known but not solved a long time ;-(.
I apply his workaround and recompile mysql-client-5.0 from source debs 
and all works !!!!!!!!!



 Hello,

    I use for a long time mysql server on several sparc64 workstations 
running debian testing. I have to rebuild mysql when I need to upgrade 
these systems. Endeed, due to a bug in gcc, I have to rebuild the debian 
package, and after configure stage, I stop the process, edit config.h to 
undef :

/* Define to 1 if you have the `gethostbyaddr_r' function. */
#define HAVE_GETHOSTBYADDR_R 1

/* Define to 1 if you have the `gethostbyname_r' function. */
#undef HAVE_GETHOSTBYNAME_R

and restart compilation. Without this hack, it is impossible to do 
queries from a sparc64 system to a i386 or amd64 due to a bus error. Can 
someone do anything to fix this bug in debian distributions ?

    Regards,

    JKB


Dan



-- 
Mydatex s r.o.
http://www.mydatex.cz
email: smolik@mydatex.cz
mob: 604200362
tel: 226210085



Tags added: upstream Request was from Christian Hammers <ch@debian.org> to control@bugs.debian.org. (Fri, 06 Apr 2007 00:15:01 GMT) Full text and rfc822 format available.

Severity set to `important' from `normal' Request was from Christian Hammers <ch@debian.org> to control@bugs.debian.org. (Fri, 06 Apr 2007 00:15:03 GMT) Full text and rfc822 format available.

Noted your statement that Bug has been forwarded to http://bugs.mysql.com/bug.php?id=14080. Request was from Christian Hammers <ch@debian.org> to control@bugs.debian.org. (Fri, 06 Apr 2007 00:15:04 GMT) Full text and rfc822 format available.

Merged 334339 413471. Request was from Christian Hammers <ch@debian.org> to control@bugs.debian.org. (Fri, 06 Apr 2007 00:15:07 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Christian Hammers <ch@debian.org>:
Bug#413471; Package mysql-client-5.0. Full text and rfc822 format available.

Acknowledgement sent to Daniel Smolik <marvin@mydatex.cz>:
Extra info received and forwarded to list. Copy sent to Christian Hammers <ch@debian.org>. Full text and rfc822 format available.

Message #63 received at 413471@bugs.debian.org (full text, mbox):

From: Daniel Smolik <marvin@mydatex.cz>
To: BERTRAND Joël <joel.bertrand@systella.fr>
Cc: 334339@bugs.debian.org, debian-sparc@lists.debian.org, 413471@bugs.debian.org
Subject: Re: Major bug in mysql build (all versions since 4.1)
Date: Sun, 15 Apr 2007 21:38:43 +0200
[Message part 1 (text/plain, inline)]
BERTRAND Joël napsal(a):
> Daniel Smolik a écrit :
>> BERTRAND Joël napsal(a):
>>> Frans Pop a écrit :
>>>
>>>> tags 334339 - wontfix
>>>> thanks
>>>>
>>>> On Sunday 25 March 2007 20:02, BERTRAND Joël wrote:
>>>>
>>>>>     See bug #334339 (wontfix).
>>>>
>>>>
>>>> IMO the "wontfix" tag is not correct. There should at least be an 
>>>> explanation by the maintainer _why_ he considers this an issue that 
>>>> is does not need to be fixed.
>>>> Removing the tag as it was added without any justification. AFAICT 
>>>> this is a real issue that should be solved.
>>>
>>>
>>>     I aggree.
>>>
>>>>>     Bug was reported to mysql dev without success because dev have 
>>>>> said that is a gcc-4.0 bug, not a mysql bug.
>>>>
>>>>
>>>> Yes, but the gcc maintainers have said that the bug there has been 
>>>> fixed
>>>> "long ago". Unfortunately they don't say in which version.
>>>
>>>
>>>     "has been fixed" ? I have tried to build mysql with _all_ gcc 
>>> release between 3.3 and 4.1 without any success. Where have you seen 
>>> that this bug was fixed ?
>>>
>>>>> Maybe, but I think it is not very difficult to fix the configure.in
>>>>> script to avoid this bug.
>>>>
>>>>
>>>> I have no idea about that and no idea how that would affect other 
>>>> architectures. Anyway, It is now probably too late to fix this for 
>>>> Etch.
>>>
>>>
>>>     I have no idea too. In a first time, I suspected a 32 bits wide 
>>> userland and a 64 bits kernel... Maybe a trouble with gcc include on 
>>> sparc architectures.
>>>
>>>     Regards,
>>>
>>>     JKB
>>>
>>>
>> Hi,
>> could you tell me if this bug
>> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=413471
>> reported by me is the same as bug you reported ?
> 
>     Yes, I think. But to be sure, you have to apply my workaround.
> 
>     Regards,
> 
>     JKB
> 
> 
Hi,
I am  100% sure that my  colleague  found fundamentals  of this bug.
On SPARC linux is used  thread safe version of gethostbyname 
genthostbyname_r. This function have third argument char buffer. But if 
this buffer is not correctly aligned (on SPARC / 4 ) program crashed 
with BUSS ERROR. I attach demonstrate program to test this issue. If you 
change  size of buffer from 1002 to 1000 program start working.
I mean  that simple workaround on SPARC is not use gethostbyname_r.
I try report this bug to glibc. Because  I mean that this is glibc bug 
or compatibility problem.

			Regards
					Dan






-- 
Mydatex s r.o.
http://www.mydatex.cz
email: smolik@mydatex.cz
mob: 604200362
tel: 226210085
[gethostbyname.c (text/x-csrc, inline)]
#include<stdio.h>
#include<netdb.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>

extern int h_errno;


int  main(void)
{

int ret;
const char *name="karotka";
char buf[1002];
int  tmp_errno,buflen;
struct hostent tmp_hostent,*hp;
//struct hostent_data hd;
int size;

buflen=1000;

//size=sizeof(struct hostent_data);
//printf("size=%d\n",size);

  
  printf("Align buff result=%p,buffer=%p,buflen=%d\n",&tmp_hostent,buf,buflen);

  ret=gethostbyname_r(name,&tmp_hostent, buf,buflen,&hp,&tmp_errno);  

  printf("ret:=%d\n",ret);
  if(ret==0)
  {
  
    if(hp)
    {
    
        printf("Lenght:=%d\n",hp->h_length);
        printf("Addr:=%X\n",hp->h_addr);
        printf("Name:=%s\n",hp->h_name);
        
    
    }
  
  
  }






 return(ret);
}

Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#413471; Package mysql-client-5.0. Full text and rfc822 format available.

Acknowledgement sent to Christian Hammers <ch@debian.org>:
Extra info received and forwarded to list. Full text and rfc822 format available.

Message #68 received at 413471@bugs.debian.org (full text, mbox):

From: Christian Hammers <ch@debian.org>
To: Daniel Smolik <marvin@mydatex.cz>, 413471@bugs.debian.org
Cc: dc <control@bugs.debian.org>
Subject: Re: Bug#413471: gethostbyname_r on Sparc has alignement bug that crashes MySQL
Date: Mon, 16 Apr 2007 23:45:20 +0200
[Message part 1 (text/plain, inline)]
retitle 413471 gethostbyname_r on Sparc has alignement bug that crashes MySQL
reassign 413471 libc6
stop

Hi libc maintainers

This could be a libc issue. If you are sure that it is a programming mistake
feel free to reassign:

On 2007-04-15 Daniel Smolik wrote:
> On SPARC linux is used  thread safe version of gethostbyname 
> genthostbyname_r. This function have third argument char buffer. But if 
> this buffer is not correctly aligned (on SPARC / 4 ) program crashed 
> with BUSS ERROR. I attach demonstrate program to test this issue. If you 
> change  size of buffer from 1002 to 1000 program start working.
> I mean  that simple workaround on SPARC is not use gethostbyname_r.
> I try report this bug to glibc. Because  I mean that this is glibc bug 
> or compatibility problem.

The mentioned test program is in the BTS.

bye,

-christian-
[signature.asc (application/pgp-signature, attachment)]

Changed Bug title to gethostbyname_r on Sparc has alignement bug that crashes MySQL from mysql-client-5.0: mysql client crash with SIGBUS when try connect to remote DB on Debian SPARC . Request was from Christian Hammers <ch@debian.org> to control@bugs.debian.org. (Mon, 16 Apr 2007 21:48:11 GMT) Full text and rfc822 format available.

Bug reassigned from package `mysql-client-5.0' to `libc6'. Request was from Christian Hammers <ch@debian.org> to control@bugs.debian.org. (Mon, 16 Apr 2007 21:48:13 GMT) Full text and rfc822 format available.

Forcibly Merged 334339 413471 419459. Request was from Aurelien Jarno <aurel32@debian.org> to control@bugs.debian.org. (Mon, 16 Apr 2007 22:18:03 GMT) Full text and rfc822 format available.

Tags added: pending Request was from Aurelien Jarno <aurel32@debian.org> to control@bugs.debian.org. (Tue, 17 Apr 2007 21:33:10 GMT) Full text and rfc822 format available.

Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Mon, 25 Jun 2007 07:22:36 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Thu Apr 17 22:00:24 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.