Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Just zero out struct file::f_lock when exposed to u...



details:   https://anonhg.NetBSD.org/src/rev/8246a86a6a6b
branches:  trunk
changeset: 975387:8246a86a6a6b
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Aug 28 06:47:18 2020 +0000

description:
Just zero out struct file::f_lock when exposed to userland.

Userland has no business examining a snapshot of the lock state, even
if pseudonymized.  Should fix hppa build, where kmutex_t is somewhat
larger than anticipated by recent changes.

diffstat:

 sys/kern/kern_descrip.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 984c04f18f8f -r 8246a86a6a6b sys/kern/kern_descrip.c
--- a/sys/kern/kern_descrip.c   Fri Aug 28 06:47:14 2020 +0000
+++ b/sys/kern/kern_descrip.c   Fri Aug 28 06:47:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_descrip.c,v 1.247 2020/08/26 22:56:55 christos Exp $      */
+/*     $NetBSD: kern_descrip.c,v 1.248 2020/08/28 06:47:18 riastradh Exp $     */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.247 2020/08/26 22:56:55 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.248 2020/08/28 06:47:18 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2309,7 +2309,7 @@
        COND_SET_CPTR(fp->f_ops, fpsrc->f_ops, allowaddr);
        COND_SET_STRUCT(fp->f_undata, fpsrc->f_undata, allowaddr);
        COND_SET_STRUCT(fp->f_list, fpsrc->f_list, allowaddr);
-       COND_SET_STRUCT(fp->f_lock, fpsrc->f_lock, allowaddr);
+       memset(&fp->f_lock, 0, sizeof(fp->f_lock));
        fp->f_flag = fpsrc->f_flag;
        fp->f_marker = fpsrc->f_marker;
        fp->f_type = fpsrc->f_type;



Home | Main Index | Thread Index | Old Index