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: <Zykk2MJ4REGCaqVw@google.com>
Date: Mon, 4 Nov 2024 11:47:36 -0800
From: Namhyung Kim <namhyung@...nel.org>
To: Ian Rogers <irogers@...gle.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...hat.com>, Mark Rutland <mark.rutland@....com>,
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
	Jiri Olsa <jolsa@...nel.org>,
	Adrian Hunter <adrian.hunter@...el.com>,
	Kan Liang <kan.liang@...ux.intel.com>,
	James Clark <james.clark@...aro.org>,
	Howard Chu <howardchu95@...il.com>,
	Athira Jajeev <atrajeev@...ux.vnet.ibm.com>,
	Michael Petlan <mpetlan@...hat.com>,
	Veronika Molnarova <vmolnaro@...hat.com>,
	Dapeng Mi <dapeng1.mi@...ux.intel.com>,
	Thomas Richter <tmricht@...ux.ibm.com>,
	Ilya Leoshkevich <iii@...ux.ibm.com>,
	Colin Ian King <colin.i.king@...il.com>,
	Weilin Wang <weilin.wang@...el.com>,
	Andi Kleen <ak@...ux.intel.com>,
	Josh Poimboeuf <jpoimboe@...hat.com>, linux-kernel@...r.kernel.org,
	linux-perf-users@...r.kernel.org
Subject: Re: [PATCH v5 06/21] perf script: Move find_scripts to
 browser/scripts.c

On Thu, Oct 31, 2024 at 01:51:36PM -0700, Ian Rogers wrote:
> On Thu, Oct 31, 2024 at 12:18 PM Arnaldo Carvalho de Melo
> <acme@...nel.org> wrote:
> >
> > On Wed, Oct 30, 2024 at 06:42:37PM -0700, Ian Rogers wrote:
> > > The only use of find_scripts is in browser/scripts.c but the
> > > definition in builtin causes linking problems requiring a stub in
> > > python.c. Move the function to allow the stub to be removed.
> > >
> > > Rewrite the directory iteration to use openat so that large character
> > > arrays aren't needed. The arrays are warned about potential buffer
> > > overflows by GCC now that all the code exists in a single C file.
> >
> > Introducing is_directory_at() should be done as a prep patch, as the
> > rest of the patch below could end up being reverted after some other
> > patch used it, making the process more difficult.
> >
> > I mentioned cases like this in the past, so doing it again just for the
> > record.
> 
> This is highlighted in the commit message:
> ```
> Rewrite the directory iteration to use openat so that large character
> arrays aren't needed. The arrays are warned about potential buffer
> overflows by GCC now that all the code exists in a single C file.
> ```
> so without the change the code wouldn't build. The new is_directory_at
> function is effectively 2 statements fstatat and S_ISDIR on the
> result, it is put next to is_directory for consistency but could have
> been a static function in the only C file to use it.
> 
> For the record, patches introducing 2 line long functions can be
> excessively noisy, especially in a 21 patch series. There is always
> the declared but not used build error to worry about - here things
> couldn't just be simply moved due to triggering a different build
> error. Given the simplicity of the function here I made a decision not
> to split up the work - the commit message would likely be longer than
> the function. The work never intended to introduce is_directory_at but
> was forced into it through a desire not to disable compiler warnings.

This patch does more than just moving the code which can be easy to miss
something in the middle.  I think you can move the code as is without
introducing build errors and then add new changes like using openat() on
top (you may separate the change out of this series).  I think it's
ok to have a small change if it clearly has different semantics.

Thanks,
Namhyung


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ