From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751303AbdBWWKn (ORCPT ); Thu, 23 Feb 2017 17:10:43 -0500 Received: from mail.kernel.org ([198.145.29.136]:59628 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751207AbdBWWKl (ORCPT ); Thu, 23 Feb 2017 17:10:41 -0500 MIME-Version: 1.0 In-Reply-To: <58AF4D03.7020908@gmail.com> References: <20170214025040.23955-1-stephen.boyd@linaro.org> <58AF3E06.4030701@gmail.com> <58AF4D03.7020908@gmail.com> From: Rob Herring Date: Thu, 23 Feb 2017 16:09:40 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC/PATCH] of: Mark property::value as const To: Frank Rowand Cc: Stephen Boyd , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "devicetree@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 23, 2017 at 2:58 PM, Frank Rowand wrote: > On 02/23/17 11:54, Frank Rowand wrote: >> On 02/13/17 18:50, Stephen Boyd wrote: >>> The 'blob' we pass into populate_properties() is marked as const, >>> but we cast that const away when we assign the result of >>> fdt_getprop_by_offset() to pp->value. Let's mark value as const >>> instead, so that code can't mistakenly write to the value of the >>> property that we've so far advertised as const. >>> >>> Unfortunately, this exposes a problem with the fdt resolver code, >>> where we overwrite the value member of properties of phandles to >>> update them with their final value. Add a comment for now to >>> indicate where we're potentially writing over const data. >> >> The resolver should not be over writing anything in the FDT. I'll >> look at what is going on there. >> >> The FDT we expose to user space should be the FDT we booted with, >> not something later modified. > > It seems that /sys/firmware/fdt is not documented. I'll look into > fixing that. That's because the "official" interface is /proc/device-tree/ which is now a symlink. IIRC, it is documented to use /proc/device-tree, not the sysfs path. Rob From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rob Herring Subject: Re: [RFC/PATCH] of: Mark property::value as const Date: Thu, 23 Feb 2017 16:09:40 -0600 Message-ID: References: <20170214025040.23955-1-stephen.boyd@linaro.org> <58AF3E06.4030701@gmail.com> <58AF4D03.7020908@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: In-Reply-To: <58AF4D03.7020908-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Frank Rowand Cc: Stephen Boyd , "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" List-Id: devicetree@vger.kernel.org On Thu, Feb 23, 2017 at 2:58 PM, Frank Rowand wrote: > On 02/23/17 11:54, Frank Rowand wrote: >> On 02/13/17 18:50, Stephen Boyd wrote: >>> The 'blob' we pass into populate_properties() is marked as const, >>> but we cast that const away when we assign the result of >>> fdt_getprop_by_offset() to pp->value. Let's mark value as const >>> instead, so that code can't mistakenly write to the value of the >>> property that we've so far advertised as const. >>> >>> Unfortunately, this exposes a problem with the fdt resolver code, >>> where we overwrite the value member of properties of phandles to >>> update them with their final value. Add a comment for now to >>> indicate where we're potentially writing over const data. >> >> The resolver should not be over writing anything in the FDT. I'll >> look at what is going on there. >> >> The FDT we expose to user space should be the FDT we booted with, >> not something later modified. > > It seems that /sys/firmware/fdt is not documented. I'll look into > fixing that. That's because the "official" interface is /proc/device-tree/ which is now a symlink. IIRC, it is documented to use /proc/device-tree, not the sysfs path. Rob -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: robh+dt@kernel.org (Rob Herring) Date: Thu, 23 Feb 2017 16:09:40 -0600 Subject: [RFC/PATCH] of: Mark property::value as const In-Reply-To: <58AF4D03.7020908@gmail.com> References: <20170214025040.23955-1-stephen.boyd@linaro.org> <58AF3E06.4030701@gmail.com> <58AF4D03.7020908@gmail.com> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Thu, Feb 23, 2017 at 2:58 PM, Frank Rowand wrote: > On 02/23/17 11:54, Frank Rowand wrote: >> On 02/13/17 18:50, Stephen Boyd wrote: >>> The 'blob' we pass into populate_properties() is marked as const, >>> but we cast that const away when we assign the result of >>> fdt_getprop_by_offset() to pp->value. Let's mark value as const >>> instead, so that code can't mistakenly write to the value of the >>> property that we've so far advertised as const. >>> >>> Unfortunately, this exposes a problem with the fdt resolver code, >>> where we overwrite the value member of properties of phandles to >>> update them with their final value. Add a comment for now to >>> indicate where we're potentially writing over const data. >> >> The resolver should not be over writing anything in the FDT. I'll >> look at what is going on there. >> >> The FDT we expose to user space should be the FDT we booted with, >> not something later modified. > > It seems that /sys/firmware/fdt is not documented. I'll look into > fixing that. That's because the "official" interface is /proc/device-tree/ which is now a symlink. IIRC, it is documented to use /proc/device-tree, not the sysfs path. Rob