20145225 Interim Summary of the basic design of information security system

Source: Internet
Author: User

Mid-term summary One, commonly used command summary man-k:

Commonly used to search, combined with pipe use. Examples are as follows:

Man-k K1 | grep K2 | grep 2

The search contains both K1 and K2, and is part of the system call.

The last number means the section in the Help manual, the man Manual has a total of 8 sections, the most commonly used is 123, meaning the following:

1.Linux2.系统调用3.c语言

But when you are using the man statement alone, you want to look at the explanations in one of these individual sections, the usage is this:

Mans 3 printf

That is, find the use of printf in the C language.

Grep-nr

This statement can be used to find keywords, full-text search, and can directly find content within a file. which

n:为显示行号r:为递归查找

For example, if you want to find a macro, we know that the macro is saved in the Include folder, so you can use the following statement:

Grep-nr xxx/usr/include(XXX is the macro to look for)

Cheat

Cheat is a very useful "play small copy" search tool, can easily tell you what you want.
Example:

Cheat LS

Second, the common tool vim

Vim is a very useful editor with a total of six basic modes, the most commonly used are normal mode, insert mode, and command line mode. You need to be familiar with the switching modes between the three modes:

normal → insert: i or a

Insert → normal: Esc or Ctrl + [

normal → command line: :

command line → Normal:Esc or Ctrl + [

Gcc

Common options

-C compiles only the non-linked, generating the target file .

O-s compile-only assembler, generate assembly code

-E Only precompiled, no other processing

-G contains standard debug information in an executable program - o file specifies the file as the output

-V Prints the command line information and compiler version of the compiler's internal compilation procedures

-I dir add the dir directory to the search path list of the header file

Compilation process

pretreatment:gcc–e hello.c–o hello.i; Gcc–e calling cpp to generate intermediate files

translation:gcc–s hello.i–o Hello.s; Gcc–s call CCL translated into assembly file

compilation :gcc–c hello.s–o hello.o; Gcc-c call as translates to relocatable target file

link :gcc hello.o–o hello; Gcc-o call ld** to create executable target file

Gdb

The most basic commands of GDB are:

gdb programm(启动GDB)l   查看所载入的文件b   设断点info b  查看断点情况run 开始运行程序bt  打印函数调用堆栈p   查看变量值c   从当前断点继续运行到下一个断点n   单步运行(不进入)s   单步运行(进入)quit 退出GDB

Four types of breakpoints:

1. Line Breakpoint

b [ number of rows or function names ] < conditional expressions >

2. function Breakpoints

b [ function name ] < conditional expression >

3. Conditional Breakpoints

b [ number of rows or function name ] <if expression >

4. Temporary Breakpoint

Tbreak [ number of rows or function names ] < conditional expressions >

Additional Debugging Tools:

Cgdb, there is a separate debug window, more convenient to view

DDD, Graphics page

Make and Makefile

This is a good way to automate compilation.

General wording of Makefile:

A makefile file mainly contains a series of rules, each of which contains the following:

    • Target bodies that need to be created by the make tool, usually executables and target files, or actions to perform, such as ' clean ';

    • The files that are dependent on the target body to be created are usually the other files needed to compile the target file.

    • The command to run when creating each target body, which must start with tab tab

Third, the regular expression function:
    • Verify that the match is
    • Find
    • Replace
Rules:
    • \ special symbol, which indicates the following character itself
    • [] matches any of these characters, but each match matches only one
    • [^] matches any character except one, and each match matches only one
    • {n} number of times decorated, repeat n times, as follows:

      ?= {0,1}+= {1, }    *= {0, }{m,n}:至少为m,至多为n
      Matching method:
    • ^ Match from where the string starts
    • $ match from where the string ends
    • | Can match left or right
    • () 1. In the number of modifications, can be expressed as a whole; 2. In the result, you can indicate a separate representation

Greed: As many matches as possible

Iv. important thoughts of textbooks Chapter one computer system roaming

This chapter introduces some basic concepts, which are the sum of the later chapters, which are all in the following chapters, and I think the most important part of this chapter is a sentence:

Information = bit + context

The information in the computer is expressed in binary numbers, and because these bits are in different positions, are signed number or unsigned number, is big-endian or small-end method, due to the specific interpretation of different, resulting in different results.

After that, learning is how to read and write bits, and how the context corresponds.

Chapter II Representation and processing of information

In this chapter I think the most confusing is the small-end method and the big-endian method. Common small-end method, the way is "high-to-high, low-to-low", but at the same time to pay attention to the byte at the time of storage and our usual cognition of the high and low level of the relationship, as well as a string of data in a few representatives of a byte:

A byte is a 8-bit, or two-bit hexadecimal number.

Then is the integer, signed number and unsigned number representation, complement representation, bitwise operations and logical operations, overflow, truncation and expansion;

In floating point numbers, binary decimals, and most importantly, IEEE decimals:

IEEE floating point standard:

Use v= ( -1) ^s x 2^e x M to represent a number:
Symbol: s Determines whether the number is positive or negative. 0 The sign bit special case processing.
Order code: E to the floating-point weighting, the weight is 2 of the e-power (may be negative)
Mantissa: M is a binary decimal with a range of 1~2-ε or 0~1-ε (n-th power of Ε=1/2)

Encoding Rules:

Individual sign bit s coded symbol S, accounting for 1 bits
K-Bit Order field exp coded Order E
N-bit decimal segment Frac encoded Mantissa m (the value of the dependent order field is also required to be 0)

Two kinds of precision
  • Single precision (float), k=8 bit, n=23 bit, altogether 32 bits;
  • Double precision (double), k=11 bit, n=52 bit, altogether 64 bits.
Three kinds of coded cases
  • Normalization of
  • Non-normalized
  • Special values

There are also rounding methods:

1. Rounding to even (default method)

That is, the number is rounded up or down, and the lowest valid number of the result is even.
Can be used in binary decimals.

2. Rounding to 0

That is, rounding down integers and negative numbers rounded up.

3. Rounding Down

Both positive and negative numbers are rounded down.

4. Rounding up

Both positive and negative numbers are rounded up.

The default (that is, to even round) method can get the closest match, the remaining three can be used to calculate upper and lower bounds.

Chapter III Machine-level representation of the program

This chapter is similar to the previously learned Assembly, which requires attention to addressing and several operations, mov,push,pop,leal, jump commands, control transfer commands, and so on.

Several relatively new and easily forgotten points of knowledge are:

Translation cycle

The assembly can be combined with conditional tests and jumps to achieve the loop effect, but most of the assembler must first convert other forms of the loop to do-while format.

1.do-while Cycle

General form:

Do
Body-statement
while (test-expr);
The loop body body-statement is executed at least once.

Can be translated into:

Loop
Body-statement
t = test-expr;
if (t)
Goto Loop;
That is, the loop body statement is executed before the judgment is executed.

2.while Cycle

General form:

while (test-expr)
Body-statement
The method of GCC is to use conditional branching, which represents the first execution of omitting the loop body:

if (! TEST-EXPR)
Goto done;
Do
Body-statement
while (test-expr);
Done
Next:

t = test-expr;
if (!t)
Goto Done:
Loop
Body-statement
t = test-expr;
if (t)
Goto Loop;
Done
After all, change the cycle to do-while, then translate it with Goto.

3.for Cycle

The For loop can be easily changed into a while loop, so the above method is changed to Do-while and then translated.

Register Usage Conventions

Program register groups are the only resources that can be shared by all processes.

This Convention is intended to prevent a process p from calling another procedure Q when the value in the register is overwritten. The Convention is as follows:

%EAX,%EDX,%ECX Caller Save Register (q can overwrite, P's data will not be destroyed)
%ebx,%esi,%edi The callee saves the register (q must be pressed into the stack before overwriting these values and replying to them before returning)
%EBP,%ESP Convention to keep
%eax used to save the return value

Frame stack Structure

The most important part of this section is the practice of the function call frame stack, which can be found in the calling section of Sun Xiaobo's tutorial, as well as the written frame stack call process on the notebook.

In fact, the most basic thing here is to know, for each assembly statement, what it has done, how the value of the register changes, how the stack frame changes, how the values in memory change, and more to understand is what each line of change represents.

What I lack now is this, reading each sentence is not difficult to do what the memory or register do, but to understand why do so, this corresponds to the high-level programming language of what, it seems unfamiliar, need more practice.

Fourth Chapter processor Architecture

This chapter learns a relatively simple processor Y86, and the instruction set is a lot less than IA32. Learning I think a more difficult to master, to do the problem needs to be repeatedly consulted is:

byte-level encoding of the instruction

Each instruction requires a range of 1-6 bytes, and the first byte of each instruction indicates the type of instruction .

1. First byte

This byte is divided into two parts, each part 4 bits:

  • High four-bit: Code section, domain value is 0~0xb
  • Fourth bit: Functional part, function value is only useful if a set of related instructions is shared with one code.

For example: the No. 233 page of the textbook, the function Code of the Y86 instruction set:

The code portion of the integer operation is 6, the functional part distinguishes ADDL,SUBL,ANDL,XORL

The code portion of the branch instruction is 7.

The code portion of the delivery instruction is 2.

It's important to note that RRMOVL is in the delivery instructions, which says they have the same instruction code.

Each of the 8 program registers has a corresponding 0~7 register identifier , and the program register exists in a register file in the CPU, which is a small, random-access memory with the Register ID as the address.

When you need to indicate that no registers should be accessed, use the ID value 0xF to indicate

2. Some require extra bytes (1) Additional Register indicator bytes

Specify one or two registers, such as RA or RB.

  • Without a register operand, such as branch instruction and call instruction, there is no register designator byte.
  • An instruction that requires only one register operand (IRMOVL,PUSHL,POPL) instructs the other register to subscript character to 0xF
(2) Additional 4-byte constant numbers

The use of this word:

1.IRMOVL of immediate count data
Offset of the address indicator for 2.rmmol and MRMOVL
3. The destination address of the branch instruction and the calling instruction

Precautions

1. The destination address of the branch instruction and the calling instruction is an absolute address
2. All integers are encoded by a small-end method

This part of the instruction code helps us to understand the correspondence between the machine code and the assembly code, and involves the next difficulty I think:

Sequential implementation of Y86

Here the six stages and each stage of the action, the data and the corresponding results seem to be dazzling, but the textbook has given a part of the specific procedures of common command, after-class homework also has a similar job, which requires our ability to extrapolate.

As for HDL language, there has been a foundation in the EDA curriculum, which seems to be relatively easy.

Sixth chapter Memory Hierarchy

Involves Rom,ram, several calculations of disk, bus and so on. The concept is relatively simple to understand, the calculation requires only a set of formulas, pay attention to not missing the abacus or the cylinder is good.

I think the most important part of this chapter is locality.

Principle of locality:

A well-written computer program often tends to refer to data items that are adjacent to other recently referenced data items, or to the data item itself that has recently been referenced.

Classification:

  • Time locality
  • Spatial locality

The simple principle of quantitative evaluation of locality in a program:

  • A program that repeatedly references the same variable has good time locality
  • For programs with reference patterns with a step size of K, the smaller the step size, the better the spatial locality
  • The loop has a good time and spatial locality for taking orders. The smaller the loop body, the more the loop iteration number, the better the locality.

And the memory hierarchy , the most important idea here is this: each layer of storage devices is the next layer of "cache."

This involves cache hits and misses, as well as replacement policies:

1. Cache Hits

When a program needs a data object D in Layer k+1, first look for D in a block that is currently stored in the K layer, and if D is just cached in the K layer, it is called a cache hit.

The program reads D directly from level K, faster than reading d from the k+1 layer.

2. Cache Misses

That is, there is no cached data object D in Layer K.

The K-tier cache then extracts the block containing d from the k+1 cache. If the level K cache is full, it is possible to overwrite an existing block

Overwrite--Replacement/expulsion

Replacement policy:

  • Random substitution strategy-randomly sacrificing a block
  • The least recently used substitution strategy lru-sacrifices the last accessed time distance now to the furthest block.
3. Types of Cache Misses (1) mandatory misses/cold misses

That is, the K-tier cache is empty (called a cold cache), and access to any data object is not hit.

(2) Conflict not hit

Because of a placement policy, placing a block limit on the k+1 layer in a small subset of the K-layer block causes the cache to be not full, but the corresponding block is full and will not be hit.

(3) Capacity not hit

When the size of the working set exceeds the size of the cache, the cache undergoes a capacity miss, which means that the cache is too small to handle the working set.

The cache memory is then cached.

A cache is an array of cache groups whose structure can be described using tuples (s,e,b,m):

S: There are s=2^s cache groups in this array
E: Each group contains an E cache line
B: Each row is made up of a b=2^b byte block of data
M: Each memory address has a M-bit, which forms m=2^m different address

In addition, there are markers and valid bits:

Valid bits: Each row has a valid bit that indicates whether the row contains meaningful information
Mark bit: t=m-(b+s), unique identifier of the block stored in this cache line
Group Index bit: s
Block Shift: B
The cache structure divides m addresses into T-markers, S-group index bits, and B-block offsets.

Six, Harvest

In the past half semester, I think my biggest gain is the gradual adaptation to the self-study of this way. I got this textbook at the beginning of the semester is very headache, in my eyes, the book is thick and unintelligible, do not know how to start learning. But when I really started to sink in and read the book, I found that there was a lot of thought in it. A lot of knowledge can be verified from past courses.

And for those unfamiliar, completely have no contact with the knowledge, the initial study is extremely painful, always feel to learn too much, they know too little, time is not enough, energy can not fight, the whole person should be exhausted or can't learn how much knowledge. But later I know, this is because my learning method is not right, who can not eat a fat, can chew, I too much pursuit of every knowledge point in depth can only lead to any can not learn, pay a lot of time instead of working hard.

Vii. Lack of

Study time does not feel, but examination and do homework time will feel, their study or some flow on the surface, too rough, a lot of things do not notice when reading a book, or think that it is not important to ignore, in fact, are not should, and sometimes need to go through the book repeatedly. I think this is mainly because I do not pay enough attention to the problem, many problems do not eat full thoroughly understand, can not do extrapolate.

20145225 Interim Summary of the basic design of information security system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.