From owner-freebsd-questions@freebsd.org Sun Aug 5 16:10:58 2018 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 558E81056AC8 for ; Sun, 5 Aug 2018 16:10:58 +0000 (UTC) (envelope-from 4250.10.freebsd-questions=freebsd.org@email-od.com) Received: from s1-b0c6.socketlabs.email-od.com (s1-b0c6.socketlabs.email-od.com [142.0.176.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0442094455 for ; Sun, 5 Aug 2018 16:10:57 +0000 (UTC) (envelope-from 4250.10.freebsd-questions=freebsd.org@email-od.com) DKIM-Signature: v=1; a=rsa-sha256; d=email-od.com;i=@email-od.com;s=dkim; c=relaxed/relaxed; q=dns/txt; t=1533485458; x=1536077458; h=content-transfer-encoding:content-type:mime-version:references:in-reply-to:message-id:subject:cc:to:from:date:x-thread-info; bh=D6hkpTXbg3M6Byv+/bLNUSkRn7PNfm67ZIvJNWt5kbc=; b=cyr9NEYYT8VTlO66To1S/eDj2zwMEH4L4+8VRQqftRZR6mhvuYfgK1GjjmKgr1NhplVSyOhPfnBn6nZOaj+OVOVBM7YXDmpunXtIBu9ZABG6e7TSGuz95P9DhK3HJoW2L7vcnjCkAtWF8+X/IOd9xlQVnY/O0nEuSAz13rCd/jk= X-Thread-Info: NDI1MC4xMi4xOTUwMDAwMDEzMTU0YTEuZnJlZWJzZC1xdWVzdGlvbnM9ZnJlZWJzZC5vcmc= Received: from r1.sg.in.socketlabs.com (r1.sg.in.socketlabs.com [142.0.179.11]) by mxsg2.email-od.com with ESMTP(version=Tls12 cipher=Aes256 bits=256); Sun, 5 Aug 2018 12:10:50 -0400 Received: from smtp.lan.sohara.org (EMTPY [89.127.62.20]) by r1.sg.in.socketlabs.com with ESMTP(version=Tls12 cipher=Aes256 bits=256); Sun, 5 Aug 2018 12:10:50 -0400 Received: from [192.168.63.1] (helo=steve.lan.sohara.org) by smtp.lan.sohara.org with smtp (Exim 4.91 (FreeBSD)) (envelope-from ) id 1fmLcG-000NWe-IX; Sun, 05 Aug 2018 16:10:48 +0000 Date: Sun, 5 Aug 2018 17:10:49 +0100 From: Steve O'Hara-Smith To: freebsd-questions@freebsd.org Cc: Polytropon Subject: Re: Erase memory on shutdown Message-Id: <20180805171049.caf517319d391b429b087852@sohara.org> In-Reply-To: <20180805172503.e2479108.freebsd@edvax.de> References: <20180805172503.e2479108.freebsd@edvax.de> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd11.1) X-Clacks-Overhead: "GNU Terry Pratchett" Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2018 16:10:58 -0000 On Sun, 5 Aug 2018 17:25:03 +0200 Polytropon wrote: > This would imply that the kernel would finally have to > overwrite itself. How can control over zeroing memory > be maintained when the control program itself has been > overwritten? That was a classic exercise from 8080/Z80 days, it may be possible to adapt the technique to more modern processors provided there is still a mode in which 00 is a NOP. The essence of the technique involved setting the stack pointer to top of memory, zeroing a register and then jumping to a loop at the bottom of memory that pushed the register and jumped to zero. The ante-penulitmate step overwrites the jump destination with zero, which it was anyway. The penultimate push overwrites the jump instruction which causes the processor to execute NOPs all the way to top of memory and cycle round to the bottom of memory for the final push which overwrites the push instruction leaving the processor cycling through NOPs forever. -- Steve O'Hara-Smith