summaryrefslogtreecommitdiff
path: root/util/nvmutil/lib
AgeCommit message (Collapse)Author
7 hoursmkhtemp: fail if TMPDIR is SET, but set wrongmkhtemp-wipLeah Rowe
right now we defer to fallbacks otherwise, which is wrong. Signed-off-by: Leah Rowe <leah@libreboot.org>
9 hoursmkhtemp: PROPER fd leak/overwrite fixLeah Rowe
now this code should be stable. no leaks. yes. hardened mkhtemp. oh yeah mate. now all i need is a main() and a getopt loop, and pledge, unveil, and blackjack, and something dubious of a titilating nature. Signed-off-by: Leah Rowe <leah@libreboot.org>
9 hoursutil/nvmutil: remove bad check in world stick funcLeah Rowe
yeah, of course we don't bloody own /tmp duh Signed-off-by: Leah Rowe <leah@libreboot.org>
9 hoursmkhtemp: fix bad closeLeah Rowe
the fd in fs_resolve_at is subsequently used note that in practise, this is not a real fix: the best fix is to cache all descriptors and free them at the end, once resolution is done. not a real fix, because now fd leaks, but it's dealt with on program close. not a util yet. just just stubbing this in main to test various features. Signed-off-by: Leah Rowe <leah@libreboot.org>
10 hoursmkhtemp: fix bad checkLeah Rowe
where the path is quite short and the number of X is quite big compared to the rest of it, this check will actually cause a false overflow error. the maths are correct, just not the error Signed-off-by: Leah Rowe <leah@libreboot.org>
10 hoursmkhtemp: fix initialisied fdLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
11 hoursWIP remove xdev from openat2pLeah Rowe
causes error on cross mount links e.g. /tmp tmpfs Signed-off-by: Leah Rowe <leah@libreboot.org>
13 hoursWIP: "finished"Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
13 hoursremove dead code WIPLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
13 hoursWIP dir support (also demons)Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
18 hoursWIP identity check unificationLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
19 hoursWIP verify after lockLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
19 hoursWIP cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
20 hourscleanup WIPLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
22 hoursWIP cleanup: split mkhtempLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
22 hoursWIP cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
22 hoursWIP: remove local mode in mkhtemp + cleanupLeah Rowe
bloat unveil can get pledged Signed-off-by: Leah Rowe <leah@libreboot.org>
23 hoursWIP: split out rand fill on mkhtempLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
23 hoursWIP: file system sandboxingLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
24 hoursopenat2 WIPLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
25 hoursWIP: fs_resolve_atLeah Rowe
yes. mkhtemp is ccoming along nicely Signed-off-by: Leah Rowe <leah@libreboot.org>
26 hoursWIP: always use openatLeah Rowe
why would i write a secure mktemp to be used on linux from 1999????? Signed-off-by: Leah Rowe <leah@libreboot.org>
26 hoursWIP: pathless resolutionLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
28 hoursWIP: hardened mktempLeah Rowe
i'm pretty much nearly there. still no dir support, only files. i won't keep amending now - will do more, then squash later. Signed-off-by: Leah Rowe <leah@libreboot.org>
4 daysnvmutil: fix unveil callLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
4 daysutil/nvmutil: better getrandom safetyLeah Rowe
err if buf NULL, len -1 also getrandom may return fewer bytes, so loop that too. why can't linux be like bsd? bsd is: arc4random_buf(buf, len); no checks needed. it never errs. Signed-off-by: Leah Rowe <leah@libreboot.org>
4 daysfix variable nameLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
4 daysutil/nvmutil: re-add fallback timer randLeah Rowe
for 1989 enabled via ifdef. not enabled by default. Signed-off-by: Leah Rowe <leah@libreboot.org>
4 daysutil/nvmutil: remove arandom fallback on randLeah Rowe
openbsd 2.1 has arc4random, which we detect here. arandom was apparently added much later, so this is dead code. remove it. Signed-off-by: Leah Rowe <leah@libreboot.org>
4 daysutil/nvmutil: rand: use getrandom on newer linuxLeah Rowe
we still fall back to the old /dev/urandom read on older linux, via runtime detection (ENOSYS). getrandom is better, because it guarantees entropy via blocking, and works even when /dev/urandom is unavailable. it has the same practical benefit as arc4random, which i use on bsd. linux can have arc4random, but not every linux libc has it, so it's better to use getrandom on linux. older linux will fall back to /dev/urandom Signed-off-by: Leah Rowe <leah@libreboot.org>
4 daysutil/nvmutil: buffered urandom readsLeah Rowe
also generally tidied the code and made it more robust e.g. retries Signed-off-by: Leah Rowe <leah@libreboot.org>
4 daystidy some commentsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
4 daysnvmutil: make tmpdir string much more randomLeah Rowe
more random characters i added support for higher than the standard 6 characters so i can go nuts XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Signed-off-by: Leah Rowe <leah@libreboot.org>
4 daysutil/nvmutil: hardened mkstempLeah Rowe
200 retries, not 100. and open with O_NOFOLLOW and O_CLOEXEC check X on mkstemp support more than 6 X in mkstemp make PATH_LEN 4096 1024 is a bit low make default mkstemp length 4096 Signed-off-by: Leah Rowe <leah@libreboot.org>
4 daysnvmutil: rename lseek_loop to lseek_on_eintrLeah Rowe
that's what it does! Signed-off-by: Leah Rowe <leah@libreboot.org>
4 daysnvmutil: rename x_i_close to close_on_eintrLeah Rowe
that's what it does. waits for eintr to stop firing Signed-off-by: Leah Rowe <leah@libreboot.org>
4 daysnvmutil: don't have finite eintr waitLeah Rowe
this is technically incorrect. we don't control faults in the hardware. Signed-off-by: Leah Rowe <leah@libreboot.org>
4 daysnvmutil: rename x_i_fsync to fsync_on_eintrLeah Rowe
that's what it does. waits on eintr. Signed-off-by: Leah Rowe <leah@libreboot.org>
4 daysutil/rename: rename x_i_fsyncLeah Rowe
rename to fsync_on_eintr, because that's what it does Signed-off-by: Leah Rowe <leah@libreboot.org>
4 daysnvmutil: remove memcmp/memcpy/strrchr/renameLeah Rowe
i had this idea in my head of later porting this to k&r c for fun. but screw it. compiling on everything since 1989 is enough Signed-off-by: Leah Rowe <leah@libreboot.org>
4 daysutil/nvmutil: tidy up includesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
5 daysutil/nvmutil: major cleanupLeah Rowe
handle init in xstatus() it's now a singleton design also tidied up some other code also removed todo.c. bloat. will do all those anyway. too much change. i just kept touching the code until it looked good Signed-off-by: Leah Rowe <leah@libreboot.org>
5 daysnvmutil: move lib files to lib/Leah Rowe
only keep nvmutil.c in main Signed-off-by: Leah Rowe <leah@libreboot.org>