"-h argument" option makes innobackupex segfault

Bug #1655438 reported by Hartmut Holzgraefe on 2017-01-10
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona XtraBackup moved to https://jira.percona.com/projects/PXB
Status tracked in 2.4
2.3
Fix Released
Low
Sergei Glushchenko
2.4
Fix Released
Low
Sergei Glushchenko

Bug Description

When using "-h" with an argument with innobackupex (v2.4.4), e.g. "innobackupex -h hostname" the binary segfaults with the following backtrace:

#0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:62
#1 0x0000000000de7357 in my_write_core (sig=sig@entry=11) at /home/hartmut/projects/percona/releases/percona-xtrabackup-2.4.4/mysys/stacktrace.c:247
#2 0x0000000000d2da55 in handle_fatal_signal (sig=11) at /home/hartmut/projects/percona/releases/percona-xtrabackup-2.4.4/sql/signal_handler.cc:151
#3 <signal handler called>
#4 my_handle_options (argc=argc@entry=0x7ffd93dc6aec, argv=argv@entry=0x7ffd93dc6ae0, longopts=longopts@entry=0x19e3120 <xb_long_options>,
    get_one_option=get_one_option@entry=0x7195f0 <xb_get_one_option(int, my_option const*, char*)>, command_list=command_list@entry=0x0,
    ignore_unknown_option=ignore_unknown_option@entry=0 '\000') at /home/hartmut/projects/percona/releases/percona-xtrabackup-2.4.4/mysys_ssl/my_getopt.cc:252
#5 0x0000000000758f40 in handle_options (argc=argc@entry=0x7ffd93dc6aec, argv=argv@entry=0x7ffd93dc6ae0, longopts=longopts@entry=0x19e3120 <xb_long_options>,
    get_one_option=get_one_option@entry=0x7195f0 <xb_get_one_option(int, my_option const*, char*)>)
    at /home/hartmut/projects/percona/releases/percona-xtrabackup-2.4.4/mysys_ssl/my_getopt.cc:99
#6 0x00000000006f98a0 in main (argc=17, argv=0x1d0a710) at /home/hartmut/projects/percona/releases/percona-xtrabackup-2.4.4/storage/innobase/xtrabackup/src/xtrabackup.cc:7791

As far as I can tell this only happens after the innobackupex.cc call to handle_options() has not found anything useful and has passed control back to xtrabackup.cc, which calls handle_options() a second time. This time the argv element that originally pointed to the argument to "-h" now has been replaced with a NULL pointer though, and so causes the 2nd run of handle_options() to crash

This only happens with "-h" and not with any of the 25 other possible single character options

Syntax is incorrect, one should use

xtrabackup --host=host-name --target-dir=target-dir

or

innobackupex --host=host-name target-dir

But nevertheless, innobackupex should not crash.

See also bug 1652044 for introducing shortcuts for introducing shortcuts for client options.

I originally had "unsupported" in the description, then rewrote the first paragraph before submitting and it somehow got lost ...

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PXB-947

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers