[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: mdev.conf setting example for running with linux kernel's IMA/EVM
From:       "Yi-Ting, Chao" <jackend () csie ! io>
Date:       2018-10-24 7:42:53
Message-ID: CAHZwqLRLpETVrKYBraneFN_fEJkxg_FcJKmkO3GPMb6qKbqESw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi,

    Update the mdev.conf's example patch with the following:
        1. add a link from /dev/$MDEV to /dev/block/$MAJOR:$MINOR before
create a device
        2. remove the /dev/block/$MAJOR:$MINOR link before remove a device

--- mdev.conf 2018-10-17 16:39:56.322969733 +0800
+++ mdev.conf.new 2018-10-19 10:19:16.570123044 +0800
@@ -15,6 +15,11 @@
 # =: move, >: move and create a symlink
 # !: do not create device node
 # @|$|*: run@cmd if $ACTION=add,  $cmd if $ACTION=remove, *cmd in all cases
+#
+# An example for creating a link for using linux kernel's IMA/EVM feature
+# Also, need to create a folder at "/dev/block" before executing `mdev -s`
+# [hs]d[a-z]* 0:6 660 @ln -sf /dev/$MDEV /dev/block/$(printf "%d:%d"
$(stat -c "0x%t 0x%T" /dev/$MDEV))
+# [hs]d[a-z]* 0:6 660 $rm -f /dev/block/$(printf "%d:%d" $(stat -c "0x%t
0x%T" /dev/$MDEV))


趙翊廷 <jackend@csie.io> 於 2018年10月19日 週五 下午1:23寫道:

> Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> 於 2018年10月18日 週四
> 下午4:54寫道:
>
>> On Thu, 18 Oct 2018 at 09:47, Bernhard Reutner-Fischer
>> <rep.dot.nop@gmail.com> wrote:
>> >
>> > On Wed, 17 Oct 2018 at 11:02, 趙翊廷 <jackend@csie.io> wrote:
>> >
>> > > 2. in /etc/mdev.confg we need to add a symbol link something like
>> /dev/block/3:0
>> > >     hd[a-z]* 0:6 660 *ln -sf /dev/$MDEV /dev/block/$(ls -l
>> /dev/$MDEV|awk '{print $5}'|tr -d ','):$(ls -l /dev/$MDEV|awk '{print $6}')
>> > >     sd[a-z]* 0:6 660 *ln -sf /dev/$MDEV /dev/block/$(ls -l
>> /dev/$MDEV|awk '{print $5}'|tr -d ','):$(ls -l /dev/$MDEV|awk '{print $6}')
>>
>> Furthermore, didn't we have a shorthand for symlinks -- aliaslink --
>> like (from memory) one of:
>> * ->symlinktarget
>> * > symlinktarget
>
>
> Indeed, using ">path" or "=path" is the preferred solution.
> But the kernel simply will not embed the MAJOR/MINOR number in the device
> node name, so we use external command instead.
>
>
>
>>
>>
> or the like?
>> Also, the '*' (IIRC) symlinks also on removal if you do not use the
>> built-in symlink support, so i'd expect you want more like (again
>> IIRC) '@', i.e. create.
>>
>
> Since ">" "=" are unavailable, we need two rules to handle After device
> create and Before device removed events.
>
> # create a MAJ:MIN link when device is created
> [hs]d[a-z]*    0:6 660 @ln -sf /dev/$MDEV /dev/block/$(printf "%d:%d"
> $(stat -c "0x%t 0x%T" /dev/$MDEV))
> # unlink when device is removed
> [hs]d[a-z]*    0:6 660 $rm -f /dev/block/$(printf "%d:%d" $(stat -c "0x%t
> 0x%T" /dev/$MDEV))
>
>
>
>> Maybe even simpler might be to create the disks as
>> /dev/block/MAJOR:MINOR and symlink back to /dev/DEVNAME, i.e. the
>> other way round.
>>
>> HTH,
>
>

[Attachment #5 (text/html)]

<div dir="ltr"><div dir="ltr">Hi,<div><br></div><div>      Update the mdev.conf&#39;s \
example patch with the following:</div><div>            1. add a link from /dev/$MDEV \
to /dev/block/$MAJOR:$MINOR before create a device</div><div>            2. remove \
the /dev/block/$MAJOR:$MINOR link before remove a device<br><br><div>--- \
mdev.conf<span style="white-space:pre">	</span>2018-10-17 16:39:56.322969733 \
+0800</div><div>+++ mdev.conf.new<span style="white-space:pre">	</span>2018-10-19 \
10:19:16.570123044 +0800</div><div>@@ -15,6 +15,11 @@</div><div>  # =: move, &gt;: \
move and create a symlink</div><div>  # !: do not create device node</div><div>  # \
@|$|*: run@cmd if $ACTION=add,   $cmd if $ACTION=remove, *cmd in all \
cases</div><div>+#</div><div>+# An example for creating a link for using linux \
kernel&#39;s IMA/EVM feature</div><div>+# Also, need to create a folder at \
&quot;/dev/block&quot; before executing `mdev -s`</div><div>+# [hs]d[a-z]*<span \
style="white-space:pre">	</span>0:6 660 @ln -sf /dev/$MDEV /dev/block/$(printf \
&quot;%d:%d&quot; $(stat -c &quot;0x%t 0x%T&quot; /dev/$MDEV))</div><div>+# \
[hs]d[a-z]*<span style="white-space:pre">	</span>0:6 660 $rm -f /dev/block/$(printf \
&quot;%d:%d&quot; $(stat -c &quot;0x%t 0x%T&quot; \
/dev/$MDEV))</div><div><br></div><br><div class="gmail_quote"><div \
dir="ltr">趙翊廷 &lt;<a href="mailto:jackend@csie.io">jackend@csie.io</a>&gt; 於 \
2018年10月19日 週五 下午1:23寫道:<br></div><blockquote class="gmail_quote" \
style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div \
dir="ltr"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">Bernhard \
Reutner-Fischer &lt;<a href="mailto:rep.dot.nop@gmail.com" \
target="_blank">rep.dot.nop@gmail.com</a>&gt; 於 2018年10月18日 週四 \
下午4:54寫道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px \
0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Thu, 18 Oct \
2018 at 09:47, Bernhard Reutner-Fischer<br> &lt;<a \
href="mailto:rep.dot.nop@gmail.com" target="_blank">rep.dot.nop@gmail.com</a>&gt; \
wrote:<br> &gt;<br>
&gt; On Wed, 17 Oct 2018 at 11:02, 趙翊廷 &lt;<a href="mailto:jackend@csie.io" \
target="_blank">jackend@csie.io</a>&gt; wrote:<br> &gt;<br>
&gt; &gt; 2. in /etc/mdev.confg we need to add a symbol link something like \
/dev/block/3:0<br> &gt; &gt;        hd[a-z]* 0:6 660 *ln -sf /dev/$MDEV \
/dev/block/$(ls -l /dev/$MDEV|awk &#39;{print $5}&#39;|tr -d &#39;,&#39;):$(ls -l \
/dev/$MDEV|awk &#39;{print $6}&#39;)<br> &gt; &gt;        sd[a-z]* 0:6 660 *ln -sf \
/dev/$MDEV /dev/block/$(ls -l /dev/$MDEV|awk &#39;{print $5}&#39;|tr -d \
&#39;,&#39;):$(ls -l /dev/$MDEV|awk &#39;{print $6}&#39;)<br> <br>
Furthermore, didn&#39;t we have a shorthand for symlinks -- aliaslink --<br>
like (from memory) one of:<br>
* -&gt;symlinktarget<br>
* &gt; symlinktarget</blockquote><div><div><br></div><div><div>Indeed, using \
&quot;&gt;path&quot; or &quot;=path&quot; is the preferred solution.</div><div>But \
the kernel simply will not embed the MAJOR/MINOR number in the device node name, so \
we use external command instead.</div></div></div><div><br></div><div>  \
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px \
solid rgb(204,204,204);padding-left:1ex">  <br></blockquote><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"> or the like?<br>
Also, the &#39;*&#39; (IIRC) symlinks also on removal if you do not use the<br>
built-in symlink support, so i&#39;d expect you want more like (again<br>
IIRC) &#39;@&#39;, i.e. create.<br></blockquote><div><br></div><div><div>Since \
&quot;&gt;&quot; &quot;=&quot; are unavailable, we need two rules to handle After \
device create and Before device removed events.</div><div><br></div><div># create a \
MAJ:MIN link when device is created</div><div>[hs]d[a-z]*      0:6 660 @ln -sf \
/dev/$MDEV /dev/block/$(printf &quot;%d:%d&quot; $(stat -c &quot;0x%t 0x%T&quot; \
/dev/$MDEV))</div><div># unlink when device is removed</div><div>[hs]d[a-z]*      0:6 \
660 $rm -f /dev/block/$(printf &quot;%d:%d&quot; $(stat -c &quot;0x%t 0x%T&quot; \
/dev/$MDEV))</div></div><div><br></div><div>  </div><blockquote class="gmail_quote" \
style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"> Maybe even simpler might be to create the disks \
                as<br>
/dev/block/MAJOR:MINOR and symlink back to /dev/DEVNAME, i.e. the<br>
other way round.<br>
<br>
HTH,</blockquote></div></div></div></div></div></div>
</blockquote></div></div></div></div>


["mdev.conf.patch" (text/x-patch)]

--- mdev.conf	2018-10-17 16:39:56.322969733 +0800
+++ mdev.conf.new	2018-10-19 10:19:16.570123044 +0800
@@ -15,6 +15,11 @@
 # =: move, >: move and create a symlink
 # !: do not create device node
 # @|$|*: run@cmd if $ACTION=add,  $cmd if $ACTION=remove, *cmd in all cases
+#
+# An example for creating a link for using linux kernel's IMA/EVM feature
+# Also, need to create a folder at "/dev/block" before executing `mdev -s`
+# [hs]d[a-z]*	0:6 660 @ln -sf /dev/$MDEV /dev/block/$(printf "%d:%d" $(stat -c "0x%t 0x%T" /dev/$MDEV))
+# [hs]d[a-z]*	0:6 660 $rm -f /dev/block/$(printf "%d:%d" $(stat -c "0x%t 0x%T" /dev/$MDEV))
 
 null		0:0 666
 zero		0:0 666


_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic