From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1iSdUn-0000zv-LD for mharc-grub-devel@gnu.org; Thu, 07 Nov 2019 03:50:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52571) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iSdUj-0000wo-CF for grub-devel@gnu.org; Thu, 07 Nov 2019 03:50:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iSdUe-0007DZ-5M for grub-devel@gnu.org; Thu, 07 Nov 2019 03:50:17 -0500 Received: from m9a0002g.houston.softwaregrp.com ([15.124.64.67]:39390) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iSdUd-00076r-UD for grub-devel@gnu.org; Thu, 07 Nov 2019 03:50:16 -0500 Received: FROM m9a0002g.houston.softwaregrp.com (15.121.0.190) BY m9a0002g.houston.softwaregrp.com WITH ESMTP; Thu, 7 Nov 2019 08:49:36 +0000 Received: from M4W0334.microfocus.com (2002:f78:1192::f78:1192) by M9W0067.microfocus.com (2002:f79:be::f79:be) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Thu, 7 Nov 2019 08:48:01 +0000 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (15.124.8.10) by M4W0334.microfocus.com (15.120.17.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10 via Frontend Transport; Thu, 7 Nov 2019 08:48:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AGpFs7GtScgeo4MkqZ9294DaRSPHMpUtzO/pJsK8dWrFfT0RgEuBHDbsm5MWu6J+jIbDscnEyKWPpZuUw+8CfYUilcOK/ER3u5CIO02SSvpF8+PGOIUiaVSjC7viGHcVdEliZkqCPnA5lsCjtF8+xl50kDVIcb/Aaa7LEWY267BjSaSeNPUcmggo9pcJ5I1bK9NLqovyBrp1Ks0R4o6yg5zYR2+TIF2/AsQmXINCPqcDASDST8E1ve8ZCJXTaumt3ukimHjt9vnX6bVjy37mmAkLWN1KwTWGW1aNEGrF3xqnfq+IGHAmI65n7KBb+m1a4D0BSwSa+vHExz9OMVwWjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=15vjV591rPV+SadOVTGqcgigRh5vrgo9aYQfetTyrB0=; b=eJDZbhhycytjxbFewi7oSeh1qphyPjQk9cKk+whxfEdRePmJa6eod7oLo6LXZuoVfIDIiEG3U9GSFfQoJn1iwsTZzFovd7NGNvmsOPfRGAiJmqP8a1W7fmGoVGbJ9wmCknoeT4/GzHGl68aEYH0gbH8GUoqORBBJdFNIw+2LjgbRSQY6sPzJGuyPTIf9USb3FPu15B9LnGcVinS/L2Qw5BZZG8R+T8rYMkAw0FOtLf7JwFgkpYn98xCI530yAwAxOGtoq7bwXVKqfGKlQaBFrwaySclMbZFB2xRCSinXH/YaU5lxvziaH8wv6BmlquXilvGbHzVYMg2zGawkT39ZsQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Received: from BY5PR18MB3122.namprd18.prod.outlook.com (10.255.139.11) by BY5PR18MB3363.namprd18.prod.outlook.com (10.255.139.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.22; Thu, 7 Nov 2019 08:48:00 +0000 Received: from BY5PR18MB3122.namprd18.prod.outlook.com ([fe80::297d:fc41:ae2a:13d9]) by BY5PR18MB3122.namprd18.prod.outlook.com ([fe80::297d:fc41:ae2a:13d9%5]) with mapi id 15.20.2408.025; Thu, 7 Nov 2019 08:48:00 +0000 From: Michael Chang To: Javier Martinez Canillas CC: The development of GNU GRUB Subject: Re: [PATCH] Warn the user to edit environment block by grub-editenv Thread-Topic: [PATCH] Warn the user to edit environment block by grub-editenv Thread-Index: AQHVk7o/DZpXh2WWoUSPNcKt1QLWkqd8dpsAgALyBoA= Date: Thu, 7 Nov 2019 08:48:00 +0000 Message-ID: <20191107084753.GD4084@mazu> References: <20191105092010.29652-1-mchang@suse.com> In-Reply-To: Accept-Language: zh-TW, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HK0PR01CA0072.apcprd01.prod.exchangelabs.com (2603:1096:203:a6::36) To BY5PR18MB3122.namprd18.prod.outlook.com (2603:10b6:a03:1af::11) authentication-results: spf=none (sender IP is ) smtp.mailfrom=MChang@suse.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [60.251.47.116] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2a12de7c-baa5-4c8b-8615-08d7635f319e x-ms-traffictypediagnostic: BY5PR18MB3363: x-ms-exchange-purlcount: 1 x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 0214EB3F68 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(4636009)(7916004)(396003)(346002)(366004)(39860400002)(376002)(136003)(199004)(189003)(305945005)(66556008)(7736002)(80792005)(86362001)(81166006)(316002)(6486002)(76176011)(33656002)(52116002)(1076003)(8676002)(66066001)(99286004)(6246003)(64756008)(4326008)(6116002)(3846002)(9686003)(6512007)(81156014)(8936002)(6916009)(6436002)(66446008)(6306002)(2906002)(229853002)(446003)(11346002)(486006)(5660300002)(476003)(66476007)(14454004)(102836004)(55236004)(71190400001)(256004)(14444005)(26005)(66946007)(186003)(386003)(6506007)(53546011)(33716001)(966005)(71200400001)(25786009)(478600001); DIR:OUT; SFP:1102; SCL:1; SRVR:BY5PR18MB3363; H:BY5PR18MB3122.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: suse.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: u3xfeC/duq6lgkELQcU6EgPDXdzGiJSN8PLiU6qD+e1xwGybr3qcvmJYz+rnnWv/vMBy2elkltBOCSlES+K8MRBWKwwg60xkn7LhW6hba66vsFSlC40HkpTQeHEl7ao4k6daeLcpKjh7wkq4LzMUCeivb1pA7ke8p0fK7IjMcEffKROHNOWI27LlmjUgmdsBtvS5stPWTBFGhHzolot/SRd29IHei9riifQr/Kze6Q0tGj+5GUxIw1ioxEjV0v8MLVfW5mHgVwBvgawI6KrlGdtP5MQebp0JjfkIoOIQOz76mJvLTunI69krofkOlEwW6+3vPoytL9LmG23dMUChsP/47a+J8cAYCzr3mxbQmabsfvu3g6ADXFsDRTcs4O8sXNIeYRgwxJQEli/vZ3wnrYQmIBsRMWZYhx1slXrDKZjIZ3CuJKDpcDtrzVmGJb7P2Q5OZ8BGbWf0kQAoMcddf4MMG9+8T5VJGVjhBHi9uoI= Content-Type: text/plain; charset="us-ascii" Content-ID: <53E9691E62B115468E1CDE59D921035E@namprd18.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 2a12de7c-baa5-4c8b-8615-08d7635f319e X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Nov 2019 08:48:00.5757 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 856b813c-16e5-49a5-85ec-6f081e13b527 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 1YjppZNQtQRsJqeJaC2AC9259LCwkXNp3akvd5/7q669Y6XN39L7my2X2BwVurWl X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR18MB3363 X-OriginatorOrg: suse.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 15.124.64.67 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 08:50:23 -0000 On Tue, Nov 05, 2019 at 12:49:08PM +0100, Javier Martinez Canillas wrote: > Hello Michael, >=20 > On 11/5/19 10:20 AM, Michael Chang wrote: > > The environment block is a preallocated 1024-byte file serves as persis= tent > > storage for environment variables. It has its own format which is sensi= tive to > > corruption if using editor doesn't know how to process it. Besides the = editor > > may inadvertantly change size allocation that could have it sparse the > > filesystem which could lead to unexpected outcome. > > >=20 > Yes, we also get reports about this issue: https://bugzilla.redhat.com/sh= ow_bug.cgi?id=3D1625124 > =20 > > This patch adds message in grubenv file to warn the user from editing i= t by > > tools other than grub-editenv. > >=20 >=20 > Agreed that users should be warned that the file should only be edited wi= th > the GRUB tools. >=20 > I also wonder if grub-editenv can't be made more robust and correct a gru= benv > file (i.e: filling the missing # characters / removing any extra # charac= ter) > if is found to be corrupted and not having the expected size. IMHO when people trying to read grubenv file they didn't expect the sanitization from happening, as that might be troublesome to describe problem if anyone wants to troubleshoot issue related to malformed grubenv which is just victim of filesystem corruption and like. I personally wouldn't mind if the function is provided as separate command and backup original file somewhere .. >=20 > > Signed-off-by: Michael Chang > > --- > > util/editenv.c | 12 +++++++++--- > > 1 file changed, 9 insertions(+), 3 deletions(-) > >=20 >=20 > The patch looks good to me. >=20 > Reviewed-by: Javier Martinez Canillas Thanks a lot for your feedback and review. :) Regards, Michael >=20 > Best regards, > --=20 > Javier Martinez Canillas > Software Engineer - Desktop Hardware Enablement > Red Hat