Skip to content

io compartments to compression libraries #2333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

Conversation

brooksdavis
Copy link
Member

zlib has two major parts. The core deflate compression works entierly in memory. There is also the gzlib portion which provides an analog to POSIX IO interfaces and uses IO underneath.

@brooksdavis brooksdavis changed the title libz: add an io compartment io compartments to compression libraries Feb 21, 2025
@brooksdavis
Copy link
Member Author

With this change:

  PID COMM                 CID CNAME                                   
 1925 gzcat                  0 [RTLD]                                  
 1925 gzcat                  1 [TCB]                                   
 1925 gzcat                  2 [libunwind]                             
 1925 gzcat                  3 /usr/bin/gzcat                          
 1925 gzcat                  4 libz.so.6                               
 1925 gzcat                  5 libz.so.6:io                            
 1925 gzcat                  6 liblzma.so.5                            
 1925 gzcat                  7 libprivatezstd.so.5                     
 1925 gzcat                  8 libprivatezstd.so.5:io                  
 1925 gzcat                  9 libbz2.so.4                             
 1925 gzcat                 10 libbz2.so.4:io                          
 1925 gzcat                 11 libc.so.7:mktemp                        
 1925 gzcat                 12 libc.so.7:stdio                         
 1925 gzcat                 13 libc.so.7:mrs                           
 1925 gzcat                 14 libc.so.7:jemalloc                      
 1925 gzcat                 15 libc.so.7:string                        
 1925 gzcat                 16 libc.so.7:string.trusted                
 1925 gzcat                 17 libmd.so.7                              

liblzma appears to avoid IO entirely.

Copy link
Collaborator

@bsdjhb bsdjhb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will pull this locally and do some testing as I want to see what the latest c18n toolchain logs for this.

zlib has two major parts.  The core deflate compression works entirely
in memory.  There is also the gzlib portion which provides an analog to
POSIX IO interfaces and uses IO underneath.
libbz2 has three parts (two of which are io).  There is a core of
in-memory compression/decompression, a stdio based file IO interface,
and a partial emulation of the gzlib interface.
This isn't a conventional IO interface, but rather some debugging code
that is always compiled it.  Compartmentalize it anyway to limit the
blast radius of bugs elsewhere in the library.
@bsdjhb
Copy link
Collaborator

bsdjhb commented Mar 31, 2025

FYI, no surprises in the --verbose-c18n logs from the latest version of lld. I think this is fine to merge still.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants