2009/8/24 Daniel Lezcano <span dir="ltr"><<a href="mailto:daniel.lezcano@free.fr">daniel.lezcano@free.fr</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5">Krzysztof Taraszka wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
2009/8/24 Daniel Lezcano <<a href="mailto:dlezcano@fr.ibm.com" target="_blank">dlezcano@fr.ibm.com</a>><br>
<br>
  <br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Krzysztof Taraszka wrote:<br>
<br>
    <br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
2009/8/24 Daniel Lezcano <<a href="mailto:daniel.lezcano@free.fr" target="_blank">daniel.lezcano@free.fr</a>><br>
<br>
 Krzysztof Taraszka wrote:<br>
      <br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
 2009/8/23 Daniel Lezcano <<a href="mailto:daniel.lezcano@free.fr" target="_blank">daniel.lezcano@free.fr</a>><br>
        <br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
(...)<br>
<br>
<br>
<br>
<br>
 With the lxc tools I did:<br>
          <br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
     lxc-execute -n foo /bin/bash<br>
     echo 268435456 > /cgroup/foo/memory.limit_in_bytes<br>
     mount --bind /cgroup/foo/memory.meminfo /proc/meminfo<br>
     for i in $(seq 1 100); do sleep 3600 & done<br>
<br>
<br>
<br>
            <br>
</blockquote>
(...)<br>
<br>
<br>
<br>
<br>
 :)<br>
          <br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
 hmmm... I think that access to the cgroup inside container is very<br>
            <br>
</blockquote>
risk<br>
because I am able to manage for example memory resources (what if I am<br>
not<br>
the host owner and... I can give me via non-secure mounted /cgroup<br>
(inside<br>
container) all available memory resources...).<br>
I think that the /proc/meminfo should be pass to the container in the<br>
other<br>
way, but this is the topic for the other thread.<br>
<br>
<br>
 It is not a problem, I did it in this way because it's easy to test but<br>
          <br>
</blockquote>
in<br>
a real use case, the memory limit is setup by the lxc configuration file<br>
and<br>
the cgroup directory will be no longer accessible from the container.<br>
<br>
<br>
        <br>
</blockquote>
So.. how there will be another method (more secure) for giving<br>
/proc/meminfo<br>
with limits to the container, right?<br>
<br>
      <br>
</blockquote>
Same method. The lxc tools can be configured with a fstab to mount more<br>
mount points, furthermore if memory.meminfo is available I will add the code<br>
to mount it automatically to /proc/meminfo in the lxc tools.<br>
<br>
    <br>
</blockquote>
<br>
<br>
Hmm... setup_fs() from lxc_init.c or another way?<br>
  <br>
</blockquote></div></div>
No, I was thinking in the setup_cgroup() function in conf.c.<br>
<br>
Something like:<br>
<br>
...<br>
<br>
if (!access("/var/lib/lxc/mycontainer/nsgroup/memory.meminfo"), F_OK) {<br>
   mount("/var/lib/lxc/mycontainer/nsgroup/memory.meminfo", "/proc/meminfo", MS_BIND, ...);<br>
}<br>
<br>
...<br>
<br>
<br>
but a bit more clean :)<br>
</blockquote></div><br>Oh, ok. I didn't read conf.c jet :) thanks for the tip. I will play with it today or... you can be faster than me and do it before that I do (like you did with the memory.meminfo kernel patch ;)), because you know how does it look like more than me... <br>
<br>-- <br>Krzysztof Taraszka<br>