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=fVMYQPe5qajj34P75oT17Wi_dymJy_DvhoLd7nR4yyX9w@mail.gmail.com>
Date: Sun, 26 Jan 2025 10:27:00 -0800
From: Ian Rogers <irogers@...gle.com>
To: Sasha Levin <sashal@...nel.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org, 
	Namhyung Kim <namhyung@...nel.org>, Arnaldo Carvalho de Melo <acme@...hat.com>, 
	Adrian Hunter <adrian.hunter@...el.com>, 
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Andi Kleen <ak@...ux.intel.com>, 
	Athira Rajeev <atrajeev@...ux.vnet.ibm.com>, Ben Gainey <ben.gainey@....com>, 
	Colin Ian King <colin.i.king@...il.com>, Dominique Martinet <asmadeus@...ewreck.org>, 
	Ilkka Koskinen <ilkka@...amperecomputing.com>, Ingo Molnar <mingo@...hat.com>, 
	James Clark <james.clark@...aro.org>, Jiri Olsa <jolsa@...nel.org>, 
	Kan Liang <kan.liang@...ux.intel.com>, Mark Rutland <mark.rutland@....com>, 
	Oliver Upton <oliver.upton@...ux.dev>, Paran Lee <p4ranlee@...il.com>, 
	Peter Zijlstra <peterz@...radead.org>, "Steinar H . Gunderson" <sesse@...gle.com>, 
	Steven Rostedt <rostedt@...dmis.org>, Thomas Falcon <thomas.falcon@...el.com>, 
	Weilin Wang <weilin.wang@...el.com>, Yang Jihong <yangjihong@...edance.com>, 
	Yang Li <yang.lee@...ux.alibaba.com>, Ze Gao <zegao2021@...il.com>, 
	Zixian Cai <fzczx123@...il.com>, zhaimingbing <zhaimingbing@...s.chinamobile.com>
Subject: Re: [PATCH AUTOSEL 6.13 06/16] tool api fs: Correctly encode errno
 for read/write open failures

On Sun, Jan 26, 2025 at 7:07 AM Sasha Levin <sashal@...nel.org> wrote:
>
> From: Ian Rogers <irogers@...gle.com>
>
> [ Upstream commit 05be17eed774aaf56f6b1e12714325ca3a266c04 ]
>
> Switch from returning -1 to -errno so that callers can determine types
> of failure.

Hi Sasha,

This change requires changes in the perf tool. The issue is the -1
gets written to perf.data files in the topology, the -errno value is
"corrupt." Because of this, I'd suggest not backporting this change.

Thanks,
Ian

> Reviewed-by: Namhyung Kim <namhyung@...nel.org>
> Signed-off-by: Ian Rogers <irogers@...gle.com>
> Acked-by: Arnaldo Carvalho de Melo <acme@...hat.com>
> Cc: Adrian Hunter <adrian.hunter@...el.com>
> Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
> Cc: Andi Kleen <ak@...ux.intel.com>
> Cc: Athira Rajeev <atrajeev@...ux.vnet.ibm.com>
> Cc: Ben Gainey <ben.gainey@....com>
> Cc: Colin Ian King <colin.i.king@...il.com>
> Cc: Dominique Martinet <asmadeus@...ewreck.org>
> Cc: Ilkka Koskinen <ilkka@...amperecomputing.com>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: James Clark <james.clark@...aro.org>
> Cc: Jiri Olsa <jolsa@...nel.org>
> Cc: Kan Liang <kan.liang@...ux.intel.com>
> Cc: Mark Rutland <mark.rutland@....com>
> Cc: Oliver Upton <oliver.upton@...ux.dev>
> Cc: Paran Lee <p4ranlee@...il.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Steinar H. Gunderson <sesse@...gle.com>
> Cc: Steven Rostedt (VMware) <rostedt@...dmis.org>
> Cc: Thomas Falcon <thomas.falcon@...el.com>
> Cc: Weilin Wang <weilin.wang@...el.com>
> Cc: Yang Jihong <yangjihong@...edance.com>
> Cc: Yang Li <yang.lee@...ux.alibaba.com>
> Cc: Ze Gao <zegao2021@...il.com>
> Cc: Zixian Cai <fzczx123@...il.com>
> Cc: zhaimingbing <zhaimingbing@...s.chinamobile.com>
> Link: https://lore.kernel.org/r/20241118225345.889810-3-irogers@google.com
> Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
> Signed-off-by: Sasha Levin <sashal@...nel.org>
> ---
>  tools/lib/api/fs/fs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
> index 337fde770e45f..edec23406dbc6 100644
> --- a/tools/lib/api/fs/fs.c
> +++ b/tools/lib/api/fs/fs.c
> @@ -296,7 +296,7 @@ int filename__read_int(const char *filename, int *value)
>         int fd = open(filename, O_RDONLY), err = -1;
>
>         if (fd < 0)
> -               return -1;
> +               return -errno;
>
>         if (read(fd, line, sizeof(line)) > 0) {
>                 *value = atoi(line);
> @@ -314,7 +314,7 @@ static int filename__read_ull_base(const char *filename,
>         int fd = open(filename, O_RDONLY), err = -1;
>
>         if (fd < 0)
> -               return -1;
> +               return -errno;
>
>         if (read(fd, line, sizeof(line)) > 0) {
>                 *value = strtoull(line, NULL, base);
> @@ -372,7 +372,7 @@ int filename__write_int(const char *filename, int value)
>         char buf[64];
>
>         if (fd < 0)
> -               return err;
> +               return -errno;
>
>         sprintf(buf, "%d", value);
>         if (write(fd, buf, sizeof(buf)) == sizeof(buf))
> --
> 2.39.5
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ