[lxc-devel] [lxc/lxc] f749d5: utils: move memfd_create() definition

GitHub noreply at github.com
Sat Oct 21 17:03:48 UTC 2017


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: f749d524f18a8b8ae29df6ccbdb05c949f409cff
      https://github.com/lxc/lxc/commit/f749d524f18a8b8ae29df6ccbdb05c949f409cff
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-10-21 (Sat, 21 Oct 2017)

  Changed paths:
    M src/lxc/conf.c
    M src/lxc/utils.h

  Log Message:
  -----------
  utils: move memfd_create() definition

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: b499121f1fd0729d84a64458038a01f7009d707c
      https://github.com/lxc/lxc/commit/b499121f1fd0729d84a64458038a01f7009d707c
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-10-21 (Sat, 21 Oct 2017)

  Changed paths:
    M src/lxc/utils.h

  Log Message:
  -----------
  utils: add lxc_cloexec()

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: 127c6e703b0a10b68aef44e8951b0507d72efd90
      https://github.com/lxc/lxc/commit/127c6e703b0a10b68aef44e8951b0507d72efd90
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-10-21 (Sat, 21 Oct 2017)

  Changed paths:
    M src/lxc/utils.c
    M src/lxc/utils.h

  Log Message:
  -----------
  utils: add lxc_make_tmpfile()

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: e46361235c04c10a9dfb5f2485e23a187fae9189
      https://github.com/lxc/lxc/commit/e46361235c04c10a9dfb5f2485e23a187fae9189
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-10-21 (Sat, 21 Oct 2017)

  Changed paths:
    M src/lxc/utils.c
    M src/lxc/utils.h

  Log Message:
  -----------
  utils: add lxc_getpagesize()

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: f3d05ee66dbf0e8283a2eeb6321e1bc7dfcb3034
      https://github.com/lxc/lxc/commit/f3d05ee66dbf0e8283a2eeb6321e1bc7dfcb3034
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-10-21 (Sat, 21 Oct 2017)

  Changed paths:
    M src/lxc/Makefile.am
    A src/lxc/ringbuf.c
    A src/lxc/ringbuf.h

  Log Message:
  -----------
  ringbuf: implement simple and efficient ringbuffer

liblxc will use a ringbuffer implementation that employs mmap()ed memory.
Specifically, the ringbuffer will create an anonymous memory mapping twice the
requested size for the ringbuffer. Afterwards, an in-memory file the requested
size for the ringbuffer will be created. This in-memory file will then be
memory mapped twice into the previously established anonymous memory mapping
thereby effectively splitting the anoymous memory mapping in two halves of
equal size.  This will allow the ringbuffer to get rid of any complex boundary
and wrap-around calculation logic. Since the underlying physical memory is the
same in both halves of the memory mapping only a single memcpy() call for both
reads and writes from and to the ringbuffer is needed.

Design Notes:
- Since we're using MAP_FIXED memory mappings to map the same in-memory file
  twice into the anonymous memory mapping the kernel requires us to always
  operate on properly aligned pages. To guarantee proper page aligment the size
  of the ringbuffer must always be a muliple of the kernel's page size. This
  also implies that the minimum size of the ringbuffer must be at least equal to
  one page size. This additional requirement is reasonably unproblematic.
  First, any ringbuffer smaller than the size of a single page is very likely
  useless since the standard page size on linux is 4096 bytes.
- Because liblxc is not able to predict the output a user is going to produce
  (e.g. users could cat binary files onto the console) and because the
  ringbuffer is located in a hotpath and needs to be as performant as possible
  liblxc will not parse the buffer.

Use Case:
The ringbuffer is needed by liblxc in order to safely log the output of write
intensive callers that produce unpredictable output or unpredictable amounts of
output. The console output created by a booting system and the user is one of
those cases. Allowing a container to log the console's output to a file it
would be possible for a malicious user to fill up the host filesystem by
producing random ouput on the container's console if quota support is either
not enabled or not available for the underlying filesystem. Using a ringbuffer
is a reliable and secure way to ensure a fixed-size log.

Closes #1857.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: b037bc675b33363ace7a244ae6e698d0638d2256
      https://github.com/lxc/lxc/commit/b037bc675b33363ace7a244ae6e698d0638d2256
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-10-21 (Sat, 21 Oct 2017)

  Changed paths:
    M src/lxc/utils.c
    M src/lxc/utils.h

  Log Message:
  -----------
  utils: add lxc_safe_long_long()

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: e3db0162ff48d45b43ed94ff4ba4e6115df6d572
      https://github.com/lxc/lxc/commit/e3db0162ff48d45b43ed94ff4ba4e6115df6d572
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-10-21 (Sat, 21 Oct 2017)

  Changed paths:
    M src/lxc/utils.c
    M src/lxc/utils.h
    M src/tests/lxc-test-utils.c

  Log Message:
  -----------
  utils: parse_byte_size_string()

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: 6222c3f48b87940377dec082c300770b1c773611
      https://github.com/lxc/lxc/commit/6222c3f48b87940377dec082c300770b1c773611
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-10-21 (Sat, 21 Oct 2017)

  Changed paths:
    M src/lxc/utils.c
    M src/lxc/utils.h

  Log Message:
  -----------
  utils: add lxc_find_next_power2()

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: 2ea479c9a6a40a8351b9781a6c87edaf561965c0
      https://github.com/lxc/lxc/commit/2ea479c9a6a40a8351b9781a6c87edaf561965c0
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-10-21 (Sat, 21 Oct 2017)

  Changed paths:
    M src/lxc/confile_utils.c
    M src/lxc/confile_utils.h

  Log Message:
  -----------
  confile_utils: add lxc_get_conf_uint64()

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: a04220de0b0f402b0f312ba514bc382d39d0e05c
      https://github.com/lxc/lxc/commit/a04220de0b0f402b0f312ba514bc382d39d0e05c
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-10-21 (Sat, 21 Oct 2017)

  Changed paths:
    M src/lxc/conf.h
    M src/lxc/confile.c

  Log Message:
  -----------
  confile: add lxc.console.logsize

Closes #1857.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: 7f135597a271499cd323899f9a5de099b2469db9
      https://github.com/lxc/lxc/commit/7f135597a271499cd323899f9a5de099b2469db9
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-10-21 (Sat, 21 Oct 2017)

  Changed paths:
    M src/lxc/conf.c
    M src/lxc/conf.h
    M src/lxc/start.c

  Log Message:
  -----------
  conf: lxc_setup() -> lxc_setup_child()

Closes #1857.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: 732375f5f5363f4eb0d4b4575f509f764c76ea1d
      https://github.com/lxc/lxc/commit/732375f5f5363f4eb0d4b4575f509f764c76ea1d
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-10-21 (Sat, 21 Oct 2017)

  Changed paths:
    M src/lxc/conf.c
    M src/lxc/conf.h
    M src/lxc/console.c
    M src/lxc/start.c

  Log Message:
  -----------
  console: add ringbuffer

Closes #1857.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: a2028b8f5ff873ebee3a66cee9c2e99310b235f8
      https://github.com/lxc/lxc/commit/a2028b8f5ff873ebee3a66cee9c2e99310b235f8
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-10-21 (Sat, 21 Oct 2017)

  Changed paths:
    M src/lxc/namespace.c

  Log Message:
  -----------
  namespace: use lxc_getpagesize()

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: f3d91bf09a32dab27fe47c113051f081750aed7d
      https://github.com/lxc/lxc/commit/f3d91bf09a32dab27fe47c113051f081750aed7d
  Author: Serge Hallyn <serge at hallyn.com>
  Date:   2017-10-21 (Sat, 21 Oct 2017)

  Changed paths:
    M src/lxc/Makefile.am
    M src/lxc/conf.c
    M src/lxc/conf.h
    M src/lxc/confile.c
    M src/lxc/confile_utils.c
    M src/lxc/confile_utils.h
    M src/lxc/console.c
    M src/lxc/namespace.c
    A src/lxc/ringbuf.c
    A src/lxc/ringbuf.h
    M src/lxc/start.c
    M src/lxc/utils.c
    M src/lxc/utils.h
    M src/tests/lxc-test-utils.c

  Log Message:
  -----------
  Merge pull request #1864 from brauner/2017-10-18/ringbuffer

ringbuffer: implement efficient and performant ringbuffer


Compare: https://github.com/lxc/lxc/compare/c01db84ea9f1...f3d91bf09a32


More information about the lxc-devel mailing list