Skip to contentSkip to conversation

liblxc and cgroups

DISCUSSION Serge E. Hallyn 3 participants 4 messages Nov 8, 2008 – Nov 20, 2008 3 messages not in the archive

lore
Share & tools
lore
#0 lore raw

Hi Daniel,

I'm playing with liblxc containers and the device whitelist cgroup. One thing which makes the devices cgroup unique from the others is that there can be many entries to the devices.allow (and in theory also to devices.deny) file. liblxc doesn't support that right now. This needs to be fixed in two places.

First, lxc_conf.c:write_info needs to write multiple entries from the .conf file into the cgroups/devices.allow file. I just changed the creat(f, 0755) to open(f, O_CREAT|O_WRONLY|O_APPEND, 0755) which seemed to work for me, but I'm not sure if that might adversely affect other code which counted on the truncation implicit in creat()?

Secondly, the lxc_cgroup_copy needs to do a loop and write the entries one by one into the cgroup file. I'm just doing a dumb unsafe fgets loop, but I actually don't have that working yet, (which is why I'm not sending a patch - I figure you can whip something robust up in 2 seconds)

thanks,
-serge

A message that is not in the archive (sent off-list or not yet received): 20081108235107.GA15761-r/[email protected]

#2 lore raw
Quoted 17 lines · Serge E. Hallyn

Hi Daniel,

I'm playing with liblxc containers and the device whitelist cgroup. One thing which makes the devices cgroup unique from the others is that there can be many entries to the devices.allow (and in theory also to devices.deny) file. liblxc doesn't support that right now. This needs to be fixed in two places.
First, lxc_conf.c:write_info needs to write multiple entries from the .conf file into the cgroups/devices.allow file. I just changed the creat(f, 0755) to open(f, O_CREAT|O_WRONLY|O_APPEND, 0755) which seemed to work for me, but I'm not sure if that might adversely affect other code which counted on the truncation implicit in creat()? Secondly, the lxc_cgroup_copy needs to do a loop and write the entries one by one into the cgroup file. I'm just doing a dumb unsafe fgets loop, but I actually don't have that working yet, (which is why I'm not sending a patch - I figure you can whip something robust up in 2 seconds)

Serge, thanks for investigating this bug.
I will look how to fix that without breaking previous container configuration.

-- Daniel

A message that is not in the archive (sent off-list or not yet received): 491849DA.7060204-NmTC/[email protected]

#4 lore raw
Quoted 19 lines · Daniel Lezcano
Quoted 17 lines · Serge E. Hallyn

Hi Daniel,

I'm playing with liblxc containers and the device whitelist cgroup. One thing which makes the devices cgroup unique from the others is that there can be many entries to the devices.allow (and in theory also to devices.deny) file. liblxc doesn't support that right now. This needs to be fixed in two places.
First, lxc_conf.c:write_info needs to write multiple entries from the .conf file into the cgroups/devices.allow file. I just changed the creat(f, 0755) to open(f, O_CREAT|O_WRONLY|O_APPEND, 0755) which seemed to work for me, but I'm not sure if that might adversely affect other code which counted on the truncation implicit in creat()? Secondly, the lxc_cgroup_copy needs to do a loop and write the entries one by one into the cgroup file. I'm just doing a dumb unsafe fgets loop, but I actually don't have that working yet, (which is why I'm not sending a patch - I figure you can whip something robust up in 2 seconds)

Quoted 3 lines

Serge, thanks for investigating this bug.
I will look how to fix that without breaking previous container configuration.

Fixed and commited to CVS.

I will do a new release as soon as I finish the man pages.

Oren,

is there any change I have to care about before releasing a new version ?

Thanks.
-- Daniel

A message that is not in the archive (sent off-list or not yet received): 49228C12.3060802-NmTC/[email protected]

#6 lore raw
Quoted 24 lines · Daniel Lezcano
Quoted 19 lines · Daniel Lezcano
Quoted 17 lines · Serge E. Hallyn

Hi Daniel,

I'm playing with liblxc containers and the device whitelist cgroup. One thing which makes the devices cgroup unique from the others is that there can be many entries to the devices.allow (and in theory also to devices.deny) file. liblxc doesn't support that right now. This needs to be fixed in two places.
First, lxc_conf.c:write_info needs to write multiple entries from the .conf file into the cgroups/devices.allow file. I just changed the creat(f, 0755) to open(f, O_CREAT|O_WRONLY|O_APPEND, 0755) which seemed to work for me, but I'm not sure if that might adversely affect other code which counted on the truncation implicit in creat()? Secondly, the lxc_cgroup_copy needs to do a loop and write the entries one by one into the cgroup file. I'm just doing a dumb unsafe fgets loop, but I actually don't have that working yet, (which is why I'm not sending a patch - I figure you can whip something robust up in 2 seconds)

Quoted 3 lines

Serge, thanks for investigating this bug.
I will look how to fix that without breaking previous container configuration.

Quoted 7 lines

Fixed and commited to CVS.

I will do a new release as soon as I finish the man pages.

Oren,

is there any change I have to care about before releasing a new version ?

not yet. I'm running a bit behind, and hope to post new version around the weekend.

Oren.