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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Wed, 21 Jun 2023 15:43:48 +0200
From: Joel Granados <j.granados@...sung.com>
To: Jani Nikula <jani.nikula@...ux.intel.com>
CC: <mcgrof@...nel.org>, Russell King <linux@...linux.org.uk>, Catalin
	Marinas <catalin.marinas@....com>, Will Deacon <will@...nel.org>, Michael
	Ellerman <mpe@...erman.id.au>, Heiko Carstens <hca@...ux.ibm.com>, Vasily
	Gorbik <gor@...ux.ibm.com>, Alexander Gordeev <agordeev@...ux.ibm.com>,
	Gerald Schaefer <gerald.schaefer@...ux.ibm.com>, Andy Lutomirski
	<luto@...nel.org>, Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar
	<mingo@...hat.com>, Borislav Petkov <bp@...en8.de>, Dave Hansen
	<dave.hansen@...ux.intel.com>, <x86@...nel.org>, Herbert Xu
	<herbert@...dor.apana.org.au>, "David S. Miller" <davem@...emloft.net>, Russ
	Weight <russell.h.weight@...el.com>, Greg Kroah-Hartman
	<gregkh@...uxfoundation.org>, Phillip Potter <phil@...lpotter.co.uk>,
	Clemens Ladisch <clemens@...isch.de>, Arnd Bergmann <arnd@...db.de>, Corey
	Minyard <minyard@....org>, Theodore Ts'o <tytso@....edu>, "Jason A.
 Donenfeld" <Jason@...c4.com>, Joonas Lahtinen
	<joonas.lahtinen@...ux.intel.com>, Rodrigo Vivi <rodrigo.vivi@...el.com>,
	Tvrtko Ursulin <tvrtko.ursulin@...ux.intel.com>, David Airlie
	<airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>, "K. Y. Srinivasan"
	<kys@...rosoft.com>, Haiyang Zhang <haiyangz@...rosoft.com>, Wei Liu
	<wei.liu@...nel.org>, Dexuan Cui <decui@...rosoft.com>, Jason Gunthorpe
	<jgg@...pe.ca>, Leon Romanovsky <leon@...nel.org>, Benjamin Herrenschmidt
	<benh@...nel.crashing.org>, Song Liu <song@...nel.org>, Robin Holt
	<robinmholt@...il.com>, Steve Wahl <steve.wahl@....com>, David Ahern
	<dsahern@...nel.org>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
	<kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Sudip Mukherjee
	<sudipm.mukherjee@...il.com>, Mark Rutland <mark.rutland@....com>, "James
 E.J. Bottomley" <jejb@...ux.ibm.com>, "Martin K. Petersen"
	<martin.petersen@...cle.com>, Doug Gilbert <dgilbert@...erlog.com>, Jiri
	Slaby <jirislaby@...nel.org>, Juergen Gross <jgross@...e.com>, Stefano
	Stabellini <sstabellini@...nel.org>, Alexander Viro
	<viro@...iv.linux.org.uk>, Christian Brauner <brauner@...nel.org>, Benjamin
	LaHaise <bcrl@...ck.org>, David Howells <dhowells@...hat.com>, Jan Harkes
	<jaharkes@...cmu.edu>, <coda@...cmu.edu>, Trond Myklebust
	<trond.myklebust@...merspace.com>, Anna Schumaker <anna@...nel.org>, Chuck
	Lever <chuck.lever@...cle.com>, Jeff Layton <jlayton@...nel.org>, Jan Kara
	<jack@...e.cz>, Anton Altaparmakov <anton@...era.com>, Mark Fasheh
	<mark@...heh.com>, Joel Becker <jlbec@...lplan.org>, Joseph Qi
	<joseph.qi@...ux.alibaba.com>, Kees Cook <keescook@...omium.org>, Iurii
	Zaikin <yzaikin@...gle.com>, Eric Biggers <ebiggers@...nel.org>, "Darrick J.
 Wong" <djwong@...nel.org>, Alexei Starovoitov <ast@...nel.org>, Daniel
	Borkmann <daniel@...earbox.net>, Andrii Nakryiko <andrii@...nel.org>, Balbir
	Singh <bsingharora@...il.com>, Eric Biederman <ebiederm@...ssion.com>,
	"Naveen N. Rao" <naveen.n.rao@...ux.ibm.com>, Anil S Keshavamurthy
	<anil.s.keshavamurthy@...el.com>, Masami Hiramatsu <mhiramat@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>, Petr Mladek <pmladek@...e.com>,
	Sergey Senozhatsky <senozhatsky@...omium.org>, Juri Lelli
	<juri.lelli@...hat.com>, Vincent Guittot <vincent.guittot@...aro.org>, John
	Stultz <jstultz@...gle.com>, Steven Rostedt <rostedt@...dmis.org>, Andrew
	Morton <akpm@...ux-foundation.org>, Mike Kravetz <mike.kravetz@...cle.com>,
	Muchun Song <muchun.song@...ux.dev>, Naoya Horiguchi
	<naoya.horiguchi@....com>, "Matthew Wilcox (Oracle)" <willy@...radead.org>,
	Joerg Reuter <jreuter@...na.de>, Ralf Baechle <ralf@...ux-mips.org>, Pablo
	Neira Ayuso <pablo@...filter.org>, Jozsef Kadlecsik <kadlec@...filter.org>,
	Florian Westphal <fw@...len.de>, Roopa Prabhu <roopa@...dia.com>, Nikolay
	Aleksandrov <razor@...ckwall.org>, Alexander Aring <alex.aring@...il.com>,
	Stefan Schmidt <stefan@...enfreihafen.org>, Miquel Raynal
	<miquel.raynal@...tlin.com>, Steffen Klassert
	<steffen.klassert@...unet.com>, Matthieu Baerts
	<matthieu.baerts@...sares.net>, Mat Martineau <martineau@...nel.org>, Simon
	Horman <horms@...ge.net.au>, Julian Anastasov <ja@....bg>, Remi
	Denis-Courmont <courmisch@...il.com>, Santosh Shilimkar
	<santosh.shilimkar@...cle.com>, Marc Dionne <marc.dionne@...istor.com>, Neil
	Horman <nhorman@...driver.com>, Marcelo Ricardo Leitner
	<marcelo.leitner@...il.com>, Xin Long <lucien.xin@...il.com>, Karsten Graul
	<kgraul@...ux.ibm.com>, Wenjia Zhang <wenjia@...ux.ibm.com>, Jan Karcher
	<jaka@...ux.ibm.com>, Jon Maloy <jmaloy@...hat.com>, Ying Xue
	<ying.xue@...driver.com>, Martin Schiller <ms@....tdt.de>, John Johansen
	<john.johansen@...onical.com>, Paul Moore <paul@...l-moore.com>, James
	Morris <jmorris@...ei.org>, "Serge E. Hallyn" <serge@...lyn.com>, Jarkko
	Sakkinen <jarkko@...nel.org>, Nicholas Piggin <npiggin@...il.com>,
	Christophe Leroy <christophe.leroy@...roup.eu>, Christian Borntraeger
	<borntraeger@...ux.ibm.com>, Sven Schnelle <svens@...ux.ibm.com>, "H. Peter
 Anvin" <hpa@...or.com>, "Rafael J. Wysocki" <rafael@...nel.org>, Mike Travis
	<mike.travis@....com>, Oleksandr Tyshchenko <oleksandr_tyshchenko@...m.com>,
	Amir Goldstein <amir73il@...il.com>, Matthew Bobrowski <repnop@...gle.com>,
	John Fastabend <john.fastabend@...il.com>, Martin KaFai Lau
	<martin.lau@...ux.dev>, Yonghong Song <yhs@...com>, KP Singh
	<kpsingh@...nel.org>, Stanislav Fomichev <sdf@...gle.com>, Hao Luo
	<haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>, Waiman Long
	<longman@...hat.com>, Boqun Feng <boqun.feng@...il.com>, John Ogness
	<john.ogness@...utronix.de>, Dietmar Eggemann <dietmar.eggemann@....com>,
	Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>, Daniel
	Bristot de Oliveira <bristot@...hat.com>, Valentin Schneider
	<vschneid@...hat.com>, Andy Lutomirski <luto@...capital.net>, Will Drewry
	<wad@...omium.org>, Stephen Boyd <sboyd@...nel.org>, Miaohe Lin
	<linmiaohe@...wei.com>, <linux-arm-kernel@...ts.infradead.org>,
	<linux-kernel@...r.kernel.org>, <linux-ia64@...r.kernel.org>,
	<linuxppc-dev@...ts.ozlabs.org>, <linux-s390@...r.kernel.org>,
	<linux-crypto@...r.kernel.org>, <openipmi-developer@...ts.sourceforge.net>,
	<intel-gfx@...ts.freedesktop.org>, <dri-devel@...ts.freedesktop.org>,
	<linux-hyperv@...r.kernel.org>, <linux-rdma@...r.kernel.org>,
	<linux-raid@...r.kernel.org>, <netdev@...r.kernel.org>,
	<linux-scsi@...r.kernel.org>, <xen-devel@...ts.xenproject.org>,
	<linux-fsdevel@...r.kernel.org>, <linux-aio@...ck.org>,
	<linux-cachefs@...hat.com>, <codalist@...emann.coda.cs.cmu.edu>,
	<linux-mm@...ck.org>, <linux-nfs@...r.kernel.org>,
	<linux-ntfs-dev@...ts.sourceforge.net>, <ocfs2-devel@....oracle.com>,
	<fsverity@...ts.linux.dev>, <linux-xfs@...r.kernel.org>,
	<bpf@...r.kernel.org>, <kexec@...ts.infradead.org>,
	<linux-trace-kernel@...r.kernel.org>, <linux-hams@...r.kernel.org>,
	<netfilter-devel@...r.kernel.org>, <coreteam@...filter.org>,
	<bridge@...ts.linux-foundation.org>, <dccp@...r.kernel.org>,
	<linux-wpan@...r.kernel.org>, <mptcp@...ts.linux.dev>,
	<lvs-devel@...r.kernel.org>, <rds-devel@....oracle.com>,
	<linux-afs@...ts.infradead.org>, <linux-sctp@...r.kernel.org>,
	<tipc-discussion@...ts.sourceforge.net>, <linux-x25@...r.kernel.org>,
	<apparmor@...ts.ubuntu.com>, <linux-security-module@...r.kernel.org>,
	<keyrings@...r.kernel.org>
Subject: Re: [PATCH 09/11] sysctl: Remove the end element in sysctl table
 arrays

On Wed, Jun 21, 2023 at 04:15:46PM +0300, Jani Nikula wrote:
> On Wed, 21 Jun 2023, Joel Granados <j.granados@...sung.com> wrote:
> > On Wed, Jun 21, 2023 at 02:16:55PM +0300, Jani Nikula wrote:
> >> On Wed, 21 Jun 2023, Joel Granados <j.granados@...sung.com> wrote:
> >> > Remove the empty end element from all the arrays that are passed to the
> >> > register sysctl calls. In some files this means reducing the explicit
> >> > array size by one. Also make sure that we are using the size in
> >> > ctl_table_header instead of evaluating the .procname element.
> >> 
> >> Where's the harm in removing the end elements driver by driver? This is
> >> an unwieldy patch to handle.
> >
> > I totally agree. Its a big one!!! but I'm concerned of breaking bisectibility:
> > * I could for example separate all the removes into separate commits and
> >   then have a final commit that removes the check for the empty element.
> >   But this will leave the tree in a state where the for loop will have
> >   undefined behavior when it looks for the empty end element. It might
> >   or might not work (probably not :) until the final commit where I fix
> >   that.
> >
> > * I could also change the logic that looks for the final element,
> >   commit that first and then remove the empty element one commit per
> >   driver after that. But then for all the arrays that still have an
> >   empty element, there would again be undefined behavior as it would
> >   think that the last element is valid (when it is really the sentinel).
> >
> > Any ideas on how to get around these?
> 
> First add size to the register calls, and allow the last one to be
> sentinel but do not require the sentinel.
> 
> Start removing sentinels, adjusting the size passed in.
This is a great idea! and I think I don't even have to adjust the size
because if I change the logic to stop on the sentinel or the size; so when
the sentinel is there, it will stop before the size. And when the
sentinel is not there, it will stop on the correct size.

There might be issues with indirection calls. And there might also be
lots of places where I need to adjust a for loop (as dan has pointed
out) but its worth a try for V2.

Best
> 
> Once enough sentinels have been removed, add warning if the final entry
> is a sentinel.
> 
> Never really remove the check? (But surely you can rework the logic to
> not count the number of elements up front, only while iterating.)
> 
> 
> BR,
> Jani.
> 
> >> 
> >> > diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
> >> > index f43950219ffc..e4d7372afb10 100644
> >> > --- a/drivers/gpu/drm/i915/i915_perf.c
> >> > +++ b/drivers/gpu/drm/i915/i915_perf.c
> >> > @@ -4884,24 +4884,23 @@ int i915_perf_remove_config_ioctl(struct drm_device *dev, void *data,
> >> >  
> >> >  static struct ctl_table oa_table[] = {
> >> >  	{
> >> > -	 .procname = "perf_stream_paranoid",
> >> > -	 .data = &i915_perf_stream_paranoid,
> >> > -	 .maxlen = sizeof(i915_perf_stream_paranoid),
> >> > -	 .mode = 0644,
> >> > -	 .proc_handler = proc_dointvec_minmax,
> >> > -	 .extra1 = SYSCTL_ZERO,
> >> > -	 .extra2 = SYSCTL_ONE,
> >> > -	 },
> >> > +		.procname = "perf_stream_paranoid",
> >> > +		.data = &i915_perf_stream_paranoid,
> >> > +		.maxlen = sizeof(i915_perf_stream_paranoid),
> >> > +		.mode = 0644,
> >> > +		.proc_handler = proc_dointvec_minmax,
> >> > +		.extra1 = SYSCTL_ZERO,
> >> > +		.extra2 = SYSCTL_ONE,
> >> > +	},
> >> >  	{
> >> > -	 .procname = "oa_max_sample_rate",
> >> > -	 .data = &i915_oa_max_sample_rate,
> >> > -	 .maxlen = sizeof(i915_oa_max_sample_rate),
> >> > -	 .mode = 0644,
> >> > -	 .proc_handler = proc_dointvec_minmax,
> >> > -	 .extra1 = SYSCTL_ZERO,
> >> > -	 .extra2 = &oa_sample_rate_hard_limit,
> >> > -	 },
> >> > -	{}
> >> > +		.procname = "oa_max_sample_rate",
> >> > +		.data = &i915_oa_max_sample_rate,
> >> > +		.maxlen = sizeof(i915_oa_max_sample_rate),
> >> > +		.mode = 0644,
> >> > +		.proc_handler = proc_dointvec_minmax,
> >> > +		.extra1 = SYSCTL_ZERO,
> >> > +		.extra2 = &oa_sample_rate_hard_limit,
> >> > +	}
> >> >  };
> >> 
> >> The existing indentation is off, but fixing it doesn't really belong in
> >> this patch.
> >
> > Agreed. But I actually was trying to fix something that checkpatch
> > flagged. I'll change these back (which will cause this patch to be
> > flagged).
> >
> > An alternative solution would be to fix the indentation as part of the
> > preparation patches. Tell me what you think.
> >
> > Thx
> >
> >> 
> >> BR,
> >> Jani.
> >> 
> >> 
> >> -- 
> >> Jani Nikula, Intel Open Source Graphics Center
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center

-- 

Joel Granados

Download attachment "signature.asc" of type "application/pgp-signature" (660 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ