Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Jul 2018 18:22:26 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r336871 - head/sys/compat/freebsd32
Message-ID:  <201807291822.w6TIMQhG010726@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: asomers
Date: Sun Jul 29 18:22:26 2018
New Revision: 336871
URL: https://svnweb.freebsd.org/changeset/base/336871

Log:
  getrusage(2): fix return value under 32-bit emulation
  
  According to the man page, getrusage(2) should return EFAULT if the rusage
  argument lies outside of the process's address space. But due to an
  oversight in r100384, that's never been the case during 32-bit emulation.
  Fix it.
  
  PR:		230153
  Reported by:	tests(7)
  Reviewed by:	cem
  MFC after:	2 weeks
  Differential Revision:	https://reviews.freebsd.org/D16500

Modified:
  head/sys/compat/freebsd32/freebsd32_misc.c

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_misc.c	Sun Jul 29 17:27:10 2018	(r336870)
+++ head/sys/compat/freebsd32/freebsd32_misc.c	Sun Jul 29 18:22:26 2018	(r336871)
@@ -883,12 +883,9 @@ freebsd32_getrusage(struct thread *td, struct freebsd3
 	int error;
 
 	error = kern_getrusage(td, uap->who, &s);
-	if (error)
-		return (error);
-	if (uap->rusage != NULL) {
-		freebsd32_rusage_out(&s, &s32);
+	freebsd32_rusage_out(&s, &s32);
+	if (error == 0)
 		error = copyout(&s32, uap->rusage, sizeof(s32));
-	}
 	return (error);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807291822.w6TIMQhG010726>