Received: from list by lists.gnu.org with archive (Exim 4.71) id 1c0NXF-0006W1-FC for mharc-grub-devel@gnu.org; Sat, 29 Oct 2016 02:54:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47269) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c0NXD-0006VF-3v for grub-devel@gnu.org; Sat, 29 Oct 2016 02:54:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c0NXA-00044C-2t for grub-devel@gnu.org; Sat, 29 Oct 2016 02:54:31 -0400 Received: from mail-lf0-x22b.google.com ([2a00:1450:4010:c07::22b]:33210) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c0NX9-00043O-Ra for grub-devel@gnu.org; Sat, 29 Oct 2016 02:54:28 -0400 Received: by mail-lf0-x22b.google.com with SMTP id x79so71302890lff.0 for ; Fri, 28 Oct 2016 23:54:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=XBPmh4q6jds3F2boBtIvnq4Tr7vylJSlbqlXmPCfqJ4=; b=d9kmuoQqIYNYxa0/8Z0XsIRApi5AYu72GtiHk24OuD2e0SHMHB7qIRpChN2954auzh J1eRC1U8nr4L7VAI+egc8mYLw2NvPotT9hXjyiCcHL2nMgacNtyxvF3G3jG6Ch7aGxy4 wZvAda3s2Myq7ZlNzIbHWT9iwGpseLbWplrGH81aEZAgYD+yA2EJlURZOQhrPhMoXKae LjDw0YvnUf/lLTKFBYf/AJjLbEuOE2S/KvcQw4Hr4/gFcYJg9BpWQeMez2FD2OJ7nhAi d6mHDjQfzPEPbBdImo+q4s0FyMdUBognbHYd3ArabD//6EpuxrF51WKfk3RzLMYlTrzE krfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=XBPmh4q6jds3F2boBtIvnq4Tr7vylJSlbqlXmPCfqJ4=; b=OPsq9r3ncJUzyerV3O64Vw1akyLMa3FXfu+D8+nuNqYwILGQW1pmksnV9XGyi8Y/Pc U7X09CLQ2nPsBnZif7oSwUsU6EANlpyawZA9YIMgCwrVNtbCluvJr3+52nXrxF9vmpXn 17aP7QYammh0JAYWxCKH6rCC3f70KytbkA1VTMrBXvXkRC9n1G+/Mc7bdyCE4sHFymGz EElHJKmoTJk68DU9nKOosS6N8QsfLMZ1QuEeoESCenu9wNdDtD3Buw1G9qISJIfhnX3Z /0pFRZcv/zkpxh4atCfNplJ+svtFfsOUYJGJjE6gse/dY74wTZnlfs2YBcX3ULwIduC1 fo5g== X-Gm-Message-State: ABUngveI4bdG5DfO8/Pr9MGzZc0me+tRQqcXL5VsijJfhUYucM2yY51FQC5ww6TyYZYB6w== X-Received: by 10.25.43.12 with SMTP id r12mr12349844lfr.104.1477724065831; Fri, 28 Oct 2016 23:54:25 -0700 (PDT) Received: from [192.168.1.44] (ppp109-252-90-112.pppoe.spdop.ru. [109.252.90.112]) by smtp.gmail.com with ESMTPSA id o77sm2558596lff.21.2016.10.28.23.54.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Oct 2016 23:54:25 -0700 (PDT) To: The development of GNU GRUB From: Andrei Borzenkov Subject: [RFD] match kernel and modules at run time X-Enigmail-Draft-Status: N1110 Message-ID: Date: Sat, 29 Oct 2016 09:54:24 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::22b X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Oct 2016 06:54:32 -0000 Distributions are usually using some distro-specific means to record bootloader location for future updates (like debconf, /etc/default/grub_installdevice or similar). Unfortunately those means are not widely known; but it is very easy to hit Internet post that recommends "grub-install /dev/sda" as ultimate grub repair tool. The problem is that this will work ... until next grub update. Then - depending on bootloader location recorded in distro configuration database - core.img used for booting starts to diverge from modules in /boot/grub. With unpredictable effects. Last confirmed example is here: https://forums.opensuse.org/showthread.php/520709-Opensuse-13-2-Howto-set-password-for-single-user-mode-in-grub2?p=2797852#post2797852 Anyone thinks this is a problem (I obviously do)? I see several possible steps to mitigate it. 1. Define grub install locations in /etc/default/grub and use them by grub-install. This way distributions can converge on using it, which makes grub-install more safe. Cons - users will still hit Internet articles that recommend explicit device names years from now. 2. Use some form of checksum and verify it during module load. Similar to what Linux kernel does. Pros - guarantees that module built for different kernel will fail to load, making it obvious instead of crashing in unpredictable way later. Cons - likely increases core size; and platform most susceptible to this issue is also one most sensitive to core size. 3. Variant of 3 - generate single random number on every build. Cons - reproducible builds; will block module loading even if they are binary compatible.