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: <20180110113234.2fa92920@vmware.local.home>
Date:   Wed, 10 Jan 2018 11:32:34 -0500
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Alan Kao <nonerkao@...il.com>
Cc:     Palmer Dabbelt <palmer@...ive.com>, Albert Ou <albert@...ive.com>,
        Ingo Molnar <mingo@...hat.com>,
        Masahiro Yamada <yamada.masahiro@...ionext.com>,
        Kamil Rytarowski <n54@....com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        patches@...ups.riscv.org, linux-kernel@...r.kernel.org,
        Alan Kao <alankao@...estech.com>,
        Greentime Hu <greentime@...estech.com>
Subject: Re: [PATCH 2/6] riscv/ftrace: Add dynamic function tracer support

On Wed, 10 Jan 2018 15:38:10 +0800
Alan Kao <nonerkao@...il.com> wrote:

> +static int ftrace_check_current_call(unsigned long hook_pos,
> +				     unsigned int *expected)
> +{
> +	unsigned int replaced[2];
> +	unsigned int nops[2] = {NOP4, NOP4};
> +
> +	/* we expect nops at the hook position */
> +	if (!expected)
> +		expected = nops;
> +
> +	/* read the text we want to modify */
> +	if (probe_kernel_read(replaced, (void *)hook_pos, MCOUNT_INSN_SIZE))
> +		return -EFAULT;
> +
> +	/* Make sure it is what we expect it to be */
> +	if (replaced[0] != expected[0] || replaced[1] != expected[1]) {

I wonder if we can have a slight enhancement by doing:

	if (memcmp(replaced, expected, sizeof(replaced)) != 0) {

-- Steve


> +		pr_err("%p: expected (%08x %08x) but get (%08x %08x)",
> +		       (void *)hook_pos, expected[0], expected[1], replaced[0],
> +		       replaced[1]);
> +		return -EINVAL;
> +	}
> +
> +	return 0;
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ