Make getrandom(2) a public interface

Review Request #1277 — Created Nov. 9, 2018 and submitted

jbk
illumos-gate
9971
general

Make getrandom(2) a public interface

Ran libc testsuite (which includes getrandom tests). All tests pass.

  • 0
  • 0
  • 5
  • 1
  • 6
Description From Last Updated
danmcd
  1. Ship It!
  2. 
      
jbk
igork
  1. Ship It!
  2. 
      
yuripv
  1. 
      
  2. usr/src/man/man2/getrandom.2 (Diff revision 2)
     
     

    Add between NAME and SYNOPSIS sections:

    .Sh LIBRARY
    .Lb libc
    
  3. usr/src/man/man2/getrandom.2 (Diff revision 2)
     
     
  4. usr/src/man/man2/getrandom.2 (Diff revision 2)
     
     
  5. usr/src/man/man2/getrandom.2 (Diff revision 2)
     
     

    Might want to add a STANDARDS section saying that it's non-standard and comes from linux originally.

  6. 
      
jbk
yuripv
  1. Ship It!
  2. 
      
mgerdts
  1. Ship It!
  2. 
      
ptribble
  1. Does
    
    usr/src/uts/common/os/sysent.c
    
    need to be updated with the signature change?
    
    Also usr/src/lib/libc/port/gen/getentropy.c?
    1. Technically, they're probably ok -- nothing seems to actually use the prototype in sysent.c and we explicitly check the size in getentropy, so the return value will always fit in an int. However, relying on such things does seem rather brittle, so it would be better to update these. I'll post an update in a bit reflecting these.

    2. I agree that we clamp it at the moment, so the return will happen to fit in whatever the type is declared as.

      As for sysent.c, should the table be changed from SYSENT_CI to SYSENT_CL?

  2. 
      
ptribble
  1. 
      
  2. usr/src/man/man2/getrandom.2 (Diff revision 3)
     
     

    Would it be worth adding details of the maximum supported request sizes?

    1. An earlier draft did language around request sizes, but then it was dropped. I think it ends up exposing (and committing us to) too many implementation details if we were to try to document it. We can always come back later and make stronger guarantees if we need to.

    2. As the person who actually wrote the manual page (and the original code), I don't believe it makes sense to do so, mostly for the reasons Jason mentioned. If we have cases where we can do more in the future, having a fixed upper bound only hurts us. That said, I think the biggest thing that a consumer would really want was a guaranteed lower bound of I got this much data or I got nothing much in the fashion of getentropy(3C). That said, it's something we should probably do in another change with a lot more analysis of the getrandom(2) kernel interfaces to make sure we can actually honor that guarantee.

  3. 
      
jbk
citrus
  1. Ship It!
  2. 
      
danmcd
  1. Ship It!
  2. 
      
jbk
ptribble
  1. Ship It!
  2. 
      
danmcd
  1. Incremental 4..5 still looks good.

  2. 
      
rm
  1. 
      
  2. usr/src/man/man2/getrandom.2 (Diff revision 5)
     
     
    To be consistent with the language in ther est of the manual this should be:
    
    The
    .Fn getrandom
    function
  3. 
      
jbk
rm
  1. Ship It!
  2. 
      
citrus
  1. Ship It!
  2. 
      
mgerdts
  1. Ship It!
  2. 
      
danmcd
  1. Ship It!
  2. 
      
ptribble
  1. Ship It!
  2. 
      
igork
  1. Ship It!
  2. 
      
jbk
Review request changed

Status: Closed (submitted)

Loading...