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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADnq5_P3xDDi-MS2PkAA7paAOQ3f7DQ8+sL6W7O5HcWTFQ0BSg@mail.gmail.com>
Date:   Mon, 25 Sep 2023 10:14:28 -0400
From:   Alex Deucher <alexdeucher@...il.com>
To:     Christian König <christian.koenig@....com>
Cc:     Kees Cook <keescook@...omium.org>,
        David Airlie <airlied@...il.com>,
        Tejas Upadhyay <tejas.upadhyay@...el.com>,
        Emma Anholt <emma@...olt.net>, Tom Rix <trix@...hat.com>,
        llvm@...ts.linux.dev, 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>,
        Karol Herbst <kherbst@...hat.com>,
        Neil Armstrong <neil.armstrong@...aro.org>,
        amd-gfx@...ts.freedesktop.org,
        Kuogee Hsieh <quic_khsieh@...cinc.com>,
        Nathan Chancellor <nathan@...nel.org>,
        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>,
        virtualization@...ts.linux-foundation.org,
        linux-hardening@...r.kernel.org, Lijo Lazar <lijo.lazar@....com>,
        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>,
        Melissa Wen <mwen@...lia.com>,
        Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
        Gurchetan Singh <gurchetansingh@...omium.org>,
        Maxime Ripard <mripard@...nel.org>,
        Rodrigo Vivi <rodrigo.vivi@...el.com>,
        Evan Quan <evan.quan@....com>, Sean Paul <sean@...rly.run>,
        Tvrtko Ursulin <tvrtko.ursulin@...ux.intel.com>,
        Xiaojian Du <Xiaojian.Du@....com>, Le Ma <le.ma@....com>,
        freedreno@...ts.freedesktop.org,
        Bjorn Andersson <andersson@...nel.org>,
        "Pan, Xinhui" <Xinhui.Pan@....com>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        linux-kernel@...r.kernel.org,
        Alex Deucher <alexander.deucher@....com>,
        Nirmoy Das <nirmoy.das@...el.com>, Lang Yu <Lang.Yu@....com>,
        John Harrison <john.c.harrison@...el.com>,
        Hawking Zhang <Hawking.Zhang@....com>
Subject: Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table
 with __counted_by

On Mon, Sep 25, 2023 at 10:07 AM Alex Deucher <alexdeucher@...il.com> wrote:
>
> On Mon, Sep 25, 2023 at 2:30 AM Christian König
> <christian.koenig@....com> wrote:
> >
> > Am 22.09.23 um 19:41 schrieb Alex Deucher:
> > > On Fri, Sep 22, 2023 at 1:32 PM Kees Cook <keescook@...omium.org> wrote:
> > >> Prepare 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 for struct smu10_voltage_dependency_table.
> > >>
> > >> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> > >>
> > >> Cc: Evan Quan <evan.quan@....com>
> > >> Cc: Alex Deucher <alexander.deucher@....com>
> > >> Cc: "Christian König" <christian.koenig@....com>
> > >> Cc: "Pan, Xinhui" <Xinhui.Pan@....com>
> > >> Cc: David Airlie <airlied@...il.com>
> > >> Cc: Daniel Vetter <daniel@...ll.ch>
> > >> Cc: Xiaojian Du <Xiaojian.Du@....com>
> > >> Cc: Huang Rui <ray.huang@....com>
> > >> Cc: Kevin Wang <kevin1.wang@....com>
> > >> Cc: amd-gfx@...ts.freedesktop.org
> > >> Cc: dri-devel@...ts.freedesktop.org
> > >> Signed-off-by: Kees Cook <keescook@...omium.org>
> > > Acked-by: Alex Deucher <alexander.deucher@....com>
> >
> > Mhm, I'm not sure if this is a good idea. That is a structure filled in
> > by the firmware, isn't it?
> >
> > That would imply that we might need to byte swap count before it is
> > checkable.
>
> True. Good point.  Same for the other amdgpu patch.

Actually the other patch is fine.  That's just a local structure.

Alex

>
> Alex
>
> >
> > Regards,
> > Christian.
> >
> > >
> > >> ---
> > >>   drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h | 2 +-
> > >>   1 file changed, 1 insertion(+), 1 deletion(-)
> > >>
> > >> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> > >> index 808e0ecbe1f0..42adc2a3dcbc 100644
> > >> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> > >> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.h
> > >> @@ -192,7 +192,7 @@ struct smu10_clock_voltage_dependency_record {
> > >>
> > >>   struct smu10_voltage_dependency_table {
> > >>          uint32_t count;
> > >> -       struct smu10_clock_voltage_dependency_record entries[];
> > >> +       struct smu10_clock_voltage_dependency_record entries[] __counted_by(count);
> > >>   };
> > >>
> > >>   struct smu10_clock_voltage_information {
> > >> --
> > >> 2.34.1
> > >>
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ