This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Lua script - Segmentation fault 11 in 2.0.0rc3 on OS X

1

On OS X, a very simple script was running in 1.12.3, just upgraded to 2.0.0rc3 and it fails after a few time:

local wlan = Listener.new("wlan")
local wlan_mgt_ssid_f = Field.new("wlan_mgt.ssid")
function wlan.packet(pinfo,tvb,tapinfo)
    if (wlan_mgt_ssid_f() ~= nil) then
        print(tostring(wlan_mgt_ssid_f()))
    end
end

I run it in monitor mode with tshark:

/Applications/Wireshark\ 2.0.0rc3.app/Contents/MacOS/tshark -I -q -i en0 -X lua_script:wlan_probe_req.lua

I have a dozen of results before it crashes systematically with a segmentation fault 11

At one point, I had an error saying a variable was mutated:

tshark(42188,0x7fff76185000) malloc: * error for object 0x7fe53ca9b348: incorrect checksum for freed object - object was probably modified after being freed.
    * set a breakpoint in malloc_error_break to debug

Is my field mutated? How can I protect it? I've followed sample examples ...

Thanks

asked 17 Nov '15, 08:57

TomLaBaude's gravatar image

TomLaBaude
66171724
accept rate: 66%


2 Answers:

4

Hi Thomas,

This seems to be a regression and I just filled bug 11722.

Edit: and Stig just fixed it. It will be in official 2.0 release.

answered 17 Nov '15, 12:06

Pascal%20Quantin's gravatar image

Pascal Quantin
5.5k1060
accept rate: 30%

edited 17 Nov '15, 13:58

1

This issue was related to the new "Reload Lua Plugins" UI functionality in 2.0. A fix to the bug report has been committed.

As a temporary workaround for RC3 you can try removing "local" in front of wlan to avoid the listener to go out of scope (being garbage collected).

(17 Nov '15, 14:04) stig ♦

Thanks guys for your reactivity! The temporary workaround work as well. Can I already download a release with the fix, or I wait for an official 2.0.0rc4?

(18 Nov '15, 00:57) TomLaBaude
1

There are automated builds available for OSX here but it's a bit tricky to work out if they include the change.

Tricky as in I can't see how to relate the build revisions (which have a git hash) to the commit for the change (which also has a git hash).

Maybe just pick the most recent one that has a timestamp a few hours after the timestamp of the commit.

(18 Nov '15, 02:26) grahamb ♦
1

You can use git describe $commit_hash to find out the release where it ended up. For 2.0 and 2.1 respectively: v2.0.0rc3-75-g290601a and v2.1.0rc0-620-g1329743. The versions currently listed on the automated builds page are up-to-date with the LUA fix.

(18 Nov '15, 02:55) Lekensteyn

@Lekensteyn

Doesn't that command require you to have installed git and cloned the repo in the first place? If so, that's not usable for non-devs.

We should have a simple method for non-devs to determine if a build includes a change. Maybe a web page that does that command on behalf of the user, extra credit for allowing a Gerrit change number as the reference to check for.

(18 Nov '15, 04:08) grahamb ♦

One can compare the CommitDate with the items listed at the gitweb interface: for master (Development) and master-2.0. Perhaps Gerrit can be taught to print this description too in the review messages ("cherry-picked as XXX" " (v2.0.0-nnn-gXXX)")

(18 Nov '15, 04:41) Lekensteyn
showing 5 of 6 show 1 more comments

0

Could be a bug in the memory management of the Lua code.

Can you please try the following code? Does that cause a segfault as well?

local wlan = Listener.new("wlan")
local wlan_mgt_ssid_f = Field.new("wlan_mgt.ssid")
function wlan.packet(pinfo,tvb,tapinfo)
    local wlan_mgt_ssid = wlan_mgt_ssid_f() 
    if (wlan_mgt_ssid ~= nil) then
        print(tostring(wlan_mgt_ssid_f))
    end
end

Regards
Kurt

answered 17 Nov '15, 12:17

Kurt%20Knochner's gravatar image

Kurt Knochner ♦
24.8k1039237
accept rate: 15%

I did not see the post of @Pascal Quantin as there was no connection in the train ;-)

(17 Nov '15, 12:18) Kurt Knochner ♦