lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202310050915.ABB0419C@keescook>
Date: Thu, 5 Oct 2023 09:16:21 -0700
From: Kees Cook <keescook@...omium.org>
To: Christian König <ckoenig.leichtzumerken@...il.com>
Cc: Christian König <christian.koenig@....com>,
	Alex Deucher <alexdeucher@...il.com>,
	David Airlie <airlied@...il.com>,
	"Pan, Xinhui" <Xinhui.Pan@....com>,
	Karol Herbst <kherbst@...hat.com>, Tom Rix <trix@...hat.com>,
	Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
	dri-devel@...ts.freedesktop.org,
	Chris Wilson <chris@...is-wilson.co.uk>,
	Prike Liang <Prike.Liang@....com>, Huang Rui <ray.huang@....com>,
	Gerd Hoffmann <kraxel@...hat.com>,
	Andrzej Hajda <andrzej.hajda@...el.com>,
	Marijn Suijten <marijn.suijten@...ainline.org>,
	Matthew Brost <matthew.brost@...el.com>,
	Evan Quan <evan.quan@....com>, Emma Anholt <emma@...olt.net>,
	amd-gfx@...ts.freedesktop.org,
	Kuogee Hsieh <quic_khsieh@...cinc.com>,
	Lijo Lazar <lijo.lazar@....com>,
	VMware Graphics Reviewers <linux-graphics-maintainer@...are.com>,
	Ben Skeggs <bskeggs@...hat.com>,
	Andi Shyti <andi.shyti@...ux.intel.com>,
	nouveau@...ts.freedesktop.org, David Airlie <airlied@...hat.com>,
	Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
	Chia-I Wu <olvaffe@...il.com>, llvm@...ts.linux.dev,
	Yifan Zhang <yifan1.zhang@....com>, linux-arm-msm@...r.kernel.org,
	intel-gfx@...ts.freedesktop.org, Kevin Wang <kevin1.wang@....com>,
	Abhinav Kumar <quic_abhinavk@...cinc.com>,
	Jani Nikula <jani.nikula@...ux.intel.com>,
	Tvrtko Ursulin <tvrtko.ursulin@...ux.intel.com>,
	Nathan Chancellor <nathan@...nel.org>, Le Ma <le.ma@....com>,
	Gurchetan Singh <gurchetansingh@...omium.org>,
	Maxime Ripard <mripard@...nel.org>,
	Rodrigo Vivi <rodrigo.vivi@...el.com>,
	virtualization@...ts.linux-foundation.org,
	Sean Paul <sean@...rly.run>,
	Neil Armstrong <neil.armstrong@...aro.org>,
	Xiaojian Du <Xiaojian.Du@....com>, Lang Yu <Lang.Yu@....com>,
	Bjorn Andersson <andersson@...nel.org>,
	Tejas Upadhyay <tejas.upadhyay@...el.com>,
	Nick Desaulniers <ndesaulniers@...gle.com>,
	linux-kernel@...r.kernel.org, Hawking Zhang <Hawking.Zhang@....com>,
	Rob Clark <robdclark@...il.com>, Melissa Wen <mwen@...lia.com>,
	John Harrison <john.c.harrison@...el.com>,
	Daniel Vetter <daniel@...ll.ch>,
	Alex Deucher <alexander.deucher@....com>,
	Nirmoy Das <nirmoy.das@...el.com>, freedreno@...ts.freedesktop.org,
	Zack Rusin <zackr@...are.com>, linux-hardening@...r.kernel.org
Subject: Re: [PATCH 0/9] drm: Annotate structs with __counted_by

On Thu, Oct 05, 2023 at 11:42:38AM +0200, Christian König wrote:
> Am 02.10.23 um 20:22 schrieb Kees Cook:
> > On Mon, Oct 02, 2023 at 08:11:41PM +0200, Christian König wrote:
> > > Am 02.10.23 um 20:08 schrieb Kees Cook:
> > > > On Mon, Oct 02, 2023 at 08:01:57PM +0200, Christian König wrote:
> > > > > Am 02.10.23 um 18:53 schrieb Kees Cook:
> > > > > > On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote:
> > > > > > > On Mon, Oct 2, 2023 at 5:20 AM Christian König
> > > > > > > <ckoenig.leichtzumerken@...il.com> wrote:
> > > > > > > > Am 29.09.23 um 21:33 schrieb Kees Cook:
> > > > > > > > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote:
> > > > > > > > > > This is a batch of patches touching drm for preparing for the coming
> > > > > > > > > > implementation by GCC and Clang of the __counted_by attribute. Flexible
> > > > > > > > > > array members annotated with __counted_by can have their accesses
> > > > > > > > > > bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array
> > > > > > > > > > indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions).
> > > > > > > > > > 
> > > > > > > > > > As found with Coccinelle[1], add __counted_by to structs that would
> > > > > > > > > > benefit from the annotation.
> > > > > > > > > > 
> > > > > > > > > > [...]
> > > > > > > > > Since this got Acks, I figure I should carry it in my tree. Let me know
> > > > > > > > > if this should go via drm instead.
> > > > > > > > > 
> > > > > > > > > Applied to for-next/hardening, thanks!
> > > > > > > > > 
> > > > > > > > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
> > > > > > > > >           https://git.kernel.org/kees/c/a6046ac659d6
> > > > > > > > STOP! In a follow up discussion Alex and I figured out that this won't work.
> > > > > > I'm so confused; from the discussion I saw that Alex said both instances
> > > > > > were false positives?
> > > > > > 
> > > > > > > > The value in the structure is byte swapped based on some firmware
> > > > > > > > endianness which not necessary matches the CPU endianness.
> > > > > > > SMU10 is APU only so the endianess of the SMU firmware and the CPU
> > > > > > > will always match.
> > > > > > Which I think is what is being said here?
> > > > > > 
> > > > > > > > Please revert that one from going upstream if it's already on it's way.
> > > > > > > > 
> > > > > > > > And because of those reasons I strongly think that patches like this
> > > > > > > > should go through the DRM tree :)
> > > > > > Sure, that's fine -- please let me know. It was others Acked/etc. Who
> > > > > > should carry these patches?
> > > > > Probably best if the relevant maintainer pick them up individually.
> > > > > 
> > > > > Some of those structures are filled in by firmware/hardware and only the
> > > > > maintainers can judge if that value actually matches what the compiler
> > > > > needs.
> > > > > 
> > > > > We have cases where individual bits are used as flags or when the size is
> > > > > byte swapped etc...
> > > > > 
> > > > > Even Alex and I didn't immediately say how and where that field is actually
> > > > > used and had to dig that up. That's where the confusion came from.
> > > > Okay, I've dropped them all from my tree. Several had Acks/Reviews, so
> > > > hopefully those can get picked up for the DRM tree?
> > > I will pick those up to go through drm-misc-next.
> > > 
> > > Going to ping maintainers once more when I'm not sure if stuff is correct or
> > > not.
> > Sounds great; thanks!
> 
> I wasn't 100% sure for the VC4 patch, but pushed the whole set to
> drm-misc-next anyway.
> 
> This also means that the patches are now auto merged into the drm-tip
> integration branch and should any build or unit test go boom we should
> notice immediately and can revert it pretty easily.

Thanks very much; I'll keep an eye out for any reports.

-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ