Linuxulator is great. however it has: /proc/sys/kernel/random/uuid which basically emulates boot_id for linux, but many programs refer to : /proc/sys/kernel/random/boot_id i tried to symlink (ln -s /proc/sys/kernel/random/uuid /proc/sys/kernel/random/boot_id) but it seems a redonly dir I think this should be added for linux compatibility or create also boot_id file (with the same value?) can it (symlink or file) added this for linuxulator compatibility with linux? Sami
btw: its about linprocfs! also as stated in: https://www.kernel.org/doc/html/latest/admin-guide/sysctl/kernel.html#random uuid should be regenerated everytime its read and boot_id should be set once at this point i don't care about the difference but maybe should a maintainer fix this accordingly
Created attachment 232322 [details] Patch to the kernel This patch might do it. Note that the value of boot_id is invariant per mount. Every time linprocfs is remounted, it will take a new value. In Linux procfs is virtually impossible to unmount because it is used continually.
Hi, Seems actually to do the trick.. wull try it and report. If we are here, from What I read uuid should be different each time its read.. is that the case? Sami
I went over the code.. You use 'sb' is it a global variable ? Since I don't see where its defined.. Sami
(In reply to Sami Halabi from comment #3) Yes, uuid is different each time while boot_id is the same (it is generated only for the first access): [root@vm-current /compat/linux/proc/sys/kernel/random]# while true;do echo "uuid: $(cat uuid)"; echo "boot_id: $(cat boot_id)"; echo "--------"; sleep 1; done uuid: 137336f7-9f82-11ec-a42a-080027bf0030 boot_id: edf12448-9f81-11ec-a429-080027bf0030 -------- uuid: 141106f9-9f82-11ec-a42a-080027bf0030 boot_id: edf12448-9f81-11ec-a429-080027bf0030 -------- uuid: 14b54806-9f82-11ec-a42a-080027bf0030 boot_id: edf12448-9f81-11ec-a429-080027bf0030 -------- uuid: 155a0fe7-9f82-11ec-a42a-080027bf0030 boot_id: edf12448-9f81-11ec-a429-080027bf0030 -------- uuid: 15f9a439-9f82-11ec-a42a-080027bf0030 boot_id: edf12448-9f81-11ec-a429-080027bf0030 -------- uuid: 169ae638-9f82-11ec-a42a-080027bf0030 boot_id: edf12448-9f81-11ec-a429-080027bf0030 -------- uuid: 173fa178-9f82-11ec-a42a-080027bf0030 boot_id: edf12448-9f81-11ec-a429-080027bf0030 -------- uuid: 17e42d8f-9f82-11ec-a42a-080027bf0030 boot_id: edf12448-9f81-11ec-a429-080027bf0030 --------
(In reply to Sami Halabi from comment #4) It is one of the arguments of the handler (PFS_FILL_ARGS): #define PFS_FILL_ARGS \ struct thread *td, struct proc *p, struct pfs_node *pn, \ struct sbuf *sb, struct uio *uio in sys/fs/pseudofs/pseudofs.h Cheers
Hi, Againt what src did you make tge patch. Currently I have 12.3-R-p2. As I read tge docs the src for that not maintained, but 12/stable. Right? Anyway from what I read the patch is doing what its intented to do. Can you yiu push it so freebsd-update would pick it up? Thanks in advance, Sami
Note that the linux implementation of these is random, whereas the the freebsd linuxulator implementation is not: for ii in 1 2 3 4 ; do cat /compat/linux/proc/sys/kernel/random/uuid ; done d5491552-a0b6-11ec-a963-90b11c7011ef d5495a75-a0b6-11ec-a963-90b11c7011ef d5497ded-a0b6-11ec-a963-90b11c7011ef d549b78d-a0b6-11ec-a963-90b11c7011ef One might consider this a deficiency or just an idiosyncratic difference between linux and linuxulator. But if it is a deficiency, this is a separate bug. I only made a comment here instead of opening a bug since I'm not sure if I would call it a bug. I guess I lean toward deficiency as the linux random(4) page that documents these files (uuid & boot_id) says "These read-only files contain random strings ...". Maybe it's an open question whether people in the "real world" depend on true randomness for these values.
(In reply to Sami Halabi from comment #7) It is against current. I do not have a base committer. This needs to be reviewed and accepted first. trasz@ in copy since he knows more about Linux emulation.
(In reply to John Hein from comment #8) An UUID is not truly random (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) at least until version 4. I suppose, if needed, this could be changed.
(In reply to Fernando Apesteguía from comment #9) Fernando, the patch looks good to me, feel free to put it on a phab, I'll approve
Review: https://reviews.freebsd.org/D34860
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=0f2041a5b03259a8a7b20ffc98e34884cc5590b3 commit 0f2041a5b03259a8a7b20ffc98e34884cc5590b3 Author: Fernando Apesteguía <fernape@FreeBSD.org> AuthorDate: 2022-03-08 14:19:53 +0000 Commit: Fernando Apesteguía <fernape@FreeBSD.org> CommitDate: 2022-04-11 16:23:28 +0000 [linprocfs] add sys/kernel/random/boot_id This file holds a UUID that is invariant for every boot. In our case, it is invariant per mount. PR: 262369 Reported by: sodynet1@gmail.com Approved by: dchagin@ Differential Revision: https://reviews.freebsd.org/D34860 sys/compat/linprocfs/linprocfs.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
Committed, Thanks!
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=c43c6efaee52465c1076de3f2ba2d3aef56c5bb7 commit c43c6efaee52465c1076de3f2ba2d3aef56c5bb7 Author: Fernando Apesteguía <fernape@FreeBSD.org> AuthorDate: 2022-03-08 14:19:53 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2022-06-17 19:33:50 +0000 [linprocfs] add sys/kernel/random/boot_id This file holds a UUID that is invariant for every boot. In our case, it is invariant per mount. PR: 262369 Reported by: sodynet1@gmail.com Approved by: dchagin@ Differential Revision: https://reviews.freebsd.org/D34860 (cherry picked from commit 0f2041a5b03259a8a7b20ffc98e34884cc5590b3) sys/compat/linprocfs/linprocfs.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)