From owner-svn-soc-all@FreeBSD.ORG Sun Jun 7 17:50:29 2015 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8F7C92B5 for ; Sun, 7 Jun 2015 17:50:29 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D97D1666 for ; Sun, 7 Jun 2015 17:50:29 +0000 (UTC) (envelope-from def@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.9/8.14.9) with ESMTP id t57HoTfQ070715 for ; Sun, 7 Jun 2015 17:50:29 GMT (envelope-from def@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.9/8.14.9/Submit) id t57HoSZW070713 for svn-soc-all@FreeBSD.org; Sun, 7 Jun 2015 17:50:28 GMT (envelope-from def@FreeBSD.org) Date: Sun, 7 Jun 2015 17:50:28 GMT Message-Id: <201506071750.t57HoSZW070713@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to def@FreeBSD.org using -f From: def@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r286798 - soc2013/def/crashdump-head/sys/kern MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jun 2015 17:50:29 -0000 Author: def Date: Sun Jun 7 17:50:28 2015 New Revision: 286798 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=286798 Log: Don't allow to read keys via sysctl(8). Modified: soc2013/def/crashdump-head/sys/kern/kern_shutdown.c Modified: soc2013/def/crashdump-head/sys/kern/kern_shutdown.c ============================================================================== --- soc2013/def/crashdump-head/sys/kern/kern_shutdown.c Sun Jun 7 17:40:48 2015 (r286797) +++ soc2013/def/crashdump-head/sys/kern/kern_shutdown.c Sun Jun 7 17:50:28 2015 (r286798) @@ -891,9 +891,12 @@ { int error; + if (req->newptr == NULL) + return (EPERM); + error = sysctl_handle_opaque(oidp, dumpcrypto.kdc_key, sizeof(dumpcrypto.kdc_key), req); - if (req->newptr == NULL || error != 0) + if (error != 0) return (error); arc4rand(dumpcrypto.kdc_iv, sizeof(dumpcrypto.kdc_iv), 0); @@ -908,13 +911,8 @@ size_t encryptedkeylen, kdksize; int error; - if (req->newptr == NULL) { - if (dumpkey == NULL) - return (0); - - return (sysctl_handle_opaque(oidp, dumpkey->kdk_encryptedkey, - dumpkey->kdk_encryptedkeylen, req)); - } + if (req->newptr == NULL) + return (EPERM); encryptedkeylen = req->newlen; kdksize = ((sizeof(*kdk) + encryptedkeylen +