linux: cap mount id to INT_MAX

linux stores mount id as a int32_t, using xor would make it becomes
negative in some cases. As a result, we cap the value to INT_MAX to
prevent getting a negative value from userspace.

MFC after:      2 weeks
Differential Revision: https://reviews.freebsd.org/D59202
This commit is contained in:
ShengYi Hung committed 2026-10-14 06:27:46 +11:00
1 parent 5fb07bbcd5
commit 23626eb9e3
1 file changed
+2 -1
+2 -1
View File
@@ -621,7 +621,8 @@ linprocfs_doprocmountinfo(PFS_FILL_ARGS)
* (5) mountto path
*/
sbuf_printf(sb, "%u 0 0:0 / %s ",
sp->f_fsid.val[0] ^ sp->f_fsid.val[1], mntto);
(sp->f_fsid.val[0] ^ sp->f_fsid.val[1]) & 0x7fffffff,
mntto);
/* (6) mount options */
_sbuf_mntoptions_helper(sb, sp->f_flags);
/*