[Midnightbsd-cvs] src [7277] stable/0.7: add the security patches for openssh w/ pam login and amd64 GS register handling

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Tue Aug 25 18:32:11 EDT 2015


Revision: 7277
          http://svnweb.midnightbsd.org/src/?rev=7277
Author:   laffer1
Date:     2015-08-25 18:32:09 -0400 (Tue, 25 Aug 2015)
Log Message:
-----------
add the security patches for openssh w/ pam login and amd64 GS register handling

Modified Paths:
--------------
    stable/0.7/crypto/openssh/monitor.c
    stable/0.7/crypto/openssh/monitor_wrap.c
    stable/0.7/crypto/openssh/mux.c
    stable/0.7/sys/amd64/amd64/exception.S
    stable/0.7/sys/amd64/amd64/machdep.c
    stable/0.7/sys/amd64/amd64/trap.c

Modified: stable/0.7/crypto/openssh/monitor.c
===================================================================
--- stable/0.7/crypto/openssh/monitor.c	2015-08-25 22:16:26 UTC (rev 7276)
+++ stable/0.7/crypto/openssh/monitor.c	2015-08-25 22:32:09 UTC (rev 7277)
@@ -1027,9 +1027,7 @@
 int
 mm_answer_pam_init_ctx(int sock, Buffer *m)
 {
-
 	debug3("%s", __func__);
-	authctxt->user = buffer_get_string(m, NULL);
 	sshpam_ctxt = (sshpam_device.init_ctx)(authctxt);
 	sshpam_authok = NULL;
 	buffer_clear(m);
@@ -1111,14 +1109,16 @@
 int
 mm_answer_pam_free_ctx(int sock, Buffer *m)
 {
+	int r = sshpam_authok != NULL && sshpam_authok == sshpam_ctxt;
 
 	debug3("%s", __func__);
 	(sshpam_device.free_ctx)(sshpam_ctxt);
+	sshpam_ctxt = sshpam_authok = NULL;
 	buffer_clear(m);
 	mm_request_send(sock, MONITOR_ANS_PAM_FREE_CTX, m);
 	auth_method = "keyboard-interactive";
 	auth_submethod = "pam";
-	return (sshpam_authok == sshpam_ctxt);
+	return r;
 }
 #endif
 

Modified: stable/0.7/crypto/openssh/monitor_wrap.c
===================================================================
--- stable/0.7/crypto/openssh/monitor_wrap.c	2015-08-25 22:16:26 UTC (rev 7276)
+++ stable/0.7/crypto/openssh/monitor_wrap.c	2015-08-25 22:32:09 UTC (rev 7277)
@@ -820,7 +820,6 @@
 
 	debug3("%s", __func__);
 	buffer_init(&m);
-	buffer_put_cstring(&m, authctxt->user);
 	mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PAM_INIT_CTX, &m);
 	debug3("%s: waiting for MONITOR_ANS_PAM_INIT_CTX", __func__);
 	mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_PAM_INIT_CTX, &m);

Modified: stable/0.7/crypto/openssh/mux.c
===================================================================
--- stable/0.7/crypto/openssh/mux.c	2015-08-25 22:16:26 UTC (rev 7276)
+++ stable/0.7/crypto/openssh/mux.c	2015-08-25 22:32:09 UTC (rev 7277)
@@ -633,7 +633,8 @@
 	u_int lport, cport;
 	int i, ret = 0, freefwd = 1;
 
-	fwd.listen_host = fwd.connect_host = NULL;
+	memset(&fwd, 0, sizeof(fwd));
+
 	if (buffer_get_int_ret(&ftype, m) != 0 ||
 	    (fwd.listen_host = buffer_get_string_ret(m, NULL)) == NULL ||
 	    buffer_get_int_ret(&lport, m) != 0 ||
@@ -783,7 +784,8 @@
 	int i, listen_port, ret = 0;
 	u_int lport, cport;
 
-	fwd.listen_host = fwd.connect_host = NULL;
+	memset(&fwd, 0, sizeof(fwd));
+
 	if (buffer_get_int_ret(&ftype, m) != 0 ||
 	    (fwd.listen_host = buffer_get_string_ret(m, NULL)) == NULL ||
 	    buffer_get_int_ret(&lport, m) != 0 ||

Modified: stable/0.7/sys/amd64/amd64/exception.S
===================================================================
--- stable/0.7/sys/amd64/amd64/exception.S	2015-08-25 22:16:26 UTC (rev 7276)
+++ stable/0.7/sys/amd64/amd64/exception.S	2015-08-25 22:32:09 UTC (rev 7277)
@@ -150,9 +150,13 @@
 IDTVEC(tss)
 	TRAP_ERR(T_TSSFLT)
 IDTVEC(missing)
-	TRAP_ERR(T_SEGNPFLT)
+	subq	$TF_ERR,%rsp
+	movl	$T_SEGNPFLT,TF_TRAPNO(%rsp)
+	jmp	prot_addrf
 IDTVEC(stk)
-	TRAP_ERR(T_STKFLT)
+	subq	$TF_ERR,%rsp
+	movl	$T_STKFLT,TF_TRAPNO(%rsp)
+	jmp	prot_addrf
 IDTVEC(align)
 	TRAP_ERR(T_ALIGNFLT)
 
@@ -315,6 +319,7 @@
 IDTVEC(prot)
 	subq	$TF_ERR,%rsp
 	movl	$T_PROTFLT,TF_TRAPNO(%rsp)
+prot_addrf:
 	movq	$0,TF_ADDR(%rsp)
 	movq	%rdi,TF_RDI(%rsp)	/* free up a GP register */
 	leaq	doreti_iret(%rip),%rdi

Modified: stable/0.7/sys/amd64/amd64/machdep.c
===================================================================
--- stable/0.7/sys/amd64/amd64/machdep.c	2015-08-25 22:16:26 UTC (rev 7276)
+++ stable/0.7/sys/amd64/amd64/machdep.c	2015-08-25 22:32:09 UTC (rev 7277)
@@ -425,6 +425,7 @@
 	regs->tf_rflags &= ~(PSL_T | PSL_D);
 	regs->tf_cs = _ucodesel;
 	regs->tf_ds = _udatasel;
+	regs->tf_ss = _udatasel;
 	regs->tf_es = _udatasel;
 	regs->tf_fs = _ufssel;
 	regs->tf_gs = _ugssel;

Modified: stable/0.7/sys/amd64/amd64/trap.c
===================================================================
--- stable/0.7/sys/amd64/amd64/trap.c	2015-08-25 22:16:26 UTC (rev 7276)
+++ stable/0.7/sys/amd64/amd64/trap.c	2015-08-25 22:32:09 UTC (rev 7277)
@@ -473,8 +473,6 @@
 			goto out;
 
 		case T_STKFLT:		/* stack fault */
-			break;
-
 		case T_PROTFLT:		/* general protection fault */
 		case T_SEGNPFLT:	/* segment not present fault */
 			if (td->td_intr_nesting_level != 0)



More information about the Midnightbsd-cvs mailing list