Bug 1266572 - restraint client segmentation fault in copy_job_as_template
restraint client segmentation fault in copy_job_as_template
Status: CLOSED NEXTRELEASE
Product: Restraint
Classification: Community
Component: general (Show other bugs)
0.1.21
aarch64 Linux
medium Severity high
: 0.1.23
: ---
Assigned To: Artem Savkov
tools-bugs
: Patch
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-09-25 12:51 EDT by Jeff Bastian
Modified: 2016-04-20 20:05 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-01-22 09:37:02 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jeff Bastian 2015-09-25 12:51:54 EDT
Description of problem:
The restraint client crashes with a segfault when I try to run a standalone job.

[root@centipede keyutils]# restraint --host=1=localhost --job=/root/keyutils/key
utils-testsuite.xml
No result
Using ./keyutils-testsuite.02 for job run
Segmentation fault (core dumped)

A backtrace from the core file:

(gdb) bt
#0  0x000000000040a670 in copy_job_as_template (
    job=0x11b79820 "/root/keyutils/keyutils-testsuite.xml", 
    app_data=0x11b6ad20) at client.c:1055
#1  0x000000000040b44c in main (argc=1, argv=0x3fff1412588) at client.c:1449


Version-Release number of selected component (if applicable):
restraint-0.1.21-3.aa7a.aarch64

How reproducible:
always

Steps to Reproduce:
1. restraint --host=1=localhost --job=job.xml

Actual results:
segfault

Expected results:
job runs

Additional info:
Comment 1 Bill Peck 2015-09-25 12:56:07 EDT
please provide the xml used as well.

thanks
Comment 2 Jeff Bastian 2015-09-25 12:59:04 EDT
recipe_nodes in client.c:1055 is a null pointer:

Program terminated with signal 11, Segmentation fault.
#0  0x000000000040a670 in copy_job_as_template (
    job=0x11b79820 "/root/keyutils/keyutils-testsuite.xml", 
    app_data=0x11b6ad20) at client.c:1055
1055        for (guint i = 0; i < recipe_nodes->nodesetval->nodeNr; i++) {
Missing separate debuginfos, use: debuginfo-install glibc-2.17-105.el7.aarch64
(gdb) print i
$1 = 0
(gdb) print recipe_nodes
$2 = (xmlXPathObjectPtr) 0x0
(gdb) print recipe_nodes->nodesetval
Cannot access memory at address 0x8



The job xml is simple enough:

<job>
  <recipe>
    <recipeSet>
      <task name="/kernel/keyutils/testsuite">
        <fetch url="git://example.com/keyutils-tests.git?master#testsuite"/>
      </task>
    </recipeSet>
  </recipe>
</job>
Comment 3 Jeff Bastian 2015-09-25 13:01:44 EDT
(In reply to Jeff Bastian from comment #2)
> The job xml is simple enough:
> 
> <job>
>   <recipe>
>     <recipeSet>

D'oh!  That's my mistake: I had recipe and recipeSet inverted...  It works fine once I fixed it.
Comment 4 Bill Peck 2015-09-25 13:02:43 EDT
still shouldn't segfault.  leave this open and I'll fix it.

Thanks Jeff
Comment 5 Jeff Bastian 2015-09-25 13:06:22 EDT
If it helps, I found my problem with xmllint:

$ xmllint --noout \
   --relaxng /usr/lib/python2.7/site-packages/bkr/common/schema/beaker-job.rng \
   keyutils-testsuite.xml
keyutils-testsuite.xml:1: element job: Relax-NG validity error : Expecting an element recipeSet, got nothing
keyutils-testsuite.xml:2: element recipe: Relax-NG validity error : Invalid sequence in interleave
keyutils-testsuite.xml:2: element recipe: Relax-NG validity error : Element job failed to validate content
keyutils-testsuite.xml fails to validate
Comment 6 Artem Savkov 2016-01-18 07:35:08 EST
https://gerrit.beaker-project.org/#/c/4595/
Comment 7 Artem Savkov 2016-01-22 09:37:02 EST
Merged, there is also this change https://gerrit.beaker-project.org/#/c/4607/2 that adds job xml validation to restraint.

Note You need to log in before you can comment on or make changes to this bug.