Commit Graph

7153 Commits

Author SHA1 Message Date
Pawel Dziepak
6003243ef3 util: introduce kernel utils for pseudorandom number generation
Currently there are two generators. The fast one is the same one the scheduler
is using. The standard one is the same algorithm libroot's rand() uses. Should
there be a need for more cryptographically PRNG MD4 or MD5 might be a good
candidates.
2013-04-11 04:34:59 +02:00
Pawel Dziepak
bf65fc1dfe vm: remove B_RANDOMIZED_IMAGE_ADDRESS address specification
This address specification is actually not needed since PIC images can be
located anywhere. Only their size is restriced but that is the compiler and
linker concern. Thanks to Alex Smith for pointing that out.
2013-04-09 22:09:13 +02:00
Pawel Dziepak
a8f8d2c057 x86_64: put user stack and team data at top of user address space 2013-04-04 20:54:56 +02:00
Pawel Dziepak
65ed4fa908 vm: implement B_RANDOMIZED_IMAGE_ADDRESS address specification
On some 64 bit architectures program and library images have to be mapped in
the lower 2 GB of the address space (due to instruction pointer relative
addressing). Address specification B_RANDOMIZED_IMAGE_ADDRESS ensures that
created area satisfies that requirement.
2013-04-04 20:54:02 +02:00
Pawel Dziepak
f697412ff8 vm: place commpage and team data near the top of user address space
Placing commpage and team user data somewhere at the top of the user accessible
virtual address space prevents these areas from conflicting with elf images
that require to be mapped at exact address (in most cases: runtime_loader).
2013-04-04 15:27:24 +02:00
Pawel Dziepak
e85e399fd7 commpage: randomize position of commpage
This patch introduces randomization of commpage position. From now on commpage
table contains offsets from begining to of the commpage to the particular
commpage entry. Similary addresses of symbols in ELF memory image "commpage"
are just offsets from the begining of the commpage.

This patch also updates KDL so that commpage entries are recognized and shown
correctly in stack trace. An update of Debugger is yet to be done.
2013-04-04 15:27:22 +02:00
Pawel Dziepak
966f207668 x86: enable data execution prevention
Set execute disable bit for any page that belongs to area with neither
B_EXECUTE_AREA nor B_KERNEL_EXECUTE_AREA set.

In order to take advanage of NX bit in 32 bit protected mode PAE must be
enabled. Thus, from now on it is also enabled when the CPU supports NX bit.

vm_page_fault() takes additional argument which indicates whether page fault
was caused by an illegal instruction fetch.
2013-04-04 15:22:23 +02:00
Pawel Dziepak
211f71325a x86: move x86_userspace_thread_exit() from user stack to commpage
x86_userspace_thread_exit() is a stub originally placed at the bottom of
each thread user stack that ensures any thread invokes exit_thread() upon
returning from its main higher level function.

Putting anything that is expected to be executed on a stack causes problems
when implementing data execution prevention. Code of x86_userspace_thread_exit()
is now moved to commpage which seems to be much more appropriate place for it.
2013-04-04 15:16:27 +02:00
Pawel Dziepak
b3e4c67739 vm: implement B_RANDOMIZED_ANY_ADDRESS address specification
Randomized equivalent of B_ANY_ADDRESS. When a free space is found (as in
B_ANY_ADDRESS) the base adress is then randomized using _RandomizeAddress
pretty much like it is done in B_RANDOMIZED_BASE_ADDRESS.
2013-04-04 15:16:21 +02:00
Pawel Dziepak
f9bab525f6 vm: implement B_RANDOMIZED_BASE_ADDRESS address specification
B_RAND_BASE_ADDRESS is basically B_BASE_ADDRESS with non-deterministic created
area's base address.

Initial start address is randomized and then the algorithm looks for a large
enough free space in the interval [randomized start, end]. If it fails then
the search is repeated in the interval [original start, randomized start]. In
case it also fails the algorithm falls back to B_ANY_ADDRESS
(B_RANDOMIZED_ANY_ADDRESS when it is implemented) just like B_BASE_ADDRESS does.

Randomization range is limited by kMaxRandomize and kMaxInitialRandomize.
2013-04-04 15:16:21 +02:00
Pawel Dziepak
3b4269ecf5 arch: randomize initial user stack pointer
Inside the page randomization of initial user stack pointer is not only a part
of ASLR implementation but also a performance improvement that helps
eliminating aligned 64 kB data access.

Minimal user stack size is increased to 8 kB in order to ensure that regardless
of initial stack pointer value there is still enough space on stack.
2013-04-04 15:16:20 +02:00
Michael Lotz
a9abcc37cd Rework initial auto joining and add big TODOs.
* If we have a configured network, then we always try to connect to it
  as soon as the interface has been brought up.
* If we don't have a configured network and are auto configuring, we
  use the AutoconfigLooper to also do initial auto joins.
* Before issuing auto joins we need to wait for scan results to come
  in, so we watch for corresponding messages.

For now auto joining is a one shot attempt as the infrastructure to
properly tell reasons for scans apart is not yet there.
2013-04-02 04:59:44 +02:00
Michael Lotz
6de478363e Add BMessenger::SetTo() to reinitialize a BMessenger.
This allows to reuse BMessenger objects for different targets, or to
recheck validity after initial creation. With that one can use the same
BMessenger after launching an application that was previously not found
valid for example.
2013-03-31 20:16:04 +02:00
Alex Smith
5e0c3db286 Account for the physical map area in the kernel VM space. Fixes #9547.
The physical memory map area was not included in the kernel virtual
address space range (it was below KERNEL_BASE). This caused problems
if an I/O operation took place on physical memory mapped there (the
bad address error seen in #9547 was occurring in lock_memory_etc()).
Changed KERNEL_BASE and KERNEL_SIZE to cover the area and add a null
area that covers all of it. Also changed X86VMTranslationMap64Bit to
handle large pages in Query(), as the physical map area uses large
pages.
2013-03-22 18:30:01 +00:00
Axel Dörfler
928001cea9 Further tuned AMD CPU identifier parsing.
* Thanks to a list of 1384 entries with AMD CPU identifiers from Alex.
2013-03-22 09:37:47 +01:00
Axel Dörfler
df4d35e837 Added a parse_amd() for CPU identification.
* This parses the reported CPU name, and tries to translate it to a normal
  and concise identifier.
* For example, it will translate "AMD FX(tm)-8320 Eight-core Processor" into
  "FX™ 8320" or "Dual Core AMD Opteron(tm) Processor 275 HE" into
  "Opteron™ 275 HE".
* This means we can remove AMD strings for those models for which this
  function produces useful results.
2013-03-20 21:04:23 +01:00
Alexander von Gluck IV
190423a656 cpu_type: Add model 2 AMD FX CPU 2013-03-20 13:15:28 -05:00
John Scipione
ab21cedcce Remove docs and refactor style of TextView class.
* Make pointer style consistent, const char* name instead of const char *name.
* Lots of parameter renaming.
* in parameters don't get anything special, just font, or length instead of
  inFont, inLength.
* out parameters get a leading _ so *outWidth becomes *_width for example.
* We don't detail private function in the Haiku book and this class has a bunch
  so keep the documentation in the file but use regular comments instead.
* Normalize the parameter names between cpp file and header.
* Some minor whitespace fixes.

No functional change intended.
2013-03-16 17:05:09 -04:00
Pawel Dziepak
7f61e6e4e5 Merge branch 'nfs4'
Conflicts:
	build/jam/HaikuImage
2013-03-11 13:00:55 +01:00
Michael Lotz
4a0460a9bc Add generic unlock key setting and removal.
* Replace {Set|Remove}MasterKey() by generic {Set|Remove}UnlockKey()
  that works on a keyring.
* Implement {Set|Remove}MasterUnlockKey() on top of that.
* Rename the commands and constants accrodingly.
* Implement setting and removing keyring unlock keys.
2013-03-05 11:04:57 -05:00
Michael Lotz
d4d6d12393 Don't require a key when creating a new keyring.
There will be key setting/removal functions so the step of adding the
keyring and setting a key on it can be done individually.
2013-03-05 11:04:53 -05:00
Michael Lotz
8775bd129d Remove old TODO as we don't support multiple instances for now.
As there aren't any more generic meta data containers inside BKey,
there's no real way to distinguish different instances with the same
identifiers. This may be added later, for example the same index system
as used in BMessage could apply.
2013-03-05 11:04:51 -05:00
Michael Lotz
f8ccc32326 Remove the API part of the concept of apps per key.
The application access concept is on the keyring level only for now.
Generally it probably would get pretty complicated and therefore harder
to use when application access needs to be granted on a per key basis.
2013-03-05 11:04:33 -05:00
Michael Lotz
c8ae843f3d Rename keyring "access/revoke" to "unlock/lock".
The unlock/lock concept just seems easier to grasp and is used in
various similar tools as well.
2013-03-05 11:04:30 -05:00
Michael Lotz
64ca113fe0 Add keyring specific versions of the *Application() methods. 2013-03-05 11:04:10 -05:00
Michael Lotz
51ab46a83c Remove the purpose argument from all GetKey() variants.
The type is relevant and required as it determines the type of the
handed in key. The purpose however isn't actually needed and rather
inconvenient to get by depending on the situation.
2013-03-05 11:04:08 -05:00
Michael Lotz
94f897deea Make Flatten/Unflatten public and remove IsRegistered().
The BKey doesn't know anything about the keyring concept, so the
registered info isn't really useful. May be re-added later with
keyring info as well.
2013-03-05 11:04:02 -05:00
Michael Lotz
5d4a0da455 Remove unneeded master access revoke command.
Revoking master access currently simply means to revoke access
to the default keyring.
2013-03-05 11:00:03 -05:00
Michael Lotz
d962e21058 Add B_KEY_PURPOSE_KEYRING for keyring keys. 2013-03-05 10:59:57 -05:00
Michael Lotz
c494c06109 Add B*Key::PrintToStream() method for debugging convenience. 2013-03-05 10:59:51 -05:00
Michael Lotz
005a15bbcd Move keystore message constants and use a messenger.
* The keystore backend will (at least for the time being) reside in a
  separate server. This one can be reached via normal messaging, so use
  a BMessenger for sending key messages.
* Move the message constants from RegistrarDefs.h into a new
  KeyStoreDefs.h that also contains the server signature.
* Update the message constants to reflect the new situation.
2013-03-05 10:59:47 -05:00
Michael Lotz
1c3996496b Implement all KeyStore methods except for password generation.
* Add all relevant message constants.
* Implement the messaging to send/retrieve key info.
* Implement _Flatten/_Unflatten for sending flat BKey objects.
* Remove application list from BKey, the key can't only differ by
  allowed applications as the identifiers would still collide, so the
  comparison isn't needed to uniquely identify the key. The applications
  can be enumerated via the BKeyStore instead.
2013-03-05 10:59:46 -05:00
Michael Lotz
b73982892d Rename [Un]Register* functions to Add/Remove*. 2013-03-05 10:59:44 -05:00
Michael Lotz
dc1acef865 Flesh out the API and implement stubs.
* Modified the API greatly to be based on BKey* instead of BPassword*.
* Added BKeyPurpose and used it instead of BKeyType. It is supposed to
  indicate the purpose of a key so that an app can look up keys on a
  more granular level. The BKeyType on the other hand actually
  identifies the type (i.e. subclass of BKey) so an app knows how to
  handle a given key or may only enumerate/use keys it is compatible
  with.
* Made everything based on a raw data buffer for now, only BPasswordKey
  is implemented yet which stores the (0 terminated) string into that
  data buffer.
* Removed the additional data BMessage as I don't yet see where it fits
  in. While I could imagine adding meta data to a key may be nice it
  might be an interoperability concern when keys are shared by
  different apps.
* Moved the app functions to the keystore as per the TODO, but not sure
  how to actually implement them.
2013-03-05 10:59:43 -05:00
Michael Lotz
3b3884d9ee KeyStore and Key interface/stubs draft per Axel Dörfler.
A draft API and (mostly) stubs to back it up. Initial import of yet
unmodified sources.
2013-03-05 10:59:41 -05:00
Tri-Edge AI
49126a0e9b Added ResourceEdit and modified BColumnListView, BRow and BMenu.
Signed-off-by: Matt Madia <mattmadia@gmail.com>
2013-02-27 22:08:46 -05:00
John Scipione
5dd0761042 Move BVolumeRoster docs to Haiku Book.
With this commit every class in the storage kit is now documented
in the Haiku book!

Thanks to Ingo, Axel, Vincent Dominguez, Tyler Dauwalder, and
everyone who helped document these classes.
2013-02-22 18:11:14 -05:00
John Scipione
9d5f5318a5 Move BVolume docs to the Haiku book 2013-02-21 20:15:53 -05:00
John Scipione
434716ced8 Add BSymLink class docs to Haiku Book 2013-02-20 16:20:53 -05:00
John Scipione
6d5fae2a5a Move resources docs to Haiku Book
* Remove docs from Resources.cpp (leaving the brief description).
* Reformat Resources.h to style it like so many other header files.
* There is one not-entirely style based change. I renamed the outSize
  parameter or the LoadResource method to _size as is our convention for out
  parameters.
2013-02-18 18:14:10 -05:00
John Scipione
0a9ac70aea Move BQuery docs into Haiku Book.
... removing the docs from the .cpp and .h files and cleaning up as usual.
2013-02-14 19:36:33 -05:00
John Scipione
66e9410806 Switch about window to current workspace if hidden. 2013-02-11 21:25:51 -05:00
John Scipione
9f7ac4312a Add methods to get and set the name, version, and icon 2013-02-11 21:17:57 -05:00
Hamish Morrison
2675e31a0c BUrlRequest: fix various issues
* Remove unused headers interface from BUrlProtocol
* Change confusing function names
* Style fixes and whitespace cleanup
2013-02-10 20:46:24 +00:00
Hamish Morrison
64a1f5a020 NetworkCookieJar: various small fixes and updated tests 2013-02-09 17:10:10 +00:00
Hamish Morrison
c8bc218363 NetworkCookie: fix domain/path matching, and validity checks 2013-02-09 17:10:05 +00:00
Hamish Morrison
33462ef54a NetworkCookie: bring SetCookie parsing in line with RFC 6265 2013-02-09 17:09:53 +00:00
Hamish Morrison
2db5d2bc95 NetworkCookie: remove unused cookie attributes and add HttpOnly 2013-02-09 16:09:34 +00:00
Hamish Morrison
05f42aaba4 NetworkCookie: set the default path according to RFC 6265 2013-02-09 16:02:15 +00:00
John Scipione
4c064a8451 Move documentation from Path.cpp to Path.dox
And clean it up a bit. Kept brief description in source.
* Also added Axel to authors in Path.dox and Path.cpp because his name
  appears in git blame as working on the docs and code for the file.
  I hope he doesn't mind.
2013-02-09 00:39:53 -05:00