Commit graph

95 commits

Author SHA1 Message Date
Aleksey Bragin 379a429aa9 - Remove autoupdated "$Id:" lines from the kernel source code.
svn path=/trunk/; revision=32623
2008-03-09 14:11:42 +00:00
Aleksey Bragin fffed3ea73 - SeSet/QuerySecurityAccessMask() should initialize DesiredAccess to 0 (inspired by 30154).
svn path=/trunk/; revision=30170
2007-11-05 12:58:03 +00:00
Art Yerkes 4c33a58449 Mask values that control inheritability of the handle, and don't affect access.
svn path=/trunk/; revision=28973
2007-09-09 12:21:22 +00:00
Hervé Poussineau 478a0d960b ReactOS now supports ACLs... (fix SeAccessCheck to sometimes deny access)
svn path=/trunk/; revision=27409
2007-07-05 17:01:02 +00:00
Hervé Poussineau 55f2798900 Replace tabs by spaces. No code change
svn path=/trunk/; revision=27366
2007-07-02 22:39:11 +00:00
Alex Ionescu 71e781df12 - Fix NPX check in context switcher.
- Fix ObLogSecurityDescriptor.
- Fix some missing features in SeAccessCheck.

svn path=/trunk/; revision=26140
2007-03-19 19:05:39 +00:00
Hervé Poussineau b0385e2a41 Fix SeAccessCheck to perform correct checks.
When returning STATUS_ACCESS_DENIED when required (currently disabled), ReactOS boots up to login screen on 3rd boot.
Now, we just need to fix callers.

svn path=/trunk/; revision=26130
2007-03-18 12:47:27 +00:00
Alex Ionescu bdc7f65b2d - Rename KiSetSystemTime to KeSetSystemTime and enhance prototype for later use.
- Create Phase 1 initialization for the SRM (SeInitSystem). Right now it inserts the system boot token into object manager, which is something we forgot to do before.
- Renamed ExPhase2Init to Phase1Initialization, since it's not Phase 2.
- Updated Phase 1 PS Initialization to get the KeLoaderBlock pointer and use it as a context parameter when calling Phase1Initialization.
- Split off Phase1Initialization into Phase1InitializationDiscard, which is the bulk of the phase 1 code (99% of it) and can be put in an .INIT section to be freed after boot.
- Modify parts of the Inbv setup code. Also implement support for /SOS, and try to mimic its behaviour on NT (not fully achieved). You will need /SOS to see boot messages on the screen! FreeLDR now adds this by default to the "Debug "configuration.
- Temporarily disable ReactOS Banner during boot. We will get this data from the .mc/.res file in a later patch instead of hard-coding it.
- Optimize calling and usage of ExpLoadInitialProcess.
- Add support for Y2K bug fix documented for Windows NT (/YEAR).
- Add support to detect WinPE/MiniNT/ReactOS Live CD.
- Add temporary debugging code to MmInit2 and some Mm functions to detect if these functions are being used too early, which could result in catastrophic to subtle bugs.
- Add more bugchecks when failures occur, and enhance others. Also add more codes to ntoskrnl.mc.
- Disable calls to ObfDereferenceDeviceMap since it's not yet implemented.

svn path=/trunk/; revision=25624
2007-01-25 01:13:09 +00:00
Alex Ionescu 5676292f72 - Complete the hack that's already in SeAccessCheck to also return STATUS_SUCCESS if we return TRUE always. Otherwise, code might weirdly fail.
- Save parent directory during lookups and check if the caller has the right to traverse it, if we ever need to.
- Optimize the configuration of the lookup context so that it's only done when necessary, add stub calls to lock the directory.

svn path=/trunk/; revision=25396
2007-01-09 09:30:43 +00:00
Alex Ionescu 8f2eb74d99 - Fix OB_SECURITY_METHOD prototype, callers, and implementors.
- Add call to SeOpenObjectAuditAlarm in ObCheckObjectAccess.
- Start adding Ob Callout validation on checked builds. For now only done around security functions.
- Set *MemoryAllocated to FALSE in ObGetObjectSecurity early on to avoid inconcistent state if the callback failed.
- Implement new XP function ObSetSecurityObjectByPointer and simplify NtSetSecurityObject by making it use it.
- More Win 2003 SecurityDescriptor Cache functions to sdcache instead of obsecure.c.

svn path=/trunk/; revision=25240
2006-12-29 22:17:29 +00:00
Alex Ionescu c39989df1b - Fix SleepEx.
- Put volatile statements in EX_RUNDOWN_REF, IRP, DEVICE_OBJECT, ERESOURCE, FILE_OBJECT, IO_REMOVE_LOCK, WORK_QUEUE_ITEM where required (thanks to Microsoft's changes in the WDK to mark the fields properly).
- Update FILE_OBJECT definition.
- Add some asserts to some I/O functions.
- Add stub support for File Objects created by XP+ Drivers which have File Object Extensions.
- Add some fixes to IopDeleteFile, including proper reference counting for the DO and VPB, as well as cleanup when the file is closed without a handle.
- Fix a bug in IopSecurityFile.
- Queue and unqueue IRPs in all I/O functions.
- Fully support IRP cancellation now.
- Fix critical bugs in NtDeviceIoControlFile and NtDeviceFsControlFile which were causing double queueing of IRPs and freeing of invalid memory, as well as invalid paramter checking for user-mode buffers.
- Add exhaustive validation checks to IoCreateFile, add more failure cases, and validate the EA buffer. Also support IO_ATTACH_DEVICE_API flag.
- Implement IoCreateStreamFileObjectEx and IoCreateStreamFileObjectLite and fix several bugs in the original implementation of IoCreateStreamFileObject.
- Fix a bug in RtlRaiseException.
- Update Io*ShareAccess routines to support XP+ style semantics related to special File Object flags which disable their use.
- Add validation to all Query/Set routines so that information clasess, lengths, buffers and alignment are properly checked.
- Also add an array for the proper acess rights that each query/set operation requires.
- Check backup/restore privileges during I/O File operations.
- Check traverse access during I/O File Operations.
- Check access privileges to the device during I/O file operations.
- Rename IopReferenceDeviceObject and also verify if an exclusive DO is trying to be invalidly opened.
- Support various extra security checks during I/O File/Device Parse Routine.
- Fix a bug during IopCleanupIrp so that we don't dereference the File OBject if this was a create operation.
- Fix some bogus asserts in IofCompleteRequest, and save the IRP Flags before signalling it's event, since the driver might've freed it behind our back.
- Fix a large bug in ObInsertObject which affected the insert of unnamed objects with forced security options (Such as process/threads).
- Fix the creation of the Process/Thread/Job Obejct Types to that security information is forced.
- Remove "Fix PS!!!" messages since the bug is now fixed and these objects now get proper security descriptors.
- Fix another bug in ObInsertObjet which wasn't properly validating user-mode objects and always assumed kernel mode.
- Silence multiple trace/checkpoint messages that have accumulated throughout time for various debugging purposes.

svn path=/trunk/; revision=25118
2006-12-10 18:40:30 +00:00
Alex Ionescu 6d56cb39a6 - Fix dozens of missing typecast errors.
- Other MSVC/WDK compatibility fixes.

svn path=/trunk/; revision=24657
2006-10-26 01:49:51 +00:00
Alex Ionescu 2e1f5d46f3 - Add some missing definitions to our NTIFS.h.
svn path=/trunk/; revision=24637
2006-10-23 21:24:16 +00:00
Alex Ionescu 1bf94f2a3a - Add NtEnumerateSystemEnvironmentValuesEx, NtQuerySystemEnvironmentValueex, NtSetSystemEnvironmentValueEx.
- Fix some build brtakage.

svn path=/trunk/; revision=24631
2006-10-23 18:21:31 +00:00
Alex Ionescu 4fda8d1bb7 - Add NtAccessCheckAndAuditAlarm, NtAccessCheckByType, NtAccessCheckByTypeAndAuditAlarm, NtAccessCheckByTypeResultList, NtAccessCheckByTypeResultListAndAuditAlarm, NtAccessCheckByTypeResultListAndAuditAlarmByHandle, NtAccessCheckByTypeResultListAndAuditAlarmByHandleByGodHowMuchLongerCanTheseAPINamesGet.
- Last one is a joke.

svn path=/trunk/; revision=24626
2006-10-23 17:47:40 +00:00
Hervé Poussineau 48a7051b20 Correctly return FALSE in SeAccessCheck if access is not granted
Don't always check the first ace in the DACL

svn path=/trunk/; revision=24533
2006-10-15 23:31:16 +00:00
Hervé Poussineau 09da758c64 Don't force a security descriptor to have an owner
svn path=/trunk/; revision=24532
2006-10-15 21:24:21 +00:00
Alex Ionescu 04c5f92621 - Combine SeInit1 and SeInit2 into SeInit since both can be done together now.
- Call PsInitSystem instead of PspInitPhase0, since PsInitsystem is the "external" phase-choosing routine.
- Implement ExComputeTickCountMultiplier to create a 24-bit precision remainder + whole integer of the ms/clock tick used in SharedUserData.
- Set the OS version and Machine Type (i386/PPC (<3 Arty) in SharedUserData.
- Move some HAL calls in Phase 2 (actually Phase 1...), same for KeInit2.
- Break into KDBG a bit earlier.

svn path=/trunk/; revision=24363
2006-10-02 15:52:58 +00:00
Alex Ionescu 78ef70deda - Fix one of the oldest hacks in ReactOS: KeGetCurrentThread() and PsGetcurrentProcess used to be NULL during early boot stage. We also didn't have an official idle therad/process. Also system intialization was not in its sepearte thread. Changes:
- Implemented SeAssignPrimaryToken.
   - Setup Boot/System Token for Idle Process in SeInit2.
   - Remove ROS hack in SeCaptureSubjectContextEx.
   - Call SeAssignPrimaryToken in PspInitializeProcessSecurty when called for the Initial Process creation.
   - Implement PsInitiailizeQuotaSystem and set PspDefauptQuotaBlock for the idle process so that it can be used for the initial process.
   - Rewrite Process Manager Phase 0 initialization from scratch, to create a new initial system process and thread which will be used for Phase 1 (in ROS, phase 2) initialization of the executive.
   - Fix a bug in PspCreateProcess which was using an uninitialized value of SectionObject in some cases, instead of NULL.
   - Call PsInitailizeQuotaSystem from ObInit, and also create the system handle table inside the idle process, and make it the ObpKernelHandleTable.
   - Do Executive Phase 0 Initialization at APC_LEVEL.
   - Start idle thread at HIGH_PRIORITY then lower it to 0 once the Initial Thread is setup, so that it can run, then keep priority to 0 at DISPATCH_LEVEL and jump into idle loop code.
   - Add NtYieldExecution to idle loop code since it's now being used.
   - Fix IoGetCurrentProcess which was previously hacked.
   - Remove some checks for Thread == NULL in ke_x.h, since this is now impossible.
   - Split Phase 0/1 initialization in ex\init.c, since one runs in a separate thread now. Also don't lower IRQL to PASSIVE_LEVEL anymore (run at APC_LEVEL).

svn path=/trunk/; revision=24148
2006-09-16 20:37:49 +00:00
Alex Ionescu 35778c9f25 - If SeCaptureSubjectContextEx is called without a process, at least NULL-initialize the context to catch dereferences of invalid pointers.
svn path=/trunk/; revision=23698
2006-08-25 01:04:44 +00:00
Alex Ionescu 1223ca9cab - Refactor SeCaptureSubjectContext into SeCaptureSubjectContextEx and SeCreateAccessState into SeCreateAccessStateEx. The *Ex routines allow specifying a custom process/thread which isn't the current one. This is useful when creating a new process or thread since we're not actually in it.
- Implemented a bit more security calls in PspCreateProcess as seen in WI II. We now create an AccessState.
- Also write the PID in the ObjectTable.

svn path=/trunk/; revision=23236
2006-07-23 08:20:57 +00:00
Alex Ionescu a92eec4397 - SeAccessCheck should assume failure if no SD was passed. Also fixes bugcheck on startup since processes don't currently have SDs.
svn path=/trunk/; revision=23235
2006-07-23 07:24:20 +00:00
Alex Ionescu d2e356eda6 - Implement Fast Referencing and fix EX_FAST_REF definition.
- Implement ObReferenceEx and ObDereferenceEx.
- Split off ObpDeferObjectCompletion. A new win2003/vista API requires direct acess to being able to defer deletes.
- Fix some bugs in Process Token management and make it all properly use Fast Referencing.
- When duplicating a token in a new process, don't de-reference it before it's even created, and also insert it.
- Change ExpChangeRundown macro to fix warnings in msvc.

svn path=/trunk/; revision=23013
2006-07-11 19:45:16 +00:00
Alex Ionescu c97cf6645c - Remove ROS-internal object macros and use the public ones in obtypes.h instead.
svn path=/trunk/; revision=22045
2006-05-25 20:14:09 +00:00
Alex Ionescu 68121865ba - Wipe out PROS_OBJECT_HEADER and use OBJECT_HEADER since we are now compatible.
svn path=/trunk/; revision=22016
2006-05-24 20:13:47 +00:00
Alex Ionescu 8481c1fa10 - NDK 0.98, now with versionned headers. Too many changes to list, see the TinyKRNL SVN Logs for more detailed information. Thanks to Andrew (Wax), Thomas and Aleksey for testing.
svn path=/trunk/; revision=21880
2006-05-10 17:47:44 +00:00
Thomas Bluemel 7caea251af protect access to buffers with SEH in NtSetSecurityObject and NtQuerySecurityObject and ask for the proper access rights
svn path=/trunk/; revision=20455
2005-12-30 01:41:02 +00:00
Alex Ionescu caaa37c1ac - Support INIT section pragmas for msvc. Patch by Brezenbak.
svn path=/trunk/; revision=19732
2005-11-28 23:25:31 +00:00
Alex Ionescu c1da20b370 - Make the NDK compatible with the MSDDK again.
- Fix some w32api incompatibility cruft since w32api insists on including winnt.h from kernel-mode.
- Fix some stuff that was including both kernel-mode and user-mode headers together.
- Use PISECURITY_DESCRIPTOR, not PSECURITY_DESCRIPTOR.

svn path=/trunk/; revision=19726
2005-11-28 21:40:21 +00:00
Alex Ionescu 11272023e5 Part 1 of <many> ntoskrnl header cleanups
svn path=/trunk/; revision=17844
2005-09-13 23:28:21 +00:00
Hartmut Birr d921a7ca15 Clear the memory after we know that the buffer was allocated.
svn path=/trunk/; revision=17308
2005-08-11 20:37:09 +00:00
Alex Ionescu b1b87307bb - Initialize more fields when creating an Object Type
- Correct the Pool Charge for Object Types, select a Default Object, always use a security procedure, read global flag for maintaing type lists, set the pool type
- Initialize a Default Wait Object.
- Fix security callback for objects.
- Implement SeDefaultObjectMethod for security callbacks of objects which don't have a custom one.

svn path=/trunk/; revision=17176
2005-08-07 18:38:37 +00:00
Filip Navara f89cc27ede Cleanup SID initialization and fill all SeExports fields.
svn path=/trunk/; revision=16936
2005-08-01 09:05:20 +00:00
KJK::Hyperion 321df5d69c Partial merge from the ROX-U branch (various fixes for Visual C++ compilation, see logs for r16198 and r16208)
svn path=/trunk/; revision=16212
2005-06-21 23:42:58 +00:00
Alex Ionescu b09db8ab65 Nonpaged Pool Liberation Day: Allow PagedPool to be used earlier, allow fast mutex to be used earlier on debug builds. Allocate all Se stuff from PagedPool, set the right object types to use paged pool, allocate all strings from paged pool, allocate PE sections from paged pool, and a bunch of other things which should, imo, be in paged pool. If anyone has any contradicting proof, let me know...until then, enjoy ~4-6MB more NonPagedPool
svn path=/trunk/; revision=15492
2005-05-25 04:16:56 +00:00
Steven Edwards 7fb3ebb9f9 move the rest of the alread defined tags to the private tag.h
svn path=/trunk/; revision=15427
2005-05-20 04:33:47 +00:00
Alex Ionescu 00fe79ff10 Object Manager Patch. This patch continues the work done in the previous patch and makes the following changes in order to support OB 2.0 (it basically temporarily fixes a highly incorrect implementation so that caller code will be ready to work with the OB 2.0 without change):
1) The documented Object Create Information Structure and semantics implemented. All Object Attributes and passed data from user-mode is now probed and saved into this object create structure when ObCreateObject is called.
2) ObCreateObject does NOT PERFORM ANY OTHER OPERATION EXCEPT CREATING THE OBJECT ANYMORE. ObCreateObject will NOT insert the Object into the tree and other operations. These are now done correctly by ObInsertObject. Therefore, the biggest hurdle was changing pieces of code which assumed ObCreateObject would be enough.
3) ObInsertObject uses the captured create info for all operations isntead of the Object Attributes.
4) ObFindObject now uses the captured info as well.
5) The OBject name and directory are now stored in the documented Object Name Information, always allocated and freed from non paged pool.

HACKS:
5) Because the registry code is horribly broken and doesn't use ObFindObjectByName, the old ObFindObject had to be temporarily duplicated into CmpFindObject.
7) Win32k used ObInsertObject in CsrInsertObject as a way to create a handle inside csrss. However, OBInsertObject now does more then this. As a temporary hack, ObpCreateHandle is exported from the kernel and called from win32k. A fix needs to be done for this, but I don't know the design of win32k+csrss well enough to find a solution.
8) SEH has been commented out in some places of the new probing code because it breaks smss and explorer. These need to be investigated (seh did not exist in the previous code, so this is not really a hack)
9) Named objects with a parent directory are NOT allowed. However because of bugs in kernel32, the new check has been temporarily disabled. (this check did not exist in the previous code, so this is not really a hack)

The next patch will add a proper ObFindObject which will support a more complete Parse Procedure with context and security information. This is needed for proper registry access (requested by Eric Kohl) and for proper functionality of the Desktop/File creation, which should use the Parse routine, and not the Create Handle Routine. This will also make it possible to remove some previous hacks and pave the way for a fixed Iop/IoCreateFile

svn path=/trunk/; revision=15395
2005-05-18 19:26:47 +00:00
Steven Edwards e4be245882 strip whitespace from end of lines
svn path=/trunk/; revision=15164
2005-05-09 01:38:29 +00:00
Thomas Bluemel ea5929db62 1. added irql checks to various rtl and security functions
2. RtlGetVersion needs to be implemented differently in ntoskrnl and ntdll, ntoskrnl's version must not access the PEB (which might not be present) while ntdlls gets most information from the PEB structure
3. can't use spinlocks to serialize access to the security descriptor cache since it calls sd rtl functions which require to run < apc level

svn path=/trunk/; revision=13712
2005-02-22 17:58:19 +00:00
Alex Ionescu fe6116543e Standardize comment headers. Patch by Trevor McCort
svn path=/trunk/; revision=13311
2005-01-26 13:58:37 +00:00
Thomas Bluemel 72ae3c4197 1. A few Nt vs. Zw fixes
2. Fixed and extended RtlCaptureUnicodeString()
3. securely access buffers in NtQuerySystemEnvironmentValue() and NtSetSystemEnvironmentValue() and check for required SeSystemEnvironmentPrivilege privilege

svn path=/trunk/; revision=13208
2005-01-22 12:20:12 +00:00
Alex Ionescu afbaa12f82 Fix my previous patch and fix ACCESS_TOKEN being declared as a structure. This is incompatible with DDK/W32API because ACCESS_TOKEN is a PVOID. The real structure is TOKEN. Also, structure has been updated.
svn path=/trunk/; revision=12740
2005-01-02 23:12:40 +00:00
Gunnar Dalsnes 24dc4f3595 add missing KeEnter/LeaveCriticalRegion before/after aquireing/releasing resource lock
svn path=/trunk/; revision=11755
2004-11-21 18:35:05 +00:00
Eric Kohl 7cd6c44a8a - Move NtAllocateUuids from the Security Reference Monitor to the Executive.
- Update NtAllocateUuids to W2K signature.
- Add NtSetUuidSeed.

svn path=/trunk/; revision=11628
2004-11-12 12:06:54 +00:00
Thomas Bluemel 4a6dd7de44 fixed prototypes of NtSetEvent(), NtResetEvent(), NtQueryEvent(), NtPulseEvent(), NtOpenEvent() and NtCreateEvent()
svn path=/trunk/; revision=11417
2004-10-24 15:26:14 +00:00
Eric Kohl 2a175cb990 Use upper-case ASSERT macros.
svn path=/trunk/; revision=11393
2004-10-22 20:57:39 +00:00
Art Yerkes 9fd341c9ae Zero the new descriptor so that the Dacl, Sacl etc pointers will be zeroed
if not initialized.  cygwin was exercising this.

svn path=/trunk/; revision=11138
2004-10-01 01:28:56 +00:00
Gé van Geldorp 79c3ba475a SeAccessCheck() returns TRUE on success
svn path=/trunk/; revision=11044
2004-09-25 08:49:06 +00:00
Art Yerkes 0089446cc6 cm/regfile.c, ldr/init.c, ldr/loader.c: OBJ_CASE_INSENSITIVE patch I proposed
on the list.  This makes the registry, and dll loading case insensitive when
we are on a case preserving filesystem.

ntoskrnl/ex/power.c: My own contributions to the poweroff message list.

ntoskrnl/mm/npool.c: Fixed bit-rot in whole page alloc.  That's how i found
the bug below.

se/semgr.c, lib/rtl/sd.c:
semgr, when creating a SECURITY_DESCRIPTOR, anded the PRESENT and DEFAULT
flags rather than oring them for group, dacl, and sacl, leading to
RtlLengthSecurityDescriptor giving the wrong length to sdcache.  When
sdcache would copy the security descriptor, it would be too short, and
the bound check from the whole-page allocator would go off.  I fixed this
and made rtl/sd.c use the ROUND_UP macro and RtlLengthSid.  This is cleaner.
It may not be completely correct yet but it no-longer truncates security
descriptors into the cache, which means that the Owner, Group and etc
SIDs should now actually work right when coming from the cache, no matter
what happens in the heap.  They probably seemed to work before simply
because they trashed the ends of their blocks and never moved in the
cache.

svn path=/trunk/; revision=11040
2004-09-25 06:41:16 +00:00
Eric Kohl 4a4dcb92cf Implement SeLockSubjectContext and SeUnlockSubjectContext.
svn path=/trunk/; revision=10855
2004-09-14 11:04:48 +00:00