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: <20240807092936.1661ce6a@gandalf.local.home>
Date: Wed, 7 Aug 2024 09:29:36 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: "Tze-nan Wu (吳澤南)" <Tze-nan.Wu@...iatek.com>
Cc: "zanussi@...nel.org" <zanussi@...nel.org>,
 "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
 "linux-trace-kernel@...r.kernel.org" <linux-trace-kernel@...r.kernel.org>,
 "linux-mediatek@...ts.infradead.org" <linux-mediatek@...ts.infradead.org>,
 "Cheng-Jui Wang (王正睿)" <Cheng-Jui.Wang@...iatek.com>,
 wsd_upstream <wsd_upstream@...iatek.com>, "Bobule Chang (張弘義)" <bobule.chang@...iatek.com>, "mhiramat@...nel.org"
 <mhiramat@...nel.org>, "eric-yc.wu@...iatek.com" <eric-yc.wu@...iatek.com>,
 "mathieu.desnoyers@...icios.com" <mathieu.desnoyers@...icios.com>
Subject: Re: [PATCH RESEND] tracing: Fix overflow in get_free_elt()

On Wed, 7 Aug 2024 11:34:43 +0000
Tze-nan Wu (吳澤南) <Tze-nan.Wu@...iatek.com> wrote:

> > > -idx = atomic_inc_return(&map->next_elt);
> > > +idx = atomic_fetch_add_unless(&map->next_elt, 1, map->max_elts);  
> > 
> > I guess we need to add (with a comment):
> > 
> > idx--;
> >   
> Thanks for reviewing this!
> 
> By reference to "/include/linux/atomic/atomic-instrumented.h",
> `atomic_fetch_add_unless` will return the original value before the
> adding happens on operands.

Ah, right. I haven't used that before and was thinking this was the same as
the inc_return().

-- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ