From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7116 invoked by alias); 27 Oct 2009 20:43:19 -0000 Received: (qmail 7107 invoked by uid 22791); 27 Oct 2009 20:43:17 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 27 Oct 2009 20:43:12 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9RKhBbn016453 for ; Tue, 27 Oct 2009 16:43:11 -0400 Received: from [10.11.231.159] (dhcp231-159.rdu.redhat.com [10.11.231.159]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9RKhAQm022263 for ; Tue, 27 Oct 2009 16:43:10 -0400 Message-ID: <4AE75B14.3040001@redhat.com> Date: Tue, 27 Oct 2009 20:43:00 -0000 From: Stan Cox User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20090922 Fedora/3.0-2.7.b4.fc11 Lightning/1.0pre Thunderbird/3.0b4 MIME-Version: 1.0 To: systemtap@sourceware.org Subject: Re: setting a shared library static References: <4AE73F1C.2000503@redhat.com> <4AE74BF1.50502@redhat.com> In-Reply-To: <4AE74BF1.50502@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2009-q4/txt/msg00318.txt.bz2 The test program via the macros in sdt.h, and help from stap, save away dwfl_module_relocate_address(&static variable). When stap runs it relocates &static_variable and when the writeable segment of the .so is mmapped it increments it via __access_process_vm and decrements it via __access_process_vm. If static_variable is not in a .so then it works as expected. Otherwise static_variable gets set in stap_uprobe_mmap_found via task_finder.c::__stp_call_mmap_callbacks. The value of &static_variable is checked at the mmap and munmap callbacks. The behavior I'm noticing is that at the first callback for munmap the value of &static_variable has become unavailable. eu-readelf -lS libsdt-uprobe.so There are 36 section headers, starting at offset 0x2518: Section Headers: [Nr] Name Type Addr Off Size ES Flags Lk Inf Al [ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 [ 1] .note.gnu.build-id NOTE 0000000000000190 00000190 00000024 0 A 0 0 4 [ 2] .gnu.hash GNU_HASH 00000000000001b8 000001b8 00000064 0 A 3 0 8 [ 3] .dynsym DYNSYM 0000000000000220 00000220 000001f8 24 A 4 2 8 [ 4] .dynstr STRTAB 0000000000000418 00000418 00000119 0 A 0 0 1 [ 5] .gnu.version GNU_versym 0000000000000532 00000532 0000002a 2 A 3 0 2 [ 6] .gnu.version_r GNU_verneed 0000000000000560 00000560 00000020 0 A 4 1 8 [ 7] .rela.dyn RELA 0000000000000580 00000580 00000258 24 A 3 0 8 [ 8] .rela.plt RELA 00000000000007d8 000007d8 00000048 24 A 3 10 8 [ 9] .init PROGBITS 0000000000000820 00000820 00000018 0 AX 0 0 4 [10] .plt PROGBITS 0000000000000838 00000838 00000040 16 AX 0 0 4 [11] .text PROGBITS 0000000000000880 00000880 00000718 0 AX 0 0 16 [12] .fini PROGBITS 0000000000000f98 00000f98 0000000e 0 AX 0 0 4 [13] .rodata PROGBITS 0000000000000fa8 00000fa8 00000119 0 A 0 0 8 [14] .eh_frame_hdr PROGBITS 00000000000010c4 000010c4 0000001c 0 A 0 0 4 [15] .eh_frame PROGBITS 00000000000010e0 000010e0 0000005c 0 A 0 0 8 [16] .ctors PROGBITS 0000000000201140 00001140 00000010 0 WA 0 0 8 [17] .dtors PROGBITS 0000000000201150 00001150 00000010 0 WA 0 0 8 [18] .jcr PROGBITS 0000000000201160 00001160 00000008 0 WA 0 0 8 [19] .data.rel.ro PROGBITS 0000000000201168 00001168 00000008 0 WA 0 0 8 [20] .dynamic DYNAMIC 0000000000201170 00001170 00000190 16 WA 4 0 8 [21] .got PROGBITS 0000000000201300 00001300 00000050 8 WA 0 0 8 [22] .got.plt PROGBITS 0000000000201350 00001350 00000030 8 WA 0 0 8 [23] .probes PROGBITS 0000000000201380 00001380 00000122 0 WA 0 0 8 [24] .bss NOBITS 00000000002014a8 000014a2 00000018 0 WA 0 0 8 [25] .comment PROGBITS 0000000000000000 000014a2 0000010e 0 0 0 1 [26] .debug_aranges PROGBITS 0000000000000000 000015b0 00000060 0 0 0 1 [27] .debug_pubnames PROGBITS 0000000000000000 00001610 000000e5 0 0 0 1 [28] .debug_info PROGBITS 0000000000000000 000016f5 000007e2 0 0 0 1 [29] .debug_abbrev PROGBITS 0000000000000000 00001ed7 0000017e 0 0 0 1 [30] .debug_line PROGBITS 0000000000000000 00002055 0000010b 0 0 0 1 [31] .debug_str PROGBITS 0000000000000000 00002160 000001cc 1 MS 0 0 1 [32] .debug_loc PROGBITS 0000000000000000 0000232c 00000098 0 0 0 1 [33] .shstrtab STRTAB 0000000000000000 000023c4 00000152 0 0 0 1 [34] .symtab SYMTAB 0000000000000000 00002e18 000006d8 24 35 54 8 [35] .strtab STRTAB 0000000000000000 000034f0 0000024a 0 0 0 1 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x00113c 0x00113c R E 0x200000 LOAD 0x001140 0x0000000000201140 0x0000000000201140 0x000362 0x000380 RW 0x200000 DYNAMIC 0x001170 0x0000000000201170 0x0000000000201170 0x000190 0x000190 RW 0x8 NOTE 0x000190 0x0000000000000190 0x0000000000000190 0x000024 0x000024 R 0x4 GNU_EH_FRAME 0x0010c4 0x00000000000010c4 0x00000000000010c4 0x00001c 0x00001c R 0x4 GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0x8 Section to Segment mapping: Segment Sections... 00 [RO: .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame] 01 .ctors .dtors .jcr .data.rel.ro .dynamic .got .got.plt .probes .bss 02 .dynamic 03 [RO: .note.gnu.build-id] 04 [RO: .eh_frame_hdr] 05