1. 08 Mar, 2016 1 commit
  2. 25 Feb, 2016 3 commits
  3. 15 Feb, 2016 4 commits
    • David Gibson's avatar
      altstack: Clarify checking macros · 11af31c3
      David Gibson authored
      The chkfail() and chkok() macros in altstack's test program are pretty
      difficult to read.  More importantly, though, they do all their tests with
      one big ok1().  That means if the test fails, you get no indication which
      of the checks was actually wrong, making debugging harder.
      
      This reworks the macros into a more verbose form that's easier to read,
      and splits them into multiple ok1() tests to make failures more explicit.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      11af31c3
    • David Gibson's avatar
      altstack: Declare memory clobbers · dd3f80c1
      David Gibson authored
      altstack includes a couple of inline asm blocks with x86 push and pop
      instructions.  These instructions will access memory (the stack), but
      that's not declared in inline asm statement.  We seem to be getting away
      with it, but in theory that could allow the compiler to re-order accesses
      to local variables across the asm block.  Since those blocks change the
      location of the stack, that could be very bad.
      
      Adding a "memory" clobber should prevent this (effectively making the asm
      blocks a compiler memory barrier).
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      dd3f80c1
    • David Gibson's avatar
      altstack: Include config.h in run.c · c9b3a91c
      David Gibson authored
      ccan programs should always include config.h before anything else to make
      sure everything is set up correctly.  Doing so in altstack's run.c means
      it no longer needs an explicit _XOPEN_SOURCE 700, since _GNU_SOURCE is set
      in config.h (for GNU libc, anyway).
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      c9b3a91c
    • David Gibson's avatar
      altstack: Increase signal stack size · a4e6f6cb
      David Gibson authored
      At present the altstack module uses a stack of size MINSIGSTKSZ for its
      SIGSEGV handler.  Although MINSIGSTKSZ is defined to be large enough to
      execute a signal handler, it doesn't guarantee that you can do anything
      very much within it.
      
      With certain libc versions, MINSIGSTKSZ is not enough to execute the
      longjmp() used in altstack.  Specfically, with Ubuntu 12.04 (the default
      install for Travis containers), the first time longjmp() is executed the
      symbol must be resolved by the dynamic linker in a process which overruns
      the MINSIGSTKSZ sized stack.  That then corrupts local variables in
      altstack() itself causing a number of subsequent failures.
      
      This patch addresses the problem by changing from MINSIGSTKSZ to SIGSTKSZ
      which is supposed to cover "the usual requirements for an alternate signal
      stack".
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      a4e6f6cb
  4. 08 Feb, 2016 1 commit
  5. 05 Feb, 2016 1 commit
  6. 03 Feb, 2016 13 commits
  7. 02 Feb, 2016 5 commits
    • David Gibson's avatar
      idtree: Fix undefined behaviour (left shift of signed value) · 36a15d7d
      David Gibson authored
      ~0 will be signed and negative on any 2s complement system, and
      left shifting a negative value has undefined behaviour in C.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      36a15d7d
    • David Gibson's avatar
      idtree: Fix misindented statement · fb33661a
      David Gibson authored
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      fb33661a
    • David Gibson's avatar
      idtree: Fix comparison is always false warning · 2b48199f
      David Gibson authored
      idtree.c:146 triggers a "comparison is always false" warning on some
      compiler configurations, since the 'id' variable is unsigned.
      
      Elsewhere in the module ids seem to be represented by (signed) ints, so
      use the same convention here, suppressing the warning and also maybe being
      more correct in other ways.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      2b48199f
    • David Gibson's avatar
      htable: Mark functions constructed by HTABLE_DEFINE_TYPE as UNNEEDED · 71b4e3ad
      David Gibson authored
      The HTABLE_DEFINE_TYPE macro builds a type-specific hash table by
      constructing a bunch of simple wrapper functions.  The user of the hash
      table may not end up using all of these.  With gcc the fact that the
      functions are inline stops an warnings about unused functions, but that's
      not the case with clang.
      
      Suppress these warnings by marking all the constructed functions except
      for name##_add() as UNNEEDED (using the macro from ccan/compiler).  _add
      is left alone on the grounds that a hash table you never add anything to
      isn't much use, so this will help you to spot an entirely redundant
      HTABLE_DEFINE_TYPE invocation.  *_init() would be a more obvious choice,
      except that there is both *_init() and *_init_sized() and you only need
      to use one of these.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      71b4e3ad
    • David Gibson's avatar
      strmap: Convert to using TCON_WRAP() instead of plain TCON() · ab244401
      David Gibson authored
      The usual way of construction strmap objects is to use the STRMAP_MEMBERS()
      macro which expands to both a raw strmap structure and a tcon type canary.
      However, the tcon type canary involves a flexible array member which means
      that in standard C99 STRMAP_MEMBERS() must appear only at the end of a
      structure definition.  But worse, that structure can then only appear at
      the end of any other structure it is included in, which is pretty
      inconvenient for the intended purpose of creating type specific strmaps.
      
      gcc extensions allow this to work (somehow), but clang complains loudly
      about it.
      
      The tcon module already includes the TCON_WRAP() mechanism, which already
      provides this same sort of type-specific definitions in a more general way.
      So convert strmap (and its users) to that approach.
      
      This removes STRMAP_MEMBERS() entirely, breaking compatibility.  I'm hoping
      strmap is used in few enough places that we can get away with that.
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      ab244401
  8. 29 Jan, 2016 2 commits
  9. 27 Jan, 2016 2 commits
  10. 26 Jan, 2016 2 commits
  11. 21 Jan, 2016 1 commit
  12. 19 Jan, 2016 3 commits
  13. 18 Jan, 2016 1 commit
  14. 05 Jan, 2016 1 commit
    • Dan Good's avatar
      deque: check HAVE_STATEMENT_EXPR, tweaks from feedback · 3022d16d
      Dan Good authored
      Thanks to the detailed feedback from David Gibson, I made the
      following improvements:
      
      * add missing includes
      * check for statement expression support, give an error if absent
      * ccanlint directive to skip "without features" steps
      * add license ref to top of source files
      * rename run1.c test to api1.c
      Signed-off-by: default avatarDan Good <dan@dancancode.com>
      3022d16d