git: 23626eb9e3d6 - main - linux: cap mount id to INT_MAX

From: ShengYi Hung <aokblast_at_FreeBSD.org>
Date: Tue, 13 Oct 2026 19:27:58 UTC
The branch main has been updated by aokblast:

URL: https://cgit.FreeBSD.org/src/commit/?id=23626eb9e3d61928358c9c813aa5a17e797ba404

commit 23626eb9e3d61928358c9c813aa5a17e797ba404
Author:     ShengYi Hung <aokblast@FreeBSD.org>
AuthorDate: 2026-08-26 20:44:47 +0000
Commit:     ShengYi Hung <aokblast@FreeBSD.org>
CommitDate: 2026-10-13 19:27:46 +0000

    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
---
 sys/compat/linprocfs/linprocfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c
index b0e6a3a15bea..167bc94c5aa3 100644
--- a/sys/compat/linprocfs/linprocfs.c
+++ b/sys/compat/linprocfs/linprocfs.c
@@ -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);
 		/*