opcode.html
来自「perl教程」· HTML 代码 · 共 731 行 · 第 1/2 页
HTML
731 行
can easily be used to implement a resource attack (e.g., consume all
available memory).</p>
</dd>
<dd>
<pre>
concat repeat join range</pre>
</dd>
<dd>
<pre>
anonlist anonhash</pre>
</dd>
<dd>
<p>Note that despite the existence of this optag a memory resource attack
may still be possible using only :base_core ops.</p>
</dd>
<dd>
<p>Disabling these ops is a <em>very</em> heavy handed way to attempt to prevent
a memory resource attack. It's probable that a specific memory limit
mechanism will be added to perl in the near future.</p>
</dd>
</li>
<dt><strong><a name="item__3abase_loop">:base_loop</a></strong>
<dd>
<p>These loop ops are not included in :base_core because they can easily be
used to implement a resource attack (e.g., consume all available CPU time).</p>
</dd>
<dd>
<pre>
grepstart grepwhile
mapstart mapwhile
enteriter iter
enterloop leaveloop unstack
last next redo
goto</pre>
</dd>
</li>
<dt><strong><a name="item__3abase_io">:base_io</a></strong>
<dd>
<p>These ops enable <em>filehandle</em> (rather than filename) based input and
output. These are safe on the assumption that only pre-existing
filehandles are available for use. To create new filehandles other ops
such as open would need to be enabled.</p>
</dd>
<dd>
<pre>
readline rcatline getc read</pre>
</dd>
<dd>
<pre>
formline enterwrite leavewrite</pre>
</dd>
<dd>
<pre>
print sysread syswrite send recv</pre>
</dd>
<dd>
<pre>
eof tell seek sysseek</pre>
</dd>
<dd>
<pre>
readdir telldir seekdir rewinddir</pre>
</dd>
</li>
<dt><strong><a name="item__3abase_orig">:base_orig</a></strong>
<dd>
<p>These are a hotchpotch of opcodes still waiting to be considered</p>
</dd>
<dd>
<pre>
gvsv gv gelem</pre>
</dd>
<dd>
<pre>
padsv padav padhv padany</pre>
</dd>
<dd>
<pre>
rv2gv refgen srefgen ref</pre>
</dd>
<dd>
<pre>
bless -- could be used to change ownership of objects (reblessing)</pre>
</dd>
<dd>
<pre>
pushre regcmaybe regcreset regcomp subst substcont</pre>
</dd>
<dd>
<pre>
sprintf prtf -- can core dump</pre>
</dd>
<dd>
<pre>
crypt</pre>
</dd>
<dd>
<pre>
tie untie</pre>
</dd>
<dd>
<pre>
dbmopen dbmclose
sselect select
pipe_op sockpair</pre>
</dd>
<dd>
<pre>
getppid getpgrp setpgrp getpriority setpriority localtime gmtime</pre>
</dd>
<dd>
<pre>
entertry leavetry -- can be used to 'hide' fatal errors</pre>
</dd>
<dd>
<pre>
custom -- where should this go</pre>
</dd>
</li>
<dt><strong><a name="item__3abase_math">:base_math</a></strong>
<dd>
<p>These ops are not included in :base_core because of the risk of them being
used to generate floating point exceptions (which would have to be caught
using a $SIG{FPE} handler).</p>
</dd>
<dd>
<pre>
atan2 sin cos exp log sqrt</pre>
</dd>
<dd>
<p>These ops are not included in :base_core because they have an effect
beyond the scope of the compartment.</p>
</dd>
<dd>
<pre>
rand srand</pre>
</dd>
</li>
<dt><strong><a name="item__3abase_thread">:base_thread</a></strong>
<dd>
<p>These ops are related to multi-threading.</p>
</dd>
<dd>
<pre>
lock threadsv</pre>
</dd>
</li>
<dt><strong><a name="item__3adefault">:default</a></strong>
<dd>
<p>A handy tag name for a <em>reasonable</em> default set of ops. (The current ops
allowed are unstable while development continues. It will change.)</p>
</dd>
<dd>
<pre>
:base_core :base_mem :base_loop :base_io :base_orig :base_thread</pre>
</dd>
<dd>
<p>If safety matters to you (and why else would you be using the Opcode module?)
then you should not rely on the definition of this, or indeed any other, optag!</p>
</dd>
</li>
<dt><strong><a name="item__3afilesys_read">:filesys_read</a></strong>
<dd>
<pre>
stat lstat readlink</pre>
</dd>
<dd>
<pre>
ftatime ftblk ftchr ftctime ftdir fteexec fteowned fteread
ftewrite ftfile ftis ftlink ftmtime ftpipe ftrexec ftrowned
ftrread ftsgid ftsize ftsock ftsuid fttty ftzero ftrwrite ftsvtx</pre>
</dd>
<dd>
<pre>
fttext ftbinary</pre>
</dd>
<dd>
<pre>
fileno</pre>
</dd>
<dt><strong><a name="item__3asys_db">:sys_db</a></strong>
<dd>
<pre>
ghbyname ghbyaddr ghostent shostent ehostent -- hosts
gnbyname gnbyaddr gnetent snetent enetent -- networks
gpbyname gpbynumber gprotoent sprotoent eprotoent -- protocols
gsbyname gsbyport gservent sservent eservent -- services</pre>
</dd>
<dd>
<pre>
gpwnam gpwuid gpwent spwent epwent getlogin -- users
ggrnam ggrgid ggrent sgrent egrent -- groups</pre>
</dd>
<dt><strong><a name="item__3abrowse">:browse</a></strong>
<dd>
<p>A handy tag name for a <em>reasonable</em> default set of ops beyond the
:default optag. Like :default (and indeed all the other optags) its
current definition is unstable while development continues. It will change.</p>
</dd>
<dd>
<p>The :browse tag represents the next step beyond :default. It it a
superset of the :default ops and adds :filesys_read the :sys_db.
The intent being that scripts can access more (possibly sensitive)
information about your system but not be able to change it.</p>
</dd>
<dd>
<pre>
:default :filesys_read :sys_db</pre>
</dd>
</li>
<dt><strong><a name="item__3afilesys_open">:filesys_open</a></strong>
<dd>
<pre>
sysopen open close
umask binmode</pre>
</dd>
<dd>
<pre>
open_dir closedir -- other dir ops are in :base_io</pre>
</dd>
<dt><strong><a name="item__3afilesys_write">:filesys_write</a></strong>
<dd>
<pre>
link unlink rename symlink truncate</pre>
</dd>
<dd>
<pre>
mkdir rmdir</pre>
</dd>
<dd>
<pre>
utime chmod chown</pre>
</dd>
<dd>
<pre>
fcntl -- not strictly filesys related, but possibly as dangerous?</pre>
</dd>
<dt><strong><a name="item__3asubprocess">:subprocess</a></strong>
<dd>
<pre>
backtick system</pre>
</dd>
<dd>
<pre>
fork</pre>
</dd>
<dd>
<pre>
wait waitpid</pre>
</dd>
<dd>
<pre>
glob -- access to Cshell via <`rm *`></pre>
</dd>
<dt><strong><a name="item__3aownprocess">:ownprocess</a></strong>
<dd>
<pre>
exec exit kill</pre>
</dd>
<dd>
<pre>
time tms -- could be used for timing attacks (paranoid?)</pre>
</dd>
<dt><strong><a name="item__3aothers">:others</a></strong>
<dd>
<p>This tag holds groups of assorted specialist opcodes that don't warrant
having optags defined for them.</p>
</dd>
<dd>
<p>SystemV Interprocess Communications:</p>
</dd>
<dd>
<pre>
msgctl msgget msgrcv msgsnd</pre>
</dd>
<dd>
<pre>
semctl semget semop</pre>
</dd>
<dd>
<pre>
shmctl shmget shmread shmwrite</pre>
</dd>
</li>
<dt><strong><a name="item__3astill_to_be_decided">:still_to_be_decided</a></strong>
<dd>
<pre>
chdir
flock ioctl</pre>
</dd>
<dd>
<pre>
socket getpeername ssockopt
bind connect listen accept shutdown gsockopt getsockname</pre>
</dd>
<dd>
<pre>
sleep alarm -- changes global timer state and signal handling
sort -- assorted problems including core dumps
tied -- can be used to access object implementing a tie
pack unpack -- can be used to create/use memory pointers</pre>
</dd>
<dd>
<pre>
entereval -- can be used to hide code from initial compile
require dofile</pre>
</dd>
<dd>
<pre>
caller -- get info about calling environment and args</pre>
</dd>
<dd>
<pre>
reset</pre>
</dd>
<dd>
<pre>
dbstate -- perl -d version of nextstate(ment) opcode</pre>
</dd>
<dt><strong><a name="item__3adangerous">:dangerous</a></strong>
<dd>
<p>This tag is simply a bucket for opcodes that are unlikely to be used via
a tag name but need to be tagged for completeness and documentation.</p>
</dd>
<dd>
<pre>
syscall dump chroot</pre>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><code>ops(3)</code> -- perl pragma interface to Opcode module.</p>
<p><code>Safe(3)</code> -- Opcode and namespace limited execution compartments</p>
<p>
</p>
<hr />
<h1><a name="authors">AUTHORS</a></h1>
<p>Originally designed and implemented by Malcolm Beattie,
<a href="mailto:mbeattie@sable.ox.ac.uk">mbeattie@sable.ox.ac.uk</a> as part of Safe version 1.</p>
<p>Split out from Safe module version 1, named opcode tags and other
changes added by Tim Bunce.</p>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?