Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Aug 2020 12:57:03 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r364669 - stable/12/sys/compat/linux
Message-ID:  <202008241257.07OCv32a041909@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Mon Aug 24 12:57:03 2020
New Revision: 364669
URL: https://svnweb.freebsd.org/changeset/base/364669

Log:
  MFC r349746:
  
  Fix linuxulator prlimit64(2) with pid == 0.  This makes 'ulimit -a'
  return something reasonable, and helps linux binaries which attempt
  to close all the files, eg apt(8).
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  stable/12/sys/compat/linux/linux_misc.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/compat/linux/linux_misc.c
==============================================================================
--- stable/12/sys/compat/linux/linux_misc.c	Mon Aug 24 12:54:19 2020	(r364668)
+++ stable/12/sys/compat/linux/linux_misc.c	Mon Aug 24 12:57:03 2020	(r364669)
@@ -2397,10 +2397,14 @@ linux_prlimit64(struct thread *td, struct linux_prlimi
 		flags |= PGET_CANDEBUG;
 	else
 		flags |= PGET_CANSEE;
-	error = pget(args->pid, flags, &p);
-	if (error != 0)
-		return (error);
-
+	if (args->pid == 0) {
+		p = td->td_proc;
+		PHOLD(p);
+	} else {
+		error = pget(args->pid, flags, &p);
+		if (error != 0)
+			return (error);
+	}
 	if (args->old != NULL) {
 		PROC_LOCK(p);
 		lim_rlimit_proc(p, which, &rlim);



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