Ticket #1695 (closed defect: fixed)

Opened 11 years ago

Last modified 11 years ago

opkg r4562 segfaults like hell

Reported by: koen Owned by: tick
Priority: highest Milestone:
Component: opkg Version: current svn head
Severity: blocker Keywords:
Cc: opkg-devel@… Blocked By:
Blocking: Estimated Completion (week):
HasPatchForReview: PatchReviewResult:
Reproducible:

Description

it segfaults on nearly all operations, here a backtrace:

GNU gdb 6.8
Copyright (C) 2008 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 "arm-angstrom-linux-gnueabi"...
(gdb) run install hal
Starting program: /usr/bin/opkg install hal

Program received signal SIGSEGV, Segmentation fault.
0x40042964 in void_list_remove_elt () from /usr/lib/libopkg.so.0
Current language: auto; currently asm
(gdb) bt
#0 0x40042964 in void_list_remove_elt () from /usr/lib/libopkg.so.0
#1 0x4003e790 in file_hash_set_file_owner () from /usr/lib/libopkg.so.0
#2 0x4003a00c in pkg_info_preinstall_check () from /usr/lib/libopkg.so.0
#3 0x40033444 in opkg_install_cmd () from /usr/lib/libopkg.so.0
#4 0x400319a0 in opkg_cmd_exec () from /usr/lib/libopkg.so.0
#5 0x4002f9cc in opkg_op () from /usr/lib/libopkg.so.0
#6 0x40191a0c in libc_start_main () from /lib/libc.so.6
#7 0x00008548 in _start ()
(gdb)

Change History

comment:1 Changed 11 years ago by tick

  • Status changed from new to accepted

Ouch! Sorry..
I am looking into this.

comment:2 Changed 11 years ago by tick

In my testing I printed some debug message out, and then it does not crash at all. However if I remove debug message, it starts crashes.
(Why some delay helps? Racing condition?)

The following patch can avoid crash. But I don't think it's the real solution.
That means there are someone pointing to the installed_files but not adding reference count.

Index: pkg.c
===================================================================
--- pkg.c (revision 4562)
+++ pkg.c (working copy)
@@ -1737,7 +1737,7 @@

opkg_message(conf, OPKG_DEBUG2, "pkg %s: file=%s\n", pkg->name, installed_file);
file_hash_set_file_owner(conf, installed_file, pkg);

}

  • pkg_free_installed_files(pkg);

+ pkg_free_installed_files(pkg);

}
pkg_vec_free(installed_pkgs);

comment:3 Changed 11 years ago by tick

remove this line first on svn. 4563 (Let user can use)

Keep digging

comment:4 Changed 11 years ago by tick

I think I found the reason:

The package use the installed_files without get and free

Index: pkg_hash.c
===================================================================
--- pkg_hash.c (revision 4562)
+++ pkg_hash.c (working copy)
@@ -648,10 +648,12 @@

opkg_message(conf, OPKG_DEBUG2, "owning_pkg=%s filename=%s\n", owning_pkg->name, file_name);
hash_table_insert(file_hash, file_name, owning_pkg);
if (old_owning_pkg) {

+ pkg_get_installed_files(old_owning_pkg);

str_list_remove_elt(old_owning_pkg->installed_files, file_name);

+ pkg_free_installed_files(old_owning_pkg);

/* mark this package to have its filelist written */
old_owning_pkg->state_flag |= SF_FILELIST_CHANGED;
owning_pkg->state_flag |= SF_FILELIST_CHANGED;

}
return 0;

}

comment:5 Changed 11 years ago by tick

  • Cc opkg-devel@… added
  • Status changed from accepted to in_testing

Should be solved.
Really thanks Koen for reporting this.

comment:6 Changed 11 years ago by tick

Hi Koen,
It's very hard for QA team to test.
It works (4564) for me now.
If it works for you either please close it.

Thank you.

comment:7 Changed 11 years ago by koen

  • Status changed from in_testing to closed
  • Resolution set to fixed

it works for me now, thanks for fixing it so fast!

Note: See TracTickets for help on using tickets.