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: <20200911094431.GF1362448@hirez.programming.kicks-ass.net>
Date:   Fri, 11 Sep 2020 11:44:31 +0200
From:   peterz@...radead.org
To:     Gabriel Krisman Bertazi <krisman@...labora.com>
Cc:     luto@...nel.org, tglx@...utronix.de, keescook@...omium.org,
        x86@...nel.org, linux-kernel@...r.kernel.org,
        linux-api@...r.kernel.org, willy@...radead.org,
        linux-kselftest@...r.kernel.org, shuah@...nel.org,
        kernel@...labora.com, Paul Gofman <gofmanp@...il.com>
Subject: Re: [PATCH v6 5/9] kernel: Implement selective syscall userspace
 redirection

On Fri, Sep 04, 2020 at 04:31:43PM -0400, Gabriel Krisman Bertazi wrote:

> +struct syscall_user_dispatch {
> +	char __user *selector;
> +	unsigned long dispatcher_start;
> +	unsigned long dispatcher_end;
> +};

> +int do_syscall_user_dispatch(struct pt_regs *regs)
> +{
> +	struct syscall_user_dispatch *sd = &current->syscall_dispatch;
> +	unsigned long ip = instruction_pointer(regs);
> +	char state;
> +
> +	if (likely(ip >= sd->dispatcher_start && ip <= sd->dispatcher_end))
> +		return 0;

If you use {offset,size}, instead of {start,end}, you can write the
above like:

	if (ip - sd->dispatcher_offset < sd->dispatcher_size)
		return 0;

which is just a single branch.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ