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: <20130804143527.GA18906@redhat.com>
Date:	Sun, 4 Aug 2013 16:35:27 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Kees Cook <keescook@...omium.org>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Zach Levis <zml@...ux.vnet.ibm.com>,
	Al Viro <viro@...iv.linux.org.uk>,
	Evgeniy Polyakov <zbr@...emap.net>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/3] exec: introduce exec_binprm() for "depth == 0" code

On 08/03, Kees Cook wrote:
>
> On Thu, Aug 1, 2013 at 12:05 PM, Oleg Nesterov <oleg@...hat.com> wrote:
> > +static int exec_binprm(struct linux_binprm *bprm)
> > +{
> > +       pid_t old_pid, old_vpid;
> > +       int ret;
> > +
> > +       /* Need to fetch pid before load_binary changes it */
> > +       old_pid = current->pid;
> > +       rcu_read_lock();
> > +       old_vpid = task_pid_nr_ns(current, task_active_pid_ns(current->parent));
> > +       rcu_read_unlock();
> > +
> > +       ret = search_binary_handler(bprm);
> > +       if (ret >= 0) {
> > +               trace_sched_process_exec(current, old_pid, bprm);
> > +               ptrace_event(PTRACE_EVENT_EXEC, old_vpid);
> > +               current->did_exec = 1;
> > +       }
>
> Cleanup looks good. One idea here, though: this could be made more
> pretty by doing:
>
> if (ret < 0)
>     return ret;
>
> to avoid the indentation for the "expected" code path.

Well, I do not reallt mind. But this "if" block is simple and small,
we do we need another "return" ?

To me the code looks more readable this way, but I can redo/resend.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ