0

I need to implement transparent encryption in Postgres (TDE). To do this, I found which functions are called when INSERT and SELECT are triggered. Used LLVM-LLDB on SELECT.

I'm trying to do the same with INSERT - does not work

the base process stops and does not allow insertion. I did everything about one manual https://eax.me/lldb/.

What could be wrong? how to find out which functions are called upon insertion (in the case of SELECT, this is secure_read, etc.)? And, if anyone knows how to change the function code in the source?

First, the client and server are located on the same machine, the same user adds data and reads them

Unfortunately I do not have enough reputation to add a screenshots.

2 Answers 2

1

The SQL statements are the wrong level to start debugging. You should look at the code where blocks are read and written. That would be in src/backend/storage/smgr. Look at the functions mdread and mdwrite in md.c. This is probably where you'd start hacking.

PostgreSQL v12 has introduced “pluggable storage”, so you can write your own storage manager. See the documentation. If you don't want to patch PostgreSQL, but have an extension that will work with standard PostgreSQL, that would be the direction to take.

So far I have only covered block storage, but you must not forget WAL. Encrypting that will require hacking PostgreSQL.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much! I do not have enough reputation to mark your comment as useful, but i will try your way)
0

This is a complex question which you should post to PostgreSQL hackers distribution list https://www.postgresql.org/list/pgsql-hackers/.

You could start by setting a GDB breakpoint in Executor_Start in execMain.c

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.