<div dir="ltr"><div><div>Ok, re-built activating with SELinux and it is not working either. My problem seems indeed to be my build process rather than anything relating to my code :(. However, it does not get me closer of understanding what I am doing wrong. Here is the security config for the build with SELinux on:<br><br>#<br># Security options<br>#<br>CONFIG_KEYS=y<br>CONFIG_PERSISTENT_KEYRINGS=y<br>CONFIG_BIG_KEYS=y<br># CONFIG_ENCRYPTED_KEYS is not set<br>CONFIG_KEYS_DEBUG_PROC_KEYS=y<br># CONFIG_SECURITY_DMESG_RESTRICT is not set<br>CONFIG_SECURITY=y<br>CONFIG_SECURITYFS=y<br>CONFIG_SECURITY_NETWORK=y<br>CONFIG_SECURITY_NETWORK_XFRM=y<br>CONFIG_SECURITY_PATH=y<br>CONFIG_INTEL_TXT=y<br>CONFIG_LSM_MMAP_MIN_ADDR=65536<br>CONFIG_SECURITY_SELINUX=y<br>CONFIG_SECURITY_SELINUX_BOOTPARAM=y<br>CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=1<br>CONFIG_SECURITY_SELINUX_DISABLE=y<br>CONFIG_SECURITY_SELINUX_DEVELOP=y<br>CONFIG_SECURITY_SELINUX_AVC_STATS=y<br>CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE=1<br>CONFIG_SECURITY_SELINUX_POLICYDB_VERSION_MAX=y<br>CONFIG_SECURITY_SELINUX_POLICYDB_VERSION_MAX_VALUE=19<br># CONFIG_SECURITY_SMACK is not set<br># CONFIG_SECURITY_TOMOYO is not set<br># CONFIG_SECURITY_APPARMOR is not set<br># CONFIG_SECURITY_YAMA is not set<br># CONFIG_SECURITY_HELLOWORLD is not set<br># CONFIG_IMA is not set<br># CONFIG_EVM is not set<br>CONFIG_DEFAULT_SECURITY_SELINUX=y<br># CONFIG_DEFAULT_SECURITY_DAC is not set<br>CONFIG_DEFAULT_SECURITY=&quot;selinux&quot;<br>CONFIG_CRYPTO=y<br><br></div>Thanks a lot Dave for pointing in the right direction.<br><br></div>Thomas<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 19 January 2015 at 00:29, Thomas F. J.-M. Pasquier <span dir="ltr">&lt;<a href="mailto:tfjmp2@cam.ac.uk" target="_blank">tfjmp2@cam.ac.uk</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div></div>Here is the security part of the .config:<br><br>#<br># Security options<br>#<br>CONFIG_KEYS=y<br>CONFIG_PERSISTENT_KEYRINGS=y<br>CONFIG_BIG_KEYS=y<br># CONFIG_ENCRYPTED_KEYS is not set<br>CONFIG_KEYS_DEBUG_PROC_KEYS=y<br># CONFIG_SECURITY_DMESG_RESTRICT is not set<br>CONFIG_SECURITY=y<br>CONFIG_SECURITYFS=y<br>CONFIG_SECURITY_NETWORK=y<br>CONFIG_SECURITY_NETWORK_XFRM=y<br>CONFIG_SECURITY_PATH=y<br>CONFIG_INTEL_TXT=y<br># CONFIG_SECURITY_SELINUX is not set<br># CONFIG_SECURITY_SMACK is not set<br># CONFIG_SECURITY_TOMOYO is not set<br># CONFIG_SECURITY_APPARMOR is not set<br># CONFIG_SECURITY_YAMA is not set<br>CONFIG_SECURITY_HELLOWORLD=y<br># CONFIG_IMA is not set<br># CONFIG_EVM is not set<br>CONFIG_DEFAULT_SECURITY_HELLOWORLD=y<br># CONFIG_DEFAULT_SECURITY_DAC is not set<br>CONFIG_DEFAULT_SECURITY=&quot;helloworld&quot;<br>CONFIG_CRYPTO=y<br><br><br></div><div>SELinux is not loading before my module. SELinux was working on the kernel that came with the distribution, did not try to build my kernel with it on. I will try to do so.<br></div><div><br></div>Thank you very much,<br></div>Thomas<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On 19 January 2015 at 00:20, Dave Tian <span dir="ltr">&lt;<a href="mailto:dave.jing.tian@gmail.com" target="_blank">dave.jing.tian@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div>Did SELinux get loaded before your changes (Fedora uses SELinux by default)? Would you please post your security config? I still suspect that there was sth messed up in the config.</div><div><br></div><div>Thanks,</div><div>Dave</div><br>

</div><div><div>
<br><div><blockquote type="cite"><div>On Jan 18, 2015, at 7:09 PM, Thomas F. J.-M. Pasquier &lt;<a href="mailto:tfjmp2@cam.ac.uk" target="_blank">tfjmp2@cam.ac.uk</a>&gt; wrote:</div><br><div>No, other LSM. Checked in the config file. The only one selected is mine and it is set &quot;Default Security Module&quot; when using menuconfig.<br><br><div class="gmail_quote">On Mon Jan 19 2015 at 12:07:33 AM Tian Dave &lt;<a href="mailto:dave.jing.tian@gmail.com" target="_blank">dave.jing.tian@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Then which LSM was triggered? SELinux? You probably need to disable other LSM before making your LSM work.<div><br></div><div>Thanks,</div><div>Dave</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-01-18 18:49 GMT-05:00 Thomas F. J.-M. Pasquier <span dir="ltr">&lt;<a href="mailto:tfjmp2@cam.ac.uk" target="_blank">tfjmp2@cam.ac.uk</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"></blockquote></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi everyone,<div><br></div><div>Kernel version 3.17.8<br><div><br></div><div>I am trying to build a skeleton LSM module, but I am not having much luck so far. The problem seems to be that the LSM init function is never called.</div><div><br></div><div>I am selecting my helloworld LSM when building the kernel and it is set as default (checked and re-checked in menuconfig + in the file).</div><div><br></div><div>The build is going fine (my module is built as I would expect). The rest of the building procedure goes fine. I reboot, the new image works just fine except my LSM is not in (nor any other, it seems, for that matter).</div><div><br></div><div>Here is the init function:</div><div><div>static __init int hw_init(void){</div><div><span style="white-space:pre-wrap">        </span>/* avoid security registration races */</div><div><span style="white-space:pre-wrap">        </span>if (!security_module_enable(&amp;hw_<u></u>ops)){</div><div><span style="white-space:pre-wrap">                </span>printk(KERN_INFO &quot;hw:  Disabled at boot.\n&quot;);</div><div><span style="white-space:pre-wrap">                </span>return 0;</div><div><span style="white-space:pre-wrap">        </span>}</div><div><br></div><div><span style="white-space:pre-wrap">        </span>printk(KERN_INFO &quot;hw:  Initializing.\n&quot;);</div><div><br></div><div><span style="white-space:pre-wrap">        </span>if (register_security(&amp;hw_ops))</div><div><span style="white-space:pre-wrap">                </span>panic(&quot;hw: Unable to register with kernel.\n&quot;);</div><div><span style="white-space:pre-wrap">        </span>else</div><div><span style="white-space:pre-wrap">                </span>printk(KERN_INFO &quot;hw: registered with the kernel.\n&quot;);</div><div><br></div><div><span style="white-space:pre-wrap">        </span>return 0;</div><div>}</div><div><br></div><div>security_initcall(hw_init);</div></div><div><br></div><div>I looked at how it was done in SELinux and the other security module and I don&#39;t seem to be doing things differently or incorrectly. I checked the log level just in case and that&#39;s not the issue either.</div><div><br></div><div>I am tempted to say the problem come from my building procedure/configuration, rather than the module/code in itself (the dist on top of the kernel is fedora21). I have been at it for a while now and any help would be most welcomed.</div><div><br></div><div>Thank you in advance.</div><div><br></div><div>Regards,</div><div>Thomas</div><div><br></div><div><br></div></div>
<br></blockquote></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">______________________________<u></u>_________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.<u></u>org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.<u></u>org/mailman/listinfo/<u></u>kernelnewbies</a><br>
<br></blockquote></div><br></div>
</blockquote></div>
</div></blockquote></div><br></div></div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>