From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754533AbdJIPHg (ORCPT ); Mon, 9 Oct 2017 11:07:36 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:45937 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754142AbdJIPHd (ORCPT ); Mon, 9 Oct 2017 11:07:33 -0400 X-Google-Smtp-Source: AOwi7QDti2pg8Q8txPufLr+/JYrfXNahGR5iV5D9XnS7HHdHCrg5lJZyT6ZbBT/t1jVUY1p2lBCJ7Q== Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [RFC] yamldt v0.5, now a DTS compiler too From: Pantelis Antoniou In-Reply-To: <20171009000053.GQ10050@umbus.fritz.box> Date: Mon, 9 Oct 2017 18:07:28 +0300 Cc: Frank Rowand , Rob Herring , Grant Likely , Tom Rini , Franklin S Cooper Jr , Matt Porter , Simon Glass , Phil Elwell , Geert Uytterhoeven , Marek Vasut , Devicetree Compiler , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" Message-Id: <8306BF82-3141-4994-8EFE-D5D2052F9FE1@konsulko.com> References: <1506628736.28192.9.camel@hp800z> <1506973580.17981.5.camel@hp800z> <1507039989.17981.25.camel@hp800z> <1507052352.17981.48.camel@hp800z> <4D25319A-34A8-4FE6-8B14-616686D2192A@konsulko.com> <59DAAFD3.9070900@gmail.com> <20171009000053.GQ10050@umbus.fritz.box> To: David Gibson X-Mailer: Apple Mail (2.3273) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v99F7fo2022810 Hi David, > On Oct 9, 2017, at 03:00 , David Gibson wrote: > > On Sun, Oct 08, 2017 at 04:08:03PM -0700, Frank Rowand wrote: >> On 10/07/17 03:23, Pantelis Antoniou wrote: >>> Hi Rob, >>> >>>> On Oct 6, 2017, at 16:55 , Rob Herring wrote: >>>> >>>> On Tue, Oct 3, 2017 at 12:39 PM, Pantelis Antoniou >>>> wrote: >>>>> Hi Rob, >> >> < snip > >> >>>>> eBPF is portable, can be serialized after compiling in the schema file >>>>> and can be executed in the kernel. >>>> >>>> Executing in the kernel is a non-goal for me. >> >> Executing in the kernel is an anti-goal for me. >> >> We are trying to reduce the device tree footprint inside the kernel, >> not increase it. >> >> 99.99% of the validation should be possible statically, in the compile >> phase. >> >> >>>>> By stripping out all documentation related properties and nodes keeping >>>>> only the compiled filters you can generate a dtb blob that passed to >>>>> kernel can be used for verification of all runtime changes in the >>>>> kernel's live tree. eBPF is enforcing an execution model that is 'safe' >>>>> so we can be sure that no foul play is possible. >> >> Run time changes can be assumed correct (short of bugs in the overlay >> application code), if the base tree is validated, the overlay is validated, >> and the interface between the live tree and the overlay is a >> connector. > > In addition, no amount of schema validation can really protect the > kernel from a bad DT. Even if the schemas can 100% verify that the DT > is "syntactically" correct, which is ambitious, it can't protect > against a DT which is in the right form, but contains information that > is simply wrong for the hardware in question. That can stuff the > kernel at least as easily as an incorrectly formatted DT. > I disagree. There are multiple levels of validation. For now we’re only talking about binding validation. There can be SoC level validation, board level validation, revision level validation and finally application specific validation. Binding validation is making sure properties/nodes follow the binding document. For instance that for a foo device there’s a mandatory interrupt property. Simplified interrupt = ; Binding validation would ‘catch’ errors like assigning a string or not having the interrupt property available. SoC level validation would list the available interrupt number that a given SoC would support for that device. For example that interrupt can only take the values 10 or 99 in a given SoC. Board level validation would narrow this down even further to a value of 10 for a given board model. Similar revision level validation would place further restriction on the allowed configuration. Finally application specific validation could place restriction based on the intended application that piece of hardware is used for. For instance devices that should not exceed a given power budget would have restrictions on the clock frequency of the processor or bus frequencies etc. > -- > David Gibson | I'll have my music baroque, and my code > david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ > | _way_ _around_! > http://www.ozlabs.org/~dgibson Regards — Pantelis From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pantelis Antoniou Subject: Re: [RFC] yamldt v0.5, now a DTS compiler too Date: Mon, 9 Oct 2017 18:07:28 +0300 Message-ID: <8306BF82-3141-4994-8EFE-D5D2052F9FE1@konsulko.com> References: <1506628736.28192.9.camel@hp800z> <1506973580.17981.5.camel@hp800z> <1507039989.17981.25.camel@hp800z> <1507052352.17981.48.camel@hp800z> <4D25319A-34A8-4FE6-8B14-616686D2192A@konsulko.com> <59DAAFD3.9070900@gmail.com> <20171009000053.GQ10050@umbus.fritz.box> Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20171009000053.GQ10050-K0bRW+63XPQe6aEkudXLsA@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: David Gibson Cc: Frank Rowand , Rob Herring , Grant Likely , Tom Rini , Franklin S Cooper Jr , Matt Porter , Simon Glass , Phil Elwell , Geert Uytterhoeven , Marek Vasut , Devicetree Compiler , "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" List-Id: devicetree@vger.kernel.org Hi David, > On Oct 9, 2017, at 03:00 , David Gibson = wrote: >=20 > On Sun, Oct 08, 2017 at 04:08:03PM -0700, Frank Rowand wrote: >> On 10/07/17 03:23, Pantelis Antoniou wrote: >>> Hi Rob, >>>=20 >>>> On Oct 6, 2017, at 16:55 , Rob Herring = wrote: >>>>=20 >>>> On Tue, Oct 3, 2017 at 12:39 PM, Pantelis Antoniou >>>> wrote: >>>>> Hi Rob, >>=20 >> < snip > >>=20 >>>>> eBPF is portable, can be serialized after compiling in the schema = file >>>>> and can be executed in the kernel. >>>>=20 >>>> Executing in the kernel is a non-goal for me. >>=20 >> Executing in the kernel is an anti-goal for me. >>=20 >> We are trying to reduce the device tree footprint inside the kernel, >> not increase it. >>=20 >> 99.99% of the validation should be possible statically, in the = compile >> phase. >>=20 >>=20 >>>>> By stripping out all documentation related properties and nodes = keeping >>>>> only the compiled filters you can generate a dtb blob that passed = to >>>>> kernel can be used for verification of all runtime changes in the >>>>> kernel's live tree. eBPF is enforcing an execution model that is = 'safe' >>>>> so we can be sure that no foul play is possible. >>=20 >> Run time changes can be assumed correct (short of bugs in the overlay >> application code), if the base tree is validated, the overlay is = validated, >> and the interface between the live tree and the overlay is a >> connector. >=20 > In addition, no amount of schema validation can really protect the > kernel from a bad DT. Even if the schemas can 100% verify that the DT > is "syntactically" correct, which is ambitious, it can't protect > against a DT which is in the right form, but contains information that > is simply wrong for the hardware in question. That can stuff the > kernel at least as easily as an incorrectly formatted DT. >=20 I disagree. There are multiple levels of validation. For now we=E2=80=99re only = talking about binding validation. There can be SoC level validation, board level = validation, revision level validation and finally application specific validation. Binding validation is making sure properties/nodes follow the binding = document. For instance that for a foo device there=E2=80=99s a mandatory interrupt = property. Simplified interrupt =3D ; Binding validation would =E2=80=98catch=E2=80=99 errors like assigning a = string or not having the interrupt property available. SoC level validation would list the available interrupt number that a = given SoC would support for that device. For example that interrupt can only take the values 10 or 99 in a given = SoC. Board level validation would narrow this down even further to a value of = 10 for a given board model. Similar revision level validation would place further restriction on the = allowed configuration. Finally application specific validation could place restriction based on = the intended application that piece of hardware is used for. For instance devices = that should not exceed a given power budget would have restrictions on the clock = frequency of the processor or bus frequencies etc. > --=20 > David Gibson | I'll have my music baroque, and my = code > david AT gibson.dropbear.id.au | minimalist, thank you. NOT = _the_ _other_ > | _way_ _around_! > http://www.ozlabs.org/~dgibson Regards =E2=80=94 Pantelis -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html