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: <CAJ9a7VgcZP_Ck=ZJrHBi3uffYk-DNC=MV0q3CoAm2twrsoCgvA@mail.gmail.com>
Date: Thu, 20 Nov 2025 14:39:06 +0000
From: Mike Leach <mike.leach@...aro.org>
To: Leo Yan <leo.yan@....com>
Cc: James Clark <james.clark@...aro.org>, 
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jonathan Corbet <corbet@....net>, 
	Randy Dunlap <rdunlap@...radead.org>, coresight@...ts.linaro.org, 
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org, 
	linux-doc@...r.kernel.org
Subject: Re: [PATCH v5 03/13] coresight: Refactor etm4_config_timestamp_event()

Hi Leo,

On Thu, 20 Nov 2025 at 14:25, Leo Yan <leo.yan@....com> wrote:
>
> On Thu, Nov 20, 2025 at 02:18:21PM +0000, Coresight ML wrote:
>
> [...]
>
> > Maybe define a general macro but with extra checking:
> >
> >   #define TRCCNTCTLRn_RLDEVENT_MASK  GENMASK(15, 8)
> >
> >   #define ETM4_RS_SEL_EVENT(paired, sel) ({  \
> >       if (paired)                            \
> >           assert(!(sel & ~GENMASK(3, 0)));   \
> >       else                                   \
> >           assert(!(sel & ~GENMASK(4, 0)));   \
> >       FIELD_PREP(TRCCNTCTLRn_RLDEVENT_MASK,  \
> >                  ((paird << 7) | sel));      \
> >   })
>
> It'd be better to use BUILD_BUG_ON() instead of assert().

That is a decent option - except I would have ETM4_RS_SEL_EVENT(mask,
paired, sel) - so it can be used for every register that has the form
<REGNAME>_<EVENTFIEILD>_MASK

It is slightly vulnerable though if someone passes something that is
not 1/0 for paired - which is why I preferred the two separate macros.

Mike

-- 
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ