Bug 509552

Summary: patch[4601]: segfault at 0 ip 00000031d767ee70 sp 00007fff68ea9ba8 error 4 in libc-2.10.1.so[31d7600000+164000]
Product: [Fedora] Fedora Reporter: udo <udovdh>
Component: patchAssignee: Tim Waugh <twaugh>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: 11CC: jakub, schwab, twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-07-03 13:49:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description udo 2009-07-03 13:29:09 UTC
Description of problem:
patch[4601]: segfault at 0 ip 00000031d767ee70 sp 00007fff68ea9ba8 error 4 in libc-2.10.1.so[31d7600000+164000]
while trying to patch kernel 2.6.30 to 2.6.30.1.


Version-Release number of selected component (if applicable):
glibc-2.10.1-2.x86_64

How reproducible:
Patch kernel 2.6.30 to 2.6.30.1

Steps to Reproduce:
1. wget -c http://kernel.org/pub/linux/kernel/v2.6/patch-2.6.30.1.bz2
2. bzip2 -d patch-2.6.30.1.bz2
3. patch -p1 < patch-2.6.30.1
  
Actual results:
segfault

Expected results:
patched kernel

Additional info:
[root@surfplank2 linux]# gdb patch
GNU gdb (GDB) Fedora (6.8.50.20090302-32.fc11)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Missing separate debuginfos, use: debuginfo-install patch-2.5.4-38.fc11.x86_64
(gdb) run -p1 < ../patch-2.6.30.1
Starting program: /usr/bin/patch -p1 < ../patch-2.6.30.1
patching file Documentation/sysctl/vm.txt
patching file Makefile
patching file arch/arm/include/asm/cacheflush.h
patching file arch/x86/crypto/aesni-intel_asm.S

Program received signal SIGSEGV, Segmentation fault.
strcmp () at ../sysdeps/x86_64/strcmp.S:29
29	L(oop):	movb	(%rdi), %al
Current language:  auto; currently asm
(gdb) bt
#0  strcmp () at ../sysdeps/x86_64/strcmp.S:29
#1  0x0000000000408233 in ?? ()
#2  0x00000031d761ea2d in __libc_start_main (main=<value optimized out>, argc=<value optimized out>, ubp_av=<value optimized out>, init=<value optimized out>, fini=<value optimized out>, 
    rtld_fini=<value optimized out>, stack_end=0x7fffffffe5f8) at libc-start.c:220
#3  0x0000000000401db9 in fflush () at iofflush.c:36
#4  0x00007fffffffe5f8 in ?? ()
#5  0x000000000000001c in ?? ()
#6  0x0000000000000002 in ?? ()
#7  0x00007fffffffe86f in ?? ()
#8  0x00007fffffffe87e in ?? ()
#9  0x0000000000000000 in ?? ()
(gdb) 

Maybe also see https://bugzilla.redhat.com/show_bug.cgi?id=505564 ?
After a reboot problem remains.

Comment 1 Andreas Schwab 2009-07-03 13:46:44 UTC
Thus patch is calling strcmp with a NULL argument.

(gdb) i line *0x0000000000408233
Line 420 of "patch.c" starts at address 0x40821c <main+6332>
   and ends at 0x40823b <main+6363>.
(gdb) l patch.c:420
415                         pfatal ("Can't set permissions on file %s",
416                                 quotearg (outname));
417                       if (! inerrno && incontext) {
418                               security_context_t outcontext;
419                               getfilecon (outname, &outcontext);
420                               if (strcmp(outcontext, incontext) &&
421                                   setfilecon (outname, incontext) != 0) {
422                                       if (errno != ENOTSUP && errno != EPERM)
423                                               pfatal ("Can't set security context on file %s",
424                                                       quotearg (outname));

Comment 2 Andreas Schwab 2009-07-03 13:49:54 UTC

*** This bug has been marked as a duplicate of bug 498102 ***