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]
Date:   Thu, 16 Dec 2021 19:40:40 +0000
From:   Song Liu <songliubraving@...com>
To:     Peter Zijlstra <peterz@...radead.org>
CC:     Song Liu <song@...nel.org>, bpf <bpf@...r.kernel.org>,
        Networking <netdev@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        "Alexei Starovoitov" <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        "Andrii Nakryiko" <andrii@...nel.org>,
        Kernel Team <Kernel-team@...com>,
        "x86@...nel.org" <x86@...nel.org>
Subject: Re: [PATCH v2 bpf-next 5/7] x86/alternative: introduce text_poke_jit



> On Dec 15, 2021, at 1:17 AM, Peter Zijlstra <peterz@...radead.org> wrote:
> 
> On Tue, Dec 14, 2021 at 10:01:00PM -0800, Song Liu wrote:
>> This will be used by BPF jit compiler to dump JITed binary to a RWX huge
> 
> OK, I read the actually allocator you use and the relevant code for this
> patch and the above is a typo, you meant: RX. Those pages are most
> definitely not writable.

Yeah, it was a typo. I meant to say ROX. 

Thanks,
Song
> 
> 
>> +void *text_poke_jit(void *addr, const void *opcode, size_t len)
>> +{
>> +	unsigned long start = (unsigned long)addr;
>> +	size_t patched = 0;
>> +
>> +	if (WARN_ON_ONCE(core_kernel_text(start)))
>> +		return NULL;
>> +
>> +	while (patched < len) {
>> +		unsigned long ptr = start + patched;
>> +		size_t s;
>> +
>> +		s = min_t(size_t, PAGE_SIZE * 2 - offset_in_page(ptr), len - patched);
> 
> Cute, should work.
> 
>> +
>> +		__text_poke((void *)ptr, opcode + patched, s);
>> +		patched += s;
>> +	}
>> +	return addr;
>> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ