{"id":55,"date":"2007-11-14T16:41:39","date_gmt":"2007-11-14T16:41:39","guid":{"rendered":"http:\/\/blog.danplanet.com\/wordpress\/?p=55"},"modified":"2011-11-29T16:52:50","modified_gmt":"2011-11-29T16:52:50","slug":"sblim-and-their-broken-abi","status":"publish","type":"post","link":"https:\/\/www.danplanet.com\/blog\/2007\/11\/14\/sblim-and-their-broken-abi\/","title":{"rendered":"SBLIM and their broken ABI"},"content":{"rendered":"<p>The CMPI standard defines the interface between a conforming provider and the CIMOM that loads it.\u00a0 It&#8217;s a massive set of data structures, types, and functions that allow the CIM server to delegate requests to providers, and for providers to make use of broker services.\u00a0 Like any standard ABI, it must be standard and uniform to allow any provider binary to be loadable in any CIMOM.<\/p>\n<p>Yesterday, I was debugging a strange crash that I was seeing with <a href=\"http:\/\/openpegasus.org\">Pegasus<\/a> (as shipped in Fedora <img decoding=\"async\" src=\"https:\/\/www.danplanet.com\/blog\/wp-content\/themes\/wordpress-grey-opaque-master\/images\/smilies\/icon_cool.gif\" alt=\"Smilie: 8)\" title=\"Smilie: 8)\" \/>, which was related to libcmpiutil&#8217;s asynchronous indication support.\u00a0 The indication is triggered using the CBInvokeMethod broker callback function.\u00a0 Adding debug print statements galore, I tracked it down to where the actual callback was being made.\u00a0 Since I can&#8217;t (and don&#8217;t want to) add debug print statements to Pegasus, I re-ran the whole thing in gdb.\u00a0 Sure enough, the crash is somewhere in Pegasus.\u00a0 However, I spotted something very strange in the stack trace:<\/p>\n<blockquote>\n<p style=\"font-family: Courier New,Courier,mono;\">#0\u00a0 Pegasus::value2CIMValue (data=0x2aaab285e312, type=63920, rc=0x41e00e7c)<br \/>\nat CMPI_Value.cpp:70<br \/>\n#1\u00a0 0x00002aaab16b7e2c in mbSetProperty (mb=0x5555558ab1d0,<br \/>\nctx=0x5555558ab1d0, cop=0x41e01450, name=0x555555864550 &#8220;&#8221;,<br \/>\nval=0x2aaab285e312, type=63920) at CMPI_Broker.cpp:562<br \/>\n#2\u00a0 0x00002aaab285d97d in stdi_trigger_indication ()<br \/>\nfrom \/usr\/lib64\/libcmpiutil.so.0<br \/>\n#3\u00a0 0x00002aaab18ec099 in trigger_indication (context=0x41e01450,<br \/>\nbase_type=&lt;value optimized out&gt;, ns=0x555555829f30 &#8220;root\/virt&#8221<img decoding=\"async\" src=\"https:\/\/www.danplanet.com\/blog\/wp-content\/themes\/wordpress-grey-opaque-master\/images\/smilies\/icon_wink.gif\" alt=\"Smilie: ;)\" title=\"Smilie: ;)\" \/><br \/>\nat Virt_VirtualSystemManagementService.c:362<br \/>\n&lt;snip&gt;<\/p>\n<\/blockquote>\n<p>The <span class=\"dan_code\">stdi_trigger_indication()<\/span> function is where the <span class=\"dan_code\">CBInvokeMethod()<\/span> call is made, so why is the next stack frame in the <span class=\"dan_code\">mbSetProperty()<\/span> function?\u00a0 I stewed on this a bit and then happened to notice that in <span class=\"dan_code\">cmpift.h<\/span>, <span class=\"dan_code\">setProperty<\/span> comes right after <span class=\"dan_code\">invokeMethod<\/span>.\u00a0 This was the key to the puzzle.\u00a0 Somehow, my <span class=\"dan_code\">_CMPIBrokerFT<\/span> function table was off by a <span class=\"dan_code\">void*<\/span>, which meant that I neatly executed the next function down, which was sure to fail.\u00a0 But why?<\/p>\n<p>I noticed that there were two <span class=\"dan_code\">cmpift.h<\/span> files on my system, one in <span class=\"dan_code\">\/usr\/include\/cmpi<\/span>, belonging to the sblim-cmpi-devel package, and another in <span class=\"dan_code\">\/usr\/include\/Pegasus\/CMPI<\/span> belonging to the tog-pegasus package.\u00a0 I thought it was a long shot, but I wrote a tiny program to print the size of the <span class=\"dan_code\">_CMPIBrokerFT<\/span> structure, and compiled it against each, and sure enough: the sblim version was 8 bytes longer!<\/p>\n<p>Upon further investigation, I found the problem.\u00a0 The very first parameter of <span class=\"dan_code\">_CMPIBrokerFT<\/span> was an <span class=\"dan_code\">unsigned long<\/span> in the sblim case and an <span class=\"dan_code\">unsigned int<\/span> in the Pegasus case.\u00a0 On a 32-bit platform, they are both 4-byte types, but on a 64-bit machine, the <span class=\"dan_code\">unsigned long<\/span> is 8 bytes.\u00a0 Neatly aligning the first function pointer to an 8-byte boundary meant that all my functions still &#8220;worked&#8221;, but in an off-by-one crash-you-where-you-least-expect-it kinda way.<\/p>\n<p>I reported it to the sblim mailing list and got a confirmation that indeed the sblim version of <span class=\"dan_code\">cmpift.h<\/span> is wrong and needs to change.\u00a0 Until then, make sure you don&#8217;t have the sblim headers on your machine when compiling 64-bit providers to be used under Pegasus or you&#8217;ll regret it!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The CMPI standard defines the interface between a conforming provider and the CIMOM that loads it.\u00a0 It&#8217;s a massive set of data structures, types, and functions that allow the CIM server to delegate requests to providers, and for providers to &hellip; <a href=\"https:\/\/www.danplanet.com\/blog\/2007\/11\/14\/sblim-and-their-broken-abi\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[28,42,41],"class_list":["post-55","post","type-post","status-publish","format-standard","hentry","category-codemonkeying","tag-cim","tag-pegasus","tag-sblim"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SBLIM and their broken ABI - Right Angles<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.danplanet.com\/blog\/2007\/11\/14\/sblim-and-their-broken-abi\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SBLIM and their broken ABI - Right Angles\" \/>\n<meta property=\"og:description\" content=\"The CMPI standard defines the interface between a conforming provider and the CIMOM that loads it.\u00a0 It&#8217;s a massive set of data structures, types, and functions that allow the CIM server to delegate requests to providers, and for providers to &hellip; Continue reading &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.danplanet.com\/blog\/2007\/11\/14\/sblim-and-their-broken-abi\/\" \/>\n<meta property=\"og:site_name\" content=\"Right Angles\" \/>\n<meta property=\"article:published_time\" content=\"2007-11-14T16:41:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2011-11-29T16:52:50+00:00\" \/>\n<meta name=\"author\" content=\"Dan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.danplanet.com\/blog\/2007\/11\/14\/sblim-and-their-broken-abi\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.danplanet.com\/blog\/2007\/11\/14\/sblim-and-their-broken-abi\/\"},\"author\":{\"name\":\"Dan\",\"@id\":\"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/0f6920aa6d63cae437bf8b122200287c\"},\"headline\":\"SBLIM and their broken ABI\",\"datePublished\":\"2007-11-14T16:41:39+00:00\",\"dateModified\":\"2011-11-29T16:52:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.danplanet.com\/blog\/2007\/11\/14\/sblim-and-their-broken-abi\/\"},\"wordCount\":524,\"publisher\":{\"@id\":\"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/0f6920aa6d63cae437bf8b122200287c\"},\"keywords\":[\"CIM\",\"pegasus\",\"sblim\"],\"articleSection\":[\"Codemonkeying\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.danplanet.com\/blog\/2007\/11\/14\/sblim-and-their-broken-abi\/\",\"url\":\"https:\/\/www.danplanet.com\/blog\/2007\/11\/14\/sblim-and-their-broken-abi\/\",\"name\":\"SBLIM and their broken ABI - Right Angles\",\"isPartOf\":{\"@id\":\"https:\/\/www.danplanet.com\/blog\/#website\"},\"datePublished\":\"2007-11-14T16:41:39+00:00\",\"dateModified\":\"2011-11-29T16:52:50+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.danplanet.com\/blog\/2007\/11\/14\/sblim-and-their-broken-abi\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.danplanet.com\/blog\/2007\/11\/14\/sblim-and-their-broken-abi\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.danplanet.com\/blog\/2007\/11\/14\/sblim-and-their-broken-abi\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.danplanet.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SBLIM and their broken ABI\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.danplanet.com\/blog\/#website\",\"url\":\"https:\/\/www.danplanet.com\/blog\/\",\"name\":\"Right Angles\",\"description\":\"If they&#039;re not right...they&#039;re wrong\",\"publisher\":{\"@id\":\"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/0f6920aa6d63cae437bf8b122200287c\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.danplanet.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/0f6920aa6d63cae437bf8b122200287c\",\"name\":\"Dan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/9b73782704be64dd8c030087af2d1ae0c1dc488cad69093ff0366dbaad2de673?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/9b73782704be64dd8c030087af2d1ae0c1dc488cad69093ff0366dbaad2de673?s=96&d=mm&r=g\",\"caption\":\"Dan\"},\"logo\":{\"@id\":\"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/www.danplanet.com\/blog\/author\/dan\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SBLIM and their broken ABI - Right Angles","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.danplanet.com\/blog\/2007\/11\/14\/sblim-and-their-broken-abi\/","og_locale":"en_US","og_type":"article","og_title":"SBLIM and their broken ABI - Right Angles","og_description":"The CMPI standard defines the interface between a conforming provider and the CIMOM that loads it.\u00a0 It&#8217;s a massive set of data structures, types, and functions that allow the CIM server to delegate requests to providers, and for providers to &hellip; Continue reading &rarr;","og_url":"https:\/\/www.danplanet.com\/blog\/2007\/11\/14\/sblim-and-their-broken-abi\/","og_site_name":"Right Angles","article_published_time":"2007-11-14T16:41:39+00:00","article_modified_time":"2011-11-29T16:52:50+00:00","author":"Dan","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Dan","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.danplanet.com\/blog\/2007\/11\/14\/sblim-and-their-broken-abi\/#article","isPartOf":{"@id":"https:\/\/www.danplanet.com\/blog\/2007\/11\/14\/sblim-and-their-broken-abi\/"},"author":{"name":"Dan","@id":"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/0f6920aa6d63cae437bf8b122200287c"},"headline":"SBLIM and their broken ABI","datePublished":"2007-11-14T16:41:39+00:00","dateModified":"2011-11-29T16:52:50+00:00","mainEntityOfPage":{"@id":"https:\/\/www.danplanet.com\/blog\/2007\/11\/14\/sblim-and-their-broken-abi\/"},"wordCount":524,"publisher":{"@id":"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/0f6920aa6d63cae437bf8b122200287c"},"keywords":["CIM","pegasus","sblim"],"articleSection":["Codemonkeying"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.danplanet.com\/blog\/2007\/11\/14\/sblim-and-their-broken-abi\/","url":"https:\/\/www.danplanet.com\/blog\/2007\/11\/14\/sblim-and-their-broken-abi\/","name":"SBLIM and their broken ABI - Right Angles","isPartOf":{"@id":"https:\/\/www.danplanet.com\/blog\/#website"},"datePublished":"2007-11-14T16:41:39+00:00","dateModified":"2011-11-29T16:52:50+00:00","breadcrumb":{"@id":"https:\/\/www.danplanet.com\/blog\/2007\/11\/14\/sblim-and-their-broken-abi\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.danplanet.com\/blog\/2007\/11\/14\/sblim-and-their-broken-abi\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.danplanet.com\/blog\/2007\/11\/14\/sblim-and-their-broken-abi\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.danplanet.com\/blog\/"},{"@type":"ListItem","position":2,"name":"SBLIM and their broken ABI"}]},{"@type":"WebSite","@id":"https:\/\/www.danplanet.com\/blog\/#website","url":"https:\/\/www.danplanet.com\/blog\/","name":"Right Angles","description":"If they&#039;re not right...they&#039;re wrong","publisher":{"@id":"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/0f6920aa6d63cae437bf8b122200287c"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.danplanet.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/0f6920aa6d63cae437bf8b122200287c","name":"Dan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/9b73782704be64dd8c030087af2d1ae0c1dc488cad69093ff0366dbaad2de673?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9b73782704be64dd8c030087af2d1ae0c1dc488cad69093ff0366dbaad2de673?s=96&d=mm&r=g","caption":"Dan"},"logo":{"@id":"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/image\/"},"url":"https:\/\/www.danplanet.com\/blog\/author\/dan\/"}]}},"_links":{"self":[{"href":"https:\/\/www.danplanet.com\/blog\/wp-json\/wp\/v2\/posts\/55","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.danplanet.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.danplanet.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.danplanet.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.danplanet.com\/blog\/wp-json\/wp\/v2\/comments?post=55"}],"version-history":[{"count":1,"href":"https:\/\/www.danplanet.com\/blog\/wp-json\/wp\/v2\/posts\/55\/revisions"}],"predecessor-version":[{"id":146,"href":"https:\/\/www.danplanet.com\/blog\/wp-json\/wp\/v2\/posts\/55\/revisions\/146"}],"wp:attachment":[{"href":"https:\/\/www.danplanet.com\/blog\/wp-json\/wp\/v2\/media?parent=55"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.danplanet.com\/blog\/wp-json\/wp\/v2\/categories?post=55"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.danplanet.com\/blog\/wp-json\/wp\/v2\/tags?post=55"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}