Page MenuHomeFreeBSD

libcapsicum: cache more time zone information
ClosedPublic

Authored by oshogbo on Wed, May 22, 12:11 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, May 27, 11:28 AM
Unknown Object (File)
Mon, May 27, 11:14 AM
Unknown Object (File)
Fri, May 24, 8:37 PM
Unknown Object (File)
Thu, May 23, 1:55 PM
Subscribers

Details

Summary

The functions like gmtime(3) expect to cache a GMT time zone. Some
sandboxed programs (like last(1)) use the gmtime function. In case
of last, this function fails to load a proper time zone because it
is called after entering the capability mode.

_open () at _open.S:4
0x00000008011bc5a8 in tzloadbody (name=0x8018b9580 "/usr/share/zoneinfo/Etc/UTC", sp=0x801870140,
tzload (name=<optimized out>, sp=0x801870140, doextend=true)
0x00000008011bb8ba in gmtload (sp=0x801870140) at /usr/src/contrib/tzcode/localtime.c:1456
gmtcheck () at /usr/src/contrib/tzcode/localtime.c:1581
0x000000080111f85a in _libc_once (once_control=0x80127c550, init_routine=0x0)
_once (once_control=0x80127c550, init_routine=0x0) at /usr/src/lib/libc/gen/_once_stub.c:63
0x00000008011bb9d0 in gmtime_r (timep=0x7fffffffe3a8, tmp=0x80127c568)
gmtime (timep=timep@entry=0x7fffffffe3a8) at /usr/src/contrib/tzcode/localtime.c:1865
0x0000000001024cd4 in printentry (bp=bp@entry=0x8018b4800, tt=tt@entry=0x80186a0a0)
0x00000000010245ae in doentry (bp=0x8018b4800)
0x00000000010243a7 in main (argc=1, argv=<optimized out>)

This time zone is not loaded by the tzset(3) function. Because of
that, extend the caph_cache_tzdata(3) function to also include the
GMT time zone. There is no other way to cache this data than
calling gmtime(3) once.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

oshogbo added reviewers: emaste, markj.

LGTM. Probably worth a comment in the code (some of the same content from the commit message).

This revision is now accepted and ready to land.Wed, May 22, 12:54 PM

Add comment, suggested by emaste.

This revision now requires review to proceed.Fri, May 24, 9:03 AM
markj added inline comments.
lib/libcapsicum/capsicum_helpers.h
143
This revision is now accepted and ready to land.Fri, May 24, 2:22 PM

LGTM, with the typo corrections from Mark