Skip to contentSkip to conversation

Assertion `new_role != ((void *)0) && new_role->flavor == 1' when installing modules

DISCUSSION Laurent Bigonville 4 participants 12 messages Sep 9, 2012 – Sep 11, 2012 SELinux security module

lore
Share & tools
lore
#0 lore raw

Hi,

When compiling the GIT HEAD of the refpolicy and then trying to install the base module with the required dependencies (semodule -b base.pp -i ...) , I get the following assertion:

Assertion `new_role != ((void *)0) && new_role->flavor == 1'

I've found a previous discussion[0] on the mailing list from some months ago but unfortunately without any solution.

Does anybody have an idea?

Cheers

Laurent Bigonville

[0] http://www.spinics.net/lists/selinux/msg11809.html

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#1 lore raw
Quoted 11 lines · Laurent Bigonville

Hi,

When compiling the GIT HEAD of the refpolicy and then trying to install the base module with the required dependencies (semodule -b base.pp -i ...) , I get the following assertion:

Assertion `new_role != ((void *)0) && new_role->flavor == 1'

I've found a previous discussion[0] on the mailing list from some months ago but unfortunately without any solution.

Quoted 7 lines

Does anybody have an idea?

Cheers

Laurent Bigonville

[0] http://www.spinics.net/lists/selinux/msg11809.html

Does this patch fix it?

Signature · 2 lines
Stephen Smalley
National Security Agency
#2 lore raw
Quoted 1 line · Stephen Smalley

Does this patch fix it?

It's now unfortunately crashing with the following trace :(

#0  __strlen_sse42 () at ../sysdeps/x86_64/multiarch/strlen-sse4.S:32
#1  0x00007f30554c20b1 in ustr_replace_cstr (s1=0x7fff6721a668, oc=0x7f3055ea4ef9 "s0", nc=0x0, lim=0) at ustr-replace.h:58
#2  0x00007f3055e8d398 in replace_all (str=0x7f3057796860 "HOME_DIR/.+\tsystem_u:object_r:user_home_t", repl=0x7fff6721a6c0) at genhomedircon.c:513
#3  0x00007f3055e8d644 in write_home_dir_context (s=0x7fff6721a7d0, out=0x7f305779d9a0, tpl=0x7f305779c260, user=0x7f3057081660 "user_u", seuser=0x7f3057081660 "user_u", home=0x7f3057791ef3 "/home/[^/]*", role_prefix=0x7f3057081640 "user", level=0x0) at genhomedircon.c:580
#4  0x00007f3055e8e6d2 in write_context_file (s=0x7fff6721a7d0, out=0x7f305779d9a0) at genhomedircon.c:1012
#5  0x00007f3055e8e977 in semanage_genhomedircon (sh=0x7f30570015b0, policydb=0x7f30576fcbd0, usepasswd=1, ignoredirs=0x0) at genhomedircon.c:1090
#6  0x00007f3055e8993e in semanage_direct_commit (sh=0x7f30570015b0) at direct_api.c:994
#7  0x00007f3055e8f7bc in semanage_commit (sh=0x7f30570015b0) at handle.c:435
#8  0x00007f305674c921 in main (argc=21, argv=0x7fff6721aac8) at semodule.c:479

I get this with the userspace version of Debian sid (and libsepol patched) and the following command:

semodule -v -b base.pp -s refpolicy -n -i init.pp libraries.pp logging.pp selinuxutil.pp modutils.pp storage.pp userdomain.pp miscfiles.pp sysadm.pp authlogin.pp sysnetwork.pp application.pp locallogin.pp

Cheers

Laurent Bigonville

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#3 lore raw
Quoted 17 lines · Laurent Bigonville
Quoted 1 line · Stephen Smalley

Does this patch fix it?

It's now unfortunately crashing with the following trace :(

#0  __strlen_sse42 () at ../sysdeps/x86_64/multiarch/strlen-sse4.S:32
#1  0x00007f30554c20b1 in ustr_replace_cstr (s1=0x7fff6721a668, oc=0x7f3055ea4ef9 "s0", nc=0x0, lim=0) at ustr-replace.h:58
#2  0x00007f3055e8d398 in replace_all (str=0x7f3057796860 "HOME_DIR/.+\tsystem_u:object_r:user_home_t", repl=0x7fff6721a6c0) at genhomedircon.c:513
#3  0x00007f3055e8d644 in write_home_dir_context (s=0x7fff6721a7d0, out=0x7f305779d9a0, tpl=0x7f305779c260, user=0x7f3057081660 "user_u", seuser=0x7f3057081660 "user_u", home=0x7f3057791ef3 "/home/[^/]*", role_prefix=0x7f3057081640 "user", level=0x0) at genhomedircon.c:580
#4  0x00007f3055e8e6d2 in write_context_file (s=0x7fff6721a7d0, out=0x7f305779d9a0) at genhomedircon.c:1012
#5  0x00007f3055e8e977 in semanage_genhomedircon (sh=0x7f30570015b0, policydb=0x7f30576fcbd0, usepasswd=1, ignoredirs=0x0) at genhomedircon.c:1090
#6  0x00007f3055e8993e in semanage_direct_commit (sh=0x7f30570015b0) at direct_api.c:994
#7  0x00007f3055e8f7bc in semanage_commit (sh=0x7f30570015b0) at handle.c:435
#8  0x00007f305674c921 in main (argc=21, argv=0x7fff6721aac8) at semodule.c:479
Quoted 7 lines

I get this with the userspace version of Debian sid (and libsepol patched) and the following command:

semodule -v -b base.pp -s refpolicy -n -i init.pp libraries.pp logging.pp selinuxutil.pp modutils.pp storage.pp userdomain.pp miscfiles.pp sysadm.pp authlogin.pp sysnetwork.pp application.pp locallogin.pp

You are building the policy without MLS/MCS, right?

Educated guess: It's the same here:

    http://marc.info/?l=selinux&m=133003003018371

Patch would be (helped on Ubuntu):

    http://marc.info/?l=selinux&m=132433039902439&w=2

Ole

#4 lore raw
Quoted 2 lines · Ole Kliemann

You are building the policy without MLS/MCS, right?

Yes, TYPE = standard in the build.conf

Quoted 8 lines

Educated guess: It's the same here:

    http://marc.info/?l=selinux&m=133003003018371

Patch would be (helped on Ubuntu):

    http://marc.info/?l=selinux&m=132433039902439&w=2

Actually this patch is already included in the version of libsemanage I'm using.

The patch here: http://marc.info/?l=selinux&m=132636024218187&w=2 fixed the segfault when loading the policy with Stephen patch.

BUT, it seems that the initial assertion is not completely fixed.

I'm still getting:

checkmodule: expand.c:700: role_fix_callback: Assertion `new_role != ((void *)0) && new_role->flavor == 1' failed.

When compiling the policy the following way:

1) Take the refpolicy git HEAD
2) make conf
3) edit policy/modules.conf and set the following module as part of the
base: init libraries logging selinuxutil modutils storage userdomain miscfiles sysadm authlogin sysnetwork application locallogin
4) make policy
5) -> assetion

Cheers

Laurent Bigonville

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#5 lore raw
Quoted 31 lines · Laurent Bigonville
Quoted 2 lines · Ole Kliemann

You are building the policy without MLS/MCS, right?

Yes, TYPE = standard in the build.conf

Quoted 8 lines

Educated guess: It's the same here:

     http://marc.info/?l=selinux&m=133003003018371

Patch would be (helped on Ubuntu):

     http://marc.info/?l=selinux&m=132433039902439&w=2

Actually this patch is already included in the version of libsemanage I'm using.

The patch here: http://marc.info/?l=selinux&m=132636024218187&w=2 fixed the segfault when loading the policy with Stephen patch.

BUT, it seems that the initial assertion is not completely fixed.

I'm still getting:

checkmodule: expand.c:700: role_fix_callback: Assertion `new_role != ((void *)0) && new_role->flavor == 1' failed.

When compiling the policy the following way:

Quoted 7 lines

1) Take the refpolicy git HEAD
2) make conf
3) edit policy/modules.conf and set the following module as part of the
base: init libraries logging selinuxutil modutils storage userdomain miscfiles sysadm authlogin sysnetwork application locallogin
4) make policy
5) -> assetion

I had reported something very similar a few months ago, here:

http://marc.info/?l=selinux&m=134030286215671&w=2

as far as I remember, it was due to userspace libraries changes introduced back in March but I had no time to look at it any closer...

Guido

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#6 lore raw
In reply to Laurent Bigonville
Quoted 15 lines · Laurent Bigonville
Quoted 2 lines · Ole Kliemann

You are building the policy without MLS/MCS, right?

Yes, TYPE = standard in the build.conf

Quoted 7 lines

Educated guess: It's the same here:

    http://marc.info/?l=selinux&m=133003003018371

Patch would be (helped on Ubuntu):

Quoted 7 lines
Quoted 1 line
    http://marc.info/?l=selinux&m=132433039902439&w=2

Actually this patch is already included in the version of libsemanage I'm using.

The patch here: http://marc.info/?l=selinux&m=132636024218187&w=2 fixed the segfault when loading the policy with Stephen patch.

Okay, guess I used that one too then, can't remember. Didn't persue this any further when I moved away from refpol (and don't use any genhomedircon stuff).

Quoted 20 lines

BUT, it seems that the initial assertion is not completely fixed.

I'm still getting:

checkmodule: expand.c:700: role_fix_callback: Assertion `new_role != ((void *)0) && new_role->flavor == 1' failed.

When compiling the policy the following way:

1) Take the refpolicy git HEAD
2) make conf
3) edit policy/modules.conf and set the following module as part of the
base: init libraries logging selinuxutil modutils storage userdomain miscfiles sysadm authlogin sysnetwork application locallogin
4) make policy
5) -> assetion

Cheers

Laurent Bigonville

#7 lore raw
In reply to Laurent Bigonville
Quoted 20 lines · Laurent Bigonville
Quoted 2 lines · Ole Kliemann

You are building the policy without MLS/MCS, right?

Yes, TYPE = standard in the build.conf

Quoted 8 lines

Educated guess: It's the same here:

     http://marc.info/?l=selinux&m=133003003018371

Patch would be (helped on Ubuntu):

     http://marc.info/?l=selinux&m=132433039902439&w=2

Actually this patch is already included in the version of libsemanage I'm using.

Quoted 8 lines

The patch here: http://marc.info/?l=selinux&m=132636024218187&w=2 fixed the segfault when loading the policy with Stephen patch.

BUT, it seems that the initial assertion is not completely fixed.

I'm still getting:

checkmodule: expand.c:700: role_fix_callback: Assertion `new_role != ((void *)0) && new_role->flavor == 1' failed.

Are you using a recent version of the Reference Policy ?

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#8 lore raw
Quoted 10 lines · Guido Trentalancia
Quoted 7 lines · Laurent Bigonville

BUT, it seems that the initial assertion is not completely fixed.

I'm still getting:

checkmodule: expand.c:700: role_fix_callback: Assertion `new_role != ((void *)0) && new_role->flavor == 1' failed.

Are you using a recent version of the Reference Policy ?

I'm trying to compile the HEAD of the master branch of the git repository.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#9 lore raw
Quoted 9 lines · Laurent Bigonville
Quoted 6 lines · Guido Trentalancia
Quoted 5 lines · Laurent Bigonville

BUT, it seems that the initial assertion is not completely fixed.

I'm still getting:

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

checkmodule: expand.c:700: role_fix_callback: Assertion `new_role != ((void *)0) && new_role->flavor == 1' failed.

Are you using a recent version of the Reference Policy ?

I'm trying to compile the HEAD of the master branch of the git repository.

Yes, it is always a good idea to compile against latest development snapshot for problems with development snapshots of other interdepending projects...

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#10 lore raw
In reply to Laurent Bigonville
Quoted 4 lines · Laurent Bigonville

The patch here: http://marc.info/?l=selinux&m=132636024218187&w=2
fixed the segfault when loading the policy with Stephen patch.

BUT, it seems that the initial assertion is not completely fixed.

OK, I was wrong. I didn't saw that checkpolicy was statically linked against libsepol. So, Stephen's patch in conjunction with the patch above are actually fixing my issues with both semodule and checkpolicy.

Cheers

Laurent Bigonville

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#11 lore raw
Quoted 4 lines · Laurent Bigonville

Le Tue, 11 Sep 2012 12:19:03 +0200,
Laurent Bigonville <[email protected]> a écrit :

Quoted 8 lines
Quoted 4 lines

The patch here: http://marc.info/?l=selinux&m=132636024218187&w=2
fixed the segfault when loading the policy with Stephen patch.

BUT, it seems that the initial assertion is not completely fixed.

OK, I was wrong. I didn't saw that checkpolicy was statically linked against libsepol. So, Stephen's patch in conjunction with the patch above are actually fixing my issues with both semodule and checkpolicy.

It's a problem with changes in libsepol/src/expand.c, it can happen independently of MLS/MCS or standard policy.

It seems to me that latest changes were:

commit dbc9a61819ea9a6b61bb29a2765b319ac974a775 (Aug 2 2011 18:03:53)

But I do not know much about it, as I had no time to look at it any closer.

Syncing with Reference Policy might help.

Hopefully there will be a human readable error in release instead of assertion...

Guido

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.