Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 May 2018 21:32:08 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r333337 - head/sys/amd64/amd64
Message-ID:  <201805072132.w47LW8RE034907@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Mon May  7 21:32:08 2018
New Revision: 333337
URL: https://svnweb.freebsd.org/changeset/base/333337

Log:
  amd64: stop asserting params != NULL in the syscall path
  
  The parameter is effectively controllable by userspace. It does not matter
  what it is set to as it is being passed to copyin - worst case the operation
  will just fail.
  
  While here stop computing it unless it is going to be used.
  
  Noted by:	dillon@backplane.com

Modified:
  head/sys/amd64/amd64/trap.c

Modified: head/sys/amd64/amd64/trap.c
==============================================================================
--- head/sys/amd64/amd64/trap.c	Mon May  7 21:26:05 2018	(r333336)
+++ head/sys/amd64/amd64/trap.c	Mon May  7 21:32:08 2018	(r333337)
@@ -886,7 +886,6 @@ cpu_fetch_syscall_args(struct thread *td)
 	reg = 0;
 	regcnt = 6;
 
-	params = (caddr_t)frame->tf_rsp + sizeof(register_t);
 	sa->code = frame->tf_rax;
 
 	if (sa->code == SYS_syscall || sa->code == SYS___syscall) {
@@ -910,7 +909,7 @@ cpu_fetch_syscall_args(struct thread *td)
 	argp += reg;
 	memcpy(sa->args, argp, sizeof(sa->args[0]) * 6);
 	if (sa->narg > regcnt) {
-		KASSERT(params != NULL, ("copyin args with no params!"));
+		params = (caddr_t)frame->tf_rsp + sizeof(register_t);
 		error = copyin(params, &sa->args[regcnt],
 	    	    (sa->narg - regcnt) * sizeof(sa->args[0]));
 	}



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