Commit graph

229 commits

Author SHA1 Message Date
Elliott Hughes
230e98bfea am 36ff3bd2: am e8c6d15b: am 59644a6c: Merge "Fix nandread to build with old or uapi headers."
* commit '36ff3bd273d9f60822104eb53f3aa1886160b360':
  Fix nandread to build with old or uapi headers.
2013-11-11 20:52:05 -08:00
Elliott Hughes
36ff3bd273 am e8c6d15b: am 59644a6c: Merge "Fix nandread to build with old or uapi headers."
* commit 'e8c6d15b1892ffd09dae8ac7922854140a11130d':
  Fix nandread to build with old or uapi headers.
2013-11-11 16:33:30 -08:00
Elliott Hughes
b05a2e5130 Fix nandread to build with old or uapi headers.
Bug: 11559337
Change-Id: I9795a16649dafdfe3df150170265157170cd5a79
2013-11-11 16:17:49 -08:00
Marco Nelissen
377cb2ab3a Add -n option to ps to print numeric uid
and fix some whitespace issues

Change-Id: Iefb6f51f5f4522ce4ab0f1ea3c996fe892715e90
2013-10-25 08:15:42 -07:00
Scott Anderson
9e97fee019 Enhance the ioctl toolbox command
1) Implement documented but unimplemented read-only option.
2) Allow standard input to be used as the <device> by passing
   "-".  On some devices, opening the device has side effects.
   Allowing standard input can prevent this by using a sequence
   of something like:

      # Open the device on file descriptor 3
      exec 3<> /dev/something
      ioctl -d - 0 0 <&3
      ioctl -d - 1 0 <&3
      dd if=myfile >&3
      # Close file descriptor 3
      exec 3>&-

Change-Id: If17ac3cffa7ccb159051550724b4ce7d8efa5feb
Signed-off-by: Scott Anderson <saa@android.com>
2013-10-17 17:20:37 -07:00
Glenn Kasten
3707e7ff03 toolbox: Add nohup command
Change-Id: I2f7d9934b54d98886d7a6205ea122d9ce91066ec
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-09-23 15:37:55 -07:00
Michael Wright
1e1d29133f Add standard options to readlink
Change-Id: I4c2624d22ce879a3578d5b17440a9895b19e2f1f
2013-08-22 16:38:08 -07:00
Michael Wright
9f50abdee0 Add basic readlink command
Change-Id: I693c1098e6c6d107a9e97285bf826ab153a1c8f0
2013-08-19 16:31:35 -07:00
Colin Cross
9227bd3855 Move liblog headers to system/core/include/log
Move the liblog headers to log/ instead of cutils/ to complete
the separation of libcutils and liblog.  cutils/log.h still
exists and includes log/log.h in order to support the many existing
modules that use cutils/log.h.

Change-Id: I2758c9f4aedcb809ca7ba8383d0f55041dd44345
2013-07-24 12:32:39 -07:00
Rom Lemarchand
fb3280886d Merge "toolbox: swap utils" 2013-07-02 02:07:10 +00:00
Ken Sumrall
cf0b4d94fa Merge "Do not exit early on errors when -f is specified" 2013-06-28 02:47:01 +00:00
Ken Sumrall
3b2b2b5137 Merge "Update the touch command to take a human readable timestamp" 2013-06-28 02:46:09 +00:00
Ken Sumrall
0354829763 Do not exit early on errors when -f is specified
When running with the -f option, do not stop recursion or proccessing
command line args if an error occurs.  Continue trying to remove all
the items specified on the command line.  However, still return an
error status if some files could not be removed.

Change-Id: I83d66babe833da8a68aad68248647ba0601c5d32
2013-06-26 17:42:38 -07:00
Ken Sumrall
13495a1cbb Update the touch command to take a human readable timestamp
Now the -t option to the toolbox touch command takes a timestamp
in the form of YYYYMMDD.hhmmss

Change-Id: I3812700edaa1a06590a07c15b050721b49e9b7e0
2013-06-26 17:42:25 -07:00
Rom Lemarchand
367297c3d7 toolbox: swap utils
Add swap utilities (mkswap, swapon, swapoff) to the toolbox

Change-Id: If5ed6981670a1cdda6b528b587dbc1be7ccdf832
Signed-off-by: Rom Lemarchand <romlem@google.com>
2013-06-25 13:21:53 -07:00
Colin Cross
a44c31cc91 am e755dfd4: Merge changes I1db3137b,I0f66144e
* commit 'e755dfd43812ebd9a0d0d6a2106316f343ffb5a2':
  toolbox: reimplement watchprops using __system_property_foreach()
  libcutils: reimplement property_list() using __system_property_foreach()
2013-06-19 10:33:42 -07:00
Greg Hackmann
68e9b6bc94 toolbox: reimplement watchprops using __system_property_foreach()
Internally, replace the watchlist array with a hashmap since the array
assumes properties are enumerated in a consistent order and foreach()
probably won't.  (find_nth() never guaranteed this either but it usually
worked in practice.)

Signed-off-by: Greg Hackmann <ghackmann@google.com>

(cherry picked from commit 389e358017)

Change-Id: I1db3137b130474f4bb205f01f0bdcf37cf974764
2013-06-18 19:26:28 -07:00
Greg Hackmann
389e358017 toolbox: reimplement watchprops using __system_property_foreach()
Internally, replace the watchlist array with a hashmap since the array
assumes properties are enumerated in a consistent order and foreach()
probably won't.  (find_nth() never guaranteed this either but it usually
worked in practice.)

Change-Id: I83843facdd671edd09652edf472e88ec3d1edd3b
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2013-06-18 16:37:54 -07:00
Colin Cross
99c1a4168b resolved conflicts for merge of 95a41f6b to stage-aosp-master
Change-Id: Icfae29edf989fb43a7f0b8bda188a9807f76a3b9
2013-06-17 18:19:28 -07:00
Colin Cross
8196316411 toolbox: hide property implementation from watchprops
(cherry picked from commit 91779634de)

Change-Id: I7a2d8aa507ac61cedc5f67c563531a7d4ec8e4c2
2013-06-17 16:58:09 -07:00
Colin Cross
91779634de toolbox: hide property implementation from watchprops
Change-Id: Ia6609116d641d3354971ca40a16ffcab38484150
2013-06-17 13:13:40 -07:00
Brian Carlstrom
89c2be335d am 603746f0: am 59fa7e10: Merge "Fixed reversed output in netstat Recv-Q Send-Q columns"
* commit '603746f0e3b645954f33be36f7602cc8205cb71c':
  Fixed reversed output in netstat Recv-Q Send-Q columns
2013-06-04 11:17:19 -07:00
Brian Carlstrom
603746f0e3 am 59fa7e10: Merge "Fixed reversed output in netstat Recv-Q Send-Q columns"
* commit '59fa7e107d43a4ef521413ec0bb7b0c2a5525071':
  Fixed reversed output in netstat Recv-Q Send-Q columns
2013-06-04 10:28:55 -07:00
Brian Carlstrom
3c412f6260 Fixed reversed output in netstat Recv-Q Send-Q columns
Change-Id: I2bc7ac6c886808910212432497f05e34596f5e85
2013-06-03 19:24:44 -07:00
Nick Kralevich
29393d69b3 fix another misuse of strncat
This has the potential to overflow "buffer" if the command line
is more than 4K.

Change-Id: Icdfed0d9d21804f290b75787ef3809e0475b14f0
2013-06-03 13:40:11 -07:00
Nick Kralevich
960ac434a4 fix strncat misuse
The third argument of strncat() tells how much data to append from
src, not the total size of the buffer.

Change uses of strncat() to strlcat(), which has the buffer overflow
protection behavior intended by the original author.

This fixes the following compiler warning:

In function 'strncat',
    inlined from 'print_type' at system/core/toolbox/lsof.c:76:12:
bionic/libc/include/string.h:142:5: warning: call to __builtin___strncat_chk might overflow destination buffer [enabled by default]

Change-Id: Id69edc641de3cb87d1867a409cd57b04b12f90a7
2013-06-03 12:13:36 -07:00
Nick Kralevich
44a5fb5704 Merge "fs_mgr: make block devices read-only" 2013-04-25 20:22:20 +00:00
Nick Kralevich
49edc0acf8 am 4c1840e6: am 5ea58543: Merge "mount: fix incorrect string length calculation"
* commit '4c1840e6547266ba251d8c34905036d73240ff57':
  mount: fix incorrect string length calculation
2013-04-24 17:37:37 -07:00
Nick Kralevich
4c1840e654 am 5ea58543: Merge "mount: fix incorrect string length calculation"
* commit '5ea58543154a97c42c0b7fc58c2639a4fea64f5b':
  mount: fix incorrect string length calculation
2013-04-24 17:36:11 -07:00
Nick Kralevich
29a5298366 mount: fix incorrect string length calculation
Fix bug https://code.google.com/p/android/issues/detail?id=54192
which incorrectly calculated the length of a string.

Fix compiler warning:

system/core/toolbox/mount.c:59:2: warning: initializer-string for array of chars is too long [enabled by default]
system/core/toolbox/mount.c:59:2: warning: (near initialization for 'options[16].str') [enabled by default]

Change-Id: If8663f8311c6348a730fcf731d402b57fee10cb5
2013-04-24 16:31:02 -07:00
Nick Kralevich
e18c0d508a fs_mgr: make block devices read-only
When a filesystem is mounted read-only, make the underlying
block device read-only too. This helps prevent an attacker
who is able to change permissions on the files in /dev
(for example, symlink attack) from modifying the block device.

In particular, this change would have stopped the LG Thrill / Optimus
3D rooting exploit
(http://vulnfactory.org/blog/2012/02/26/rooting-the-lg-thrill-optimus-3d/)
as that exploit modified the raw block device corresponding to /system.

This change also makes UID=0 less powerful. Block devices cannot
be made writable again without CAP_SYS_ADMIN, so an escalation
to UID=0 by itself doesn't give full root access.

adb/mount: Prior to mounting something read-write, remove the
read-only restrictions on the underlying block device. This avoids
messing up developer workflows.

Change-Id: I135098a8fe06f327336f045aab0d48ed9de33807
2013-04-24 08:53:26 -07:00
Colin Cross
ba4ac0cc3a am 03546553: am b73a0ef4: Merge "use lseek64 to resolve offset oveflow"
* commit '03546553205b56fc1ba0318b146971f43f54a155':
  use lseek64 to resolve offset oveflow
2013-04-18 15:25:54 -07:00
Colin Cross
0354655320 am b73a0ef4: Merge "use lseek64 to resolve offset oveflow"
* commit 'b73a0ef4d05ad594ba07b98e1f4aa7fe66a18c2e':
  use lseek64 to resolve offset oveflow
2013-04-18 15:20:54 -07:00
Jongrak Kwon
c05aae4ac4 use lseek64 to resolve offset oveflow
The offset variable in lseek is 32 bit and get easily overflow
when accessing with large offset in dd command.
Use lseek64 to resolve it.

Change-Id: Ib75d9dcb587004a6851365ab5bb8584ce1010b57
2013-04-17 14:05:55 -07:00
Ying Wang
39f6dd65f9 am 129b6d90: am 083b5ccb: Add liblog
* commit '129b6d907b3c32a0f0a2e4fc585502484d47a1e4':
  Add liblog
2013-04-09 23:25:24 -07:00
Ying Wang
129b6d907b am 083b5ccb: Add liblog
* commit '083b5ccba345ed2b4950454f16bd89c5d86b6b27':
  Add liblog
2013-04-09 22:29:03 -07:00
Ying Wang
083b5ccba3 Add liblog
Bug: 8580410
Change-Id: Iab3a9b4307f207c14a04a922cc7350c54e60e9ad
2013-04-09 22:03:45 -07:00
Colin Cross
58b0642abb am d3859e43: am 6e0b9ecb: Merge "toolbox/dmesg: do not hardcode KLOG_BUF_LEN"
* commit 'd3859e433d5a4e0da3f24851c5f5f6c9c8b97849':
  toolbox/dmesg: do not hardcode KLOG_BUF_LEN
2013-04-06 12:56:31 -07:00
Colin Cross
d3859e433d am 6e0b9ecb: Merge "toolbox/dmesg: do not hardcode KLOG_BUF_LEN"
* commit '6e0b9ecb503b5611d815214e0a134ea0b1395089':
  toolbox/dmesg: do not hardcode KLOG_BUF_LEN
2013-04-06 12:51:35 -07:00
Colin Cross
6e0b9ecb50 Merge "toolbox/dmesg: do not hardcode KLOG_BUF_LEN" 2013-04-06 19:02:01 +00:00
Geremy Condra
e5920ffdca am a7096004: am 911ba269: Merge "Add -i option to toolbox cmd ls"
* commit 'a7096004f220dd7578d7b2e26a3513fa5efc0fc1':
  Add -i option to toolbox cmd ls
2013-04-04 23:46:55 -07:00
Geremy Condra
a7096004f2 am 911ba269: Merge "Add -i option to toolbox cmd ls"
* commit '911ba269e369035f9a4a250fa22233b37d724356':
  Add -i option to toolbox cmd ls
2013-04-04 23:42:16 -07:00
William Roberts
403b195548 Add -i option to toolbox cmd ls
Change-Id: I4690fc10dc07bf1883bcf8ec18399235dc97d317
2013-04-03 17:39:19 -07:00
James Sullins
edee93dc5b toolbox/dmesg: do not hardcode KLOG_BUF_LEN
Change-Id: Ia99654a53d6adfeba5a5088b7cff45c6e47b6188
2013-04-01 21:50:03 +05:30
Benoit Goby
c6d7e200ed toolbox: Make reboot a separate command from toolbox
Set the CAP_SYS_BOOT filesystem capability on the new reboot
command and keep CAP_SYS_BOOT in adb bounding set so that the
shell user can run it.

Change-Id: I1dd6143445ee2a952254f0452ab6e544318431dd
2013-03-26 12:24:10 -07:00
Benoit Goby
391f365c6d toolbox: Fix rm -f with multiple files
Only check errno if unlink returns -1.
Continue instead of exiting if one file does not exist.

Change-Id: Iaf01b8523b84e87fcb0d732b89b7be6e24279c0b
2013-03-25 19:59:21 -07:00
Dmitry Shmidt
4db7df71da toolbox: renice: Add -t TYPE parameter and switch to getopt
Change-Id: Idaedabe1505a9c373629ef1fd31aa4b4beb068c2
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-01-22 16:59:36 -08:00
Dima Zavin
487c4ea012 am 7ec62dbd: am 82ea44f8: Merge "Change setsebool syntax to be consistent with other init built-ins."
* commit '7ec62dbd9d2bd7369fa074bf002f642b03e6dd39':
  Change setsebool syntax to be consistent with other init built-ins.
2012-12-19 09:51:38 -08:00
Dima Zavin
82ea44f88f Merge "Change setsebool syntax to be consistent with other init built-ins." 2012-12-18 23:42:09 -08:00
Stephen Smalley
0e23fee505 Change setsebool syntax to be consistent with other init built-ins.
Change setsebool syntax from name=value to name value.
This is to make it consistent with setprop and similar commands.
Update both the init built-in command and the toolbox command
for consistency.

Change-Id: I2c8e016ba26731c4a2ad4a49ae3b89362bf8f8a8
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2012-12-13 15:41:53 -05:00