Clever Geek Handbook
📜 ⬆️ ⬇️

NOP

In computer science, NOP or NOOP (short for English: “ N o OP eration”) is a processor instruction in assembly language , or a protocol command that instructs not to do anything.

Content

NOP as machine instruction

The instruction set of many processors contains instructions, the purpose of which is not to change the state of any register or memory cell, but to expend a certain number of processor cycles. For those processors in which there is no special instruction, the NOP is simulated by some other instruction with parameters such that the registers and flags do not change (for example, in SPARC-processors , the instruction " sethi 0,% g0 " is recommended as the NOP).

NOPs are commonly used:

  • to create a delay for a certain time, for example, to synchronize with other devices in the computer. In particular: in AVR microcontrollers, digital ports have a very high speed, and it is recommended to install NOP between switching output ports and reading input ports in order for the circuit to stabilize;
  • to fill the program memory during alignment ;
  • to prevent errors in the processor's hardware;
  • to transfer control in the pipeline organization of the computational process;
  • as a placeholder during program development;
  • as a placeholder for remote instructions, for example, when hacking programs. That is, verification of the registration number, etc., is replaced with a code that does nothing.

Instructions for Intel x86 compatible processors:

  • Name: NOP
  • Number of cycles used: 3
  • Size: 1 Byte
  • Machine command code: 0x 90

In fact, the NOP instruction for x86 processors is XCHG EAX, EAX or XCHG AX, AX , which has the same opcode 0x90, and has no effect, except for the following special cases:

  • The combination of "REP NOP" (0xF3 0x90) in processors, starting with Xeon and Pentium 4 , is interpreted as a PAUSE command, informing the processor that the program performs a cycle of waiting for other processors to change the state of the memory cell, which allows the processor to optimize memory and power consumption.

NOP Track

“NOP track” or “NOP springboard” is a well-known hacker technique associated with the execution of an arbitrary code .

The most common reason for the execution of an arbitrary code is a buffer overflow . However, often the address that is recorded instead of the return point is known only approximately. In this case, such a code is created.

  nop
 nop
 ...
 nop
 nop
 <there is malicious code>

Turning to any of the NOPs, the processor eventually “rolls” onto the malicious area.

NOP in protocol commands

 
Screenshot of the client's Telnet program when checking the NOOP and NOP commands in one of the SMTP protocol implementation.

Many protocols, such as telnet , contain a NOP command that a client can send to receive a response from the server without performing any other actions. The NOOP command is present in the following most well-known protocols:

  • telnet
  • FTP
  • SMTP
  • X11
  • Pop3
  • NNTP
  • finger

Possible uses for the NOP command:

  • The response to the NOP command can be used by the client to determine the availability of the server over the network.
  • The server can be programmed to automatically shut down if the client does not send data for a while. In this case, the periodically sent NOP command means that the client is still “alive” and the connection cannot be broken.

See also

  • Trash teams
Source - https://ru.wikipedia.org/w/index.php?title=NOP&oldid=96239604


More articles:

  • Borovaya (Belgorod region)
  • Exploding MTM type boats
  • Hotel Artemida
  • Lutskov, Peter Anisimovich
  • Podgorny (Kuraginsky District)
  • Heriaeus horridus
  • Nemenman, Mark Efimovich
  • Sand Lizard
  • Krasnogorsky (Yaroslavl region)
  • Myatlicha

All articles

Clever Geek | 2019