Re: [PATCH] thermal: core: Move initial num_trips assignment before memcpy()

2024-02-28 Thread Lukasz Luba
On 2/28/24 17:48, Kees Cook wrote: On Wed, Feb 28, 2024 at 09:56:51AM -0700, Nathan Chancellor wrote: On Wed, Feb 28, 2024 at 08:41:07AM +, Lukasz Luba wrote: Hi Nathan and Kees, On 2/27/24 17:00, Kees Cook wrote: On Tue, Feb 27, 2024 at 05:47:44PM +0100, Daniel Lezcano wrote: Ok my m

Re: [PATCH] thermal: core: Move initial num_trips assignment before memcpy()

2024-02-28 Thread Kees Cook
On Wed, Feb 28, 2024 at 09:56:51AM -0700, Nathan Chancellor wrote: > On Wed, Feb 28, 2024 at 08:41:07AM +, Lukasz Luba wrote: > > Hi Nathan and Kees, > > > > On 2/27/24 17:00, Kees Cook wrote: > > > On Tue, Feb 27, 2024 at 05:47:44PM +0100, Daniel Lezcano wrote: > > > > Ok my misunderstanding

Re: [PATCH] thermal: core: Move initial num_trips assignment before memcpy()

2024-02-28 Thread Nathan Chancellor
On Wed, Feb 28, 2024 at 08:41:07AM +, Lukasz Luba wrote: > Hi Nathan and Kees, > > On 2/27/24 17:00, Kees Cook wrote: > > On Tue, Feb 27, 2024 at 05:47:44PM +0100, Daniel Lezcano wrote: > > > Ok my misunderstanding was I thought sizeof() was calling _bdos under the > > > hood, so when calling

Re: [PATCH] thermal: core: Move initial num_trips assignment before memcpy()

2024-02-28 Thread Lukasz Luba
Hi Nathan and Kees, On 2/27/24 17:00, Kees Cook wrote: On Tue, Feb 27, 2024 at 05:47:44PM +0100, Daniel Lezcano wrote: Ok my misunderstanding was I thought sizeof() was calling _bdos under the hood, so when calling sizeof(flex_array), it was returning the computed size inferring from the __coun

Re: [PATCH] thermal: core: Move initial num_trips assignment before memcpy()

2024-02-27 Thread Kees Cook
On Tue, Feb 27, 2024 at 05:47:44PM +0100, Daniel Lezcano wrote: > Ok my misunderstanding was I thought sizeof() was calling _bdos under the > hood, so when calling sizeof(flex_array), it was returning the computed size > inferring from the __counted_by field. Yeah, sizeof() has a very limited scop

Re: [PATCH] thermal: core: Move initial num_trips assignment before memcpy()

2024-02-27 Thread Daniel Lezcano
On 27/02/2024 17:26, Kees Cook wrote: On Tue, Feb 27, 2024 at 04:37:36PM +0100, Daniel Lezcano wrote: On 27/02/2024 12:09, Rafael J. Wysocki wrote: On Tue, Feb 27, 2024 at 11:14 AM Daniel Lezcano wrote: On 27/02/2024 01:54, Nathan Chancellor wrote: When booting a CONFIG_FORTIFY_SOURCE=y ker

Re: [PATCH] thermal: core: Move initial num_trips assignment before memcpy()

2024-02-27 Thread Nathan Chancellor
Hi Daniel and Lukasz, On Tue, Feb 27, 2024 at 04:37:36PM +0100, Daniel Lezcano wrote: > On 27/02/2024 12:09, Rafael J. Wysocki wrote: > > On Tue, Feb 27, 2024 at 11:14 AM Daniel Lezcano > > wrote: > > > > > > On 27/02/2024 01:54, Nathan Chancellor wrote: > > > > When booting a CONFIG_FORTIFY_SOU

Re: [PATCH] thermal: core: Move initial num_trips assignment before memcpy()

2024-02-27 Thread Kees Cook
On Tue, Feb 27, 2024 at 04:37:36PM +0100, Daniel Lezcano wrote: > On 27/02/2024 12:09, Rafael J. Wysocki wrote: > > On Tue, Feb 27, 2024 at 11:14 AM Daniel Lezcano > > wrote: > > > > > > On 27/02/2024 01:54, Nathan Chancellor wrote: > > > > When booting a CONFIG_FORTIFY_SOURCE=y kernel compiled w

Re: [PATCH] thermal: core: Move initial num_trips assignment before memcpy()

2024-02-27 Thread Daniel Lezcano
On 27/02/2024 12:09, Rafael J. Wysocki wrote: On Tue, Feb 27, 2024 at 11:14 AM Daniel Lezcano wrote: On 27/02/2024 01:54, Nathan Chancellor wrote: When booting a CONFIG_FORTIFY_SOURCE=y kernel compiled with a toolchain that supports __counted_by() (such as clang-18 and newer), there is a pani

Re: [PATCH] thermal: core: Move initial num_trips assignment before memcpy()

2024-02-27 Thread Rafael J. Wysocki
On Tue, Feb 27, 2024 at 11:14 AM Daniel Lezcano wrote: > > On 27/02/2024 01:54, Nathan Chancellor wrote: > > When booting a CONFIG_FORTIFY_SOURCE=y kernel compiled with a toolchain > > that supports __counted_by() (such as clang-18 and newer), there is a > > panic on boot: > > > >[2.913770

Re: [PATCH] thermal: core: Move initial num_trips assignment before memcpy()

2024-02-27 Thread Rafael J. Wysocki
On Tue, Feb 27, 2024 at 3:08 AM Kees Cook wrote: > > On Mon, Feb 26, 2024 at 05:54:58PM -0700, Nathan Chancellor wrote: > > When booting a CONFIG_FORTIFY_SOURCE=y kernel compiled with a toolchain > > that supports __counted_by() (such as clang-18 and newer), there is a > > panic on boot: > > > >

Re: [PATCH] thermal: core: Move initial num_trips assignment before memcpy()

2024-02-27 Thread Daniel Lezcano
On 27/02/2024 01:54, Nathan Chancellor wrote: When booting a CONFIG_FORTIFY_SOURCE=y kernel compiled with a toolchain that supports __counted_by() (such as clang-18 and newer), there is a panic on boot: [2.913770] memcpy: detected buffer overflow: 72 byte write of buffer size 0 [2

Re: [PATCH] thermal: core: Move initial num_trips assignment before memcpy()

2024-02-27 Thread Lukasz Luba
Hi Nathan, On 2/27/24 00:54, Nathan Chancellor wrote: When booting a CONFIG_FORTIFY_SOURCE=y kernel compiled with a toolchain that supports __counted_by() (such as clang-18 and newer), there is a panic on boot: [2.913770] memcpy: detected buffer overflow: 72 byte write of buffer size 0

Re: [PATCH] thermal: core: Move initial num_trips assignment before memcpy()

2024-02-26 Thread Kees Cook
On Mon, Feb 26, 2024 at 05:54:58PM -0700, Nathan Chancellor wrote: > When booting a CONFIG_FORTIFY_SOURCE=y kernel compiled with a toolchain > that supports __counted_by() (such as clang-18 and newer), there is a > panic on boot: > > [2.913770] memcpy: detected buffer overflow: 72 byte write

[PATCH] thermal: core: Move initial num_trips assignment before memcpy()

2024-02-26 Thread Nathan Chancellor
When booting a CONFIG_FORTIFY_SOURCE=y kernel compiled with a toolchain that supports __counted_by() (such as clang-18 and newer), there is a panic on boot: [2.913770] memcpy: detected buffer overflow: 72 byte write of buffer size 0 [2.920834] WARNING: CPU: 2 PID: 1 at lib/string_helpe