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: <CAP-5=fV96=Vtgzu6quGC5pHHL8JECHtvXzUJJgOxzc15=fKJRA@mail.gmail.com>
Date: Thu, 24 Jul 2025 08:05:05 -0700
From: Ian Rogers <irogers@...gle.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>, 
	Arnaldo Carvalho de Melo <acme@...nel.org>, 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>, Xu Yang <xu.yang_2@....com>, 
	"Masami Hiramatsu (Google)" <mhiramat@...nel.org>, Collin Funk <collin.funk1@...il.com>, 
	Howard Chu <howardchu95@...il.com>, Weilin Wang <weilin.wang@...el.com>, 
	Andi Kleen <ak@...ux.intel.com>, "Dr. David Alan Gilbert" <linux@...blig.org>, 
	Thomas Richter <tmricht@...ux.ibm.com>, Tiezhu Yang <yangtiezhu@...ngson.cn>, 
	Gautam Menghani <gautam@...ux.ibm.com>, Thomas Falcon <thomas.falcon@...el.com>, 
	Chun-Tse Shao <ctshao@...gle.com>, linux-kernel@...r.kernel.org, 
	linux-perf-users@...r.kernel.org, Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: Re: [PATCH v8 01/16] perf python: Add more exceptions on error paths

On Wed, Jul 23, 2025 at 5:40 PM Namhyung Kim <namhyung@...nel.org> wrote:
>
> On Wed, Jul 23, 2025 at 04:22:02PM -0700, Ian Rogers wrote:
> > Returning NULL will cause the python interpreter to fail but not
> > report an error. If none wants to be returned then Py_None needs
> > returning. Set the error for the cases returning NULL so that more
> > meaningful interpreter behavior is had.
>
> Nit: I still don't get what "add more exceptions" means.  What I'm
> seeing is adding more error messages.  Also returning NULL from this
> function won't pass it to the interpreter as the convert checks the
> return value.

So it isn't error messages, calling for example:

  PyErr_Format(PyExc_TypeError, "Unexpected header type %u",
event->header.type);

is like setting errno as in there is a global/thread-local current
exception object. When this is set/pending, returning any value will
cause the interpreter to throw an exception on return, so NULL is an
okay return value - normally for returning NULL you need to return
Py_NONE. Anyway, the old code was returning NULL but without the errno
like exception object set and so the interpreter was crashing/failing.

> But anyway, looks good to me.

Thanks,
Ian

> Thanks,
> Namhyung
>
> >
> > Signed-off-by: Ian Rogers <irogers@...gle.com>
> > Tested-by: Arnaldo Carvalho de Melo <acme@...hat.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ