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: <Y1Z7/U0ld3QBSHol@kernel.org>
Date:   Mon, 24 Oct 2022 08:50:21 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Jiri Olsa <jolsa@...nel.org>, Yang Jihong <yangjihong1@...wei.com>
Cc:     peterz@...radead.org, mingo@...hat.com, mark.rutland@....com,
        alexander.shishkin@...ux.intel.com, namhyung@...nel.org,
        adrian.hunter@...el.com, ak@...ux.intel.com,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] perf daemon: Check err before calling
 setup_server_config in __cmd_start

Em Mon, Oct 24, 2022 at 08:46:44AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Sat, Oct 22, 2022 at 05:27:33PM +0800, Yang Jihong escreveu:
> > If err!=0 before calling setup_server_config and reconfig==true,
> > setup_server_config function may return 0 and err becomes 0.
> > As a result, previous error is overwritten, need to check value of err first.

Applied patches 2 and 3 meanwhile, thanks.

- Arnaldo

> > Signed-off-by: Yang Jihong <yangjihong1@...wei.com>
> > ---
> >  tools/perf/builtin-daemon.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/builtin-daemon.c b/tools/perf/builtin-daemon.c
> > index 6cb3f6cc36d0..b82bd902602a 100644
> > --- a/tools/perf/builtin-daemon.c
> > +++ b/tools/perf/builtin-daemon.c
> > @@ -1333,7 +1333,7 @@ static int __cmd_start(struct daemon *daemon, struct option parent_options[],
> >  			if (fda.entries[signal_pos].revents & POLLIN)
> >  				err = handle_signalfd(daemon) < 0;
> >  
> > -			if (reconfig)
> > +			if (!err && reconfig)
> >  				err = setup_server_config(daemon);
> >  		}
> 
> Expanding the context a bit:
> 
>         while (!done && !err) {
>                 err = daemon__reconfig(daemon);
> 
>                 if (!err && fdarray__poll(&fda, -1)) {
>                         bool reconfig = false;
> 
>                         if (fda.entries[sock_pos].revents & POLLIN)
>                                 err = handle_server_socket(daemon, sock_fd);
>                         if (fda.entries[file_pos].revents & POLLIN)
>                                 err = handle_config_changes(daemon, conf_fd, &reconfig);
>                         if (fda.entries[signal_pos].revents & POLLIN)
>                                 err = handle_signalfd(daemon) < 0;
> 
>                         if (!err && reconfig)
>                                 err = setup_server_config(daemon);
>                 }
>         }
> 
> The err you're checking may be the last one, that may have overwritten
> 'err' from handle_config_changes(), perhaps moving things around helps?
> I.e.:
>                 if (!err && fdarray__poll(&fda, -1)) {
>                         bool reconfig = false;
> 
>                         if (fda.entries[sock_pos].revents & POLLIN)
>                                 err = handle_server_socket(daemon, sock_fd);
>                         if (fda.entries[signal_pos].revents & POLLIN)
>                                 err = handle_signalfd(daemon) < 0;
>                         if (fda.entries[file_pos].revents & POLLIN)
>                                 err = handle_config_changes(daemon, conf_fd, &reconfig);
> 
>                         if (!err && reconfig)
>                                 err = setup_server_config(daemon);
>                 }
> 
> 
> ?
> 
> Jiri?
> 
> - Arnaldo
> 
> >  	}
> > -- 
> > 2.30.GIT
> 
> -- 
> 
> - Arnaldo

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ