Skip to content

encounter Segmentation fault when using ipmitool #118

Closed
leye7755 opened this issue Apr 17, 2019 · 14 comments · Fixed by #120
Closed

encounter Segmentation fault when using ipmitool #118

leye7755 opened this issue Apr 17, 2019 · 14 comments · Fixed by #120
Assignees
Labels
bug Something isn't working

Comments

@leye7755
Copy link

Core was generated by ipmitool -I lanplus -H xxxxxx -U xxxx -P XXXXXXXXX raw 0x3a 0x71 0x01
Program terminated with signal 11, Segmentation fault.

Why does this problem arise? We use popen to use ipmitool

@leye7755
Copy link
Author

Looking forward to and thanking you for your help。@AlexanderAmelkin

@leye7755
Copy link
Author

using sdr module encountered a problem:
debug details:
ipmi_sdr.c : ipmi_ipmi_sdr_read_sensor_value() call ipmi_sdr_get_unit_string( intf, pct, type, base,modifier)
and base is 255 which exceed the size of unit_desc array . leading to Segmentation fault。

@AlexanderAmelkin
Copy link
Contributor

Can you please run ipmitool with nine -v arguments (that is, ipmitool -vvvvvvvvv ...) and attach (don't copy-paste) the output here? It's unclear why base is 255. Looks like an invalid response from your BMC. I'd like to see the full communication log to understand how to properly handle it.

@leye7755
Copy link
Author

@AlexanderAmelkin Can i send # your email? can't find the way to attach log.

@AlexanderAmelkin
Copy link
Contributor

Please check the branch from PR #120

@AlexanderAmelkin
Copy link
Contributor

As for attachments, there is the "Attach files by dragging..." string right below the comment entry box here on this page.

@AlexanderAmelkin
Copy link
Contributor

Sorry, committed the wrong version there. Will fix soon.

@leye7755
Copy link
Author

sdr.log
this is sdr log

@AlexanderAmelkin
Copy link
Contributor

@leye7755, I don't see a segmentation fault in the attached log. Is it the log from #120 ?

@leye7755
Copy link
Author

sdr-20190423.log
I add comment in ipmi_sdr.c : ipmi_sdr_get_unit_string()
printf("#test:%d#\n",base);

@AlexanderAmelkin
Copy link
Contributor

I now see it hit the wrong string for CPU1 DTS sensor.
That's quite expected with the old code, there is no range check in it.
Have you tried running the code from #120 ?

@AlexanderAmelkin
Copy link
Contributor

It's unclear though why base is 0xFF, or to be more precise, why only 19 bytes of SDR Record are requested by ipmitool (see line 2379 of your sdr-20190423.log) when unit info is in bytes 21-23.
I'll look into it further, but I suspect there may be some invalid response from your BMC involved.

@AlexanderAmelkin
Copy link
Contributor

Ok, those 19 bytes are just a remainder of total 51 bytes minus 32 bytes read earlier. Digging further...

@AlexanderAmelkin
Copy link
Contributor

@leye7755, please tell how the program behaves if built from PR #120.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants