Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the minimum required hot patching size from 14 to 6 on x86_64 #141

Closed
wants to merge 1 commit into from
Closed

Reduce the minimum required hot patching size from 14 to 6 on x86_64 #141

wants to merge 1 commit into from

Conversation

kubo
Copy link
Contributor

@kubo kubo commented Jun 12, 2016

This patch reduces the minimum required hot patching size from 14 to 6 on x86_64
if the distance from a hot-patch target function to the trampoline memory is within 2GB.
(The exact condition is: (trampoline_memory_address - (target_function_address + 6)) between INT32_MIN and INT32_MAX)

This patch also allocates trampoline memory under 2GB by using mmap() with MAP_32BIT when mysqld resides under 2GB.

This will rescue the following error in #72 (comment)

140129 14:04:54 [Note] Audit Plugin: hot patching function: 0x7f0fc6f59aa0, trampolineFunction: 0x7f0fa44e5000 trampolinePage: 0x7f0fa44e5000
140129 14:04:54 [ERROR] Audit Plugin: unable to disassemble at address: 0x0x7f0fc6f59aaa. Found relative addressing for instruction: [jnz 0x7f0fc6f59ab5]. Aborting.

Relative addressing was found at 10 bytes after the beginning of the function.
It failed because 10 is smaller than the minimum hot patching size 14.
But it will not fail if the size becomes 6.
0x7f0fa44e5000 - (0x7f0fc6f59aa0 + 6) = -581388966, which is between INT32_MIN and INT32_MAX.

if the distance from a hot-patch target function to the trampoline memory is within 2GB.
@aharonrobbins
Copy link

Much thanks for the patch!

We will review.

Thanks,

Aharon

Aharon (Arnold) Robbins
Senior Software Engineer
Sensor - Database Security
McAfee. Part of Intel Security.
[cid:image003.png@01CF5AF2.16A4D380]

From: Kubo Takehiro [mailto:notifications@github.com]
Sent: Sunday, June 12, 2016 08:12
To: mcafee/mysql-audit mysql-audit@noreply.github.com
Subject: [mcafee/mysql-audit] Reduce the minimum required hot patching size from 14 to 6 on x86_64 (#141)

This patch reduces the minimum required hot patching size from 14 to 6 on x86_64
if the distance from a hot-patch target function to the trampoline memory is within 2GB.

This patch also allocates trampoline memory under 2GB by using mmap() with MAP_32BIT when mysqld resides under 2GB.

This will rescue the following error in #72 (comment)#72 (comment)

140129 14:04:54 [Note] Audit Plugin: hot patching function: 0x7f0fc6f59aa0, trampolineFunction: 0x7f0fa44e5000 trampolinePage: 0x7f0fa44e5000

140129 14:04:54 [ERROR] Audit Plugin: unable to disassemble at address: 0x0x7f0fc6f59aaa. Found relative addressing for instruction: [jnz 0x7f0fc6f59ab5]. Aborting.

Relative addressing was found at 10 bytes after the begging of the function.
It failed because 10 is smaller than the minimum hot patching size 14.
But it will not fail if the size becomes 6.


You can view, comment on, or merge this pull request online at:

#141

Commit Summary

  • Reduce the minimum required hot patching size from 14 to 6 on x86_64

File Changes

Patch Links:


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com//pull/141, or mute the threadhttps://github.com/notifications/unsubscribe/AKT-vQhWIl7W6yFtfD_gH23VS08GJqxKks5qK5UOgaJpZM4IztR0.

@aharonrobbins
Copy link

We pulled #142 ; closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants