HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Can't get core dump from apache
Operating System - HP-UX
1830136
Members
2950
Online
109999
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2007 10:53 AM
05-27-2007 10:53 AM
Can't get core dump from apache
I am finding that in HP-UX 11.00 and 11.11, any program that calls setgid() will fail to produce a core dump, which is contrary to the documentation
I am trying to debug a problem in an apache module that is ocassionally leading to a segmentation fault. I have tried using the CoreDumpDirectory directive to dump into a world writable place (/tmp), but still no luck. On further investigation, it looks like the problem may be with HP-UX.
According to the signal(5) (HP-UX 11.11) manual page:
B If following conditions are met, generate a core image file (see core(4)) in the current working directory of the receiving process:
o The effective user ID and the real user ID of the receiving process are equal.
o The effective group ID and the real group ID of the receiving process are equal.
o A regular file named core does not exist and can be created, or exists and is writable.
When the USER and GROUP directives are used, apache uses setgid() and setuid() to morph itself into the specified user. Even though this sets all of the effective, real and saved user and group IDs, it seems to prevent core dumps from the process.
I can demonstrate this using the following simple program. Note that I run this as root. User www is defined in /etc/passwd as uid=30, group=1 (other). I run the program from /tmp to ensure world writability and delete any core file from /tmp beforehand.
#include
#include
#include
void causeabort(void);
int main(int argc, char **argv)
{
struct rlimit rlp;
gid_t egid, rgid, sgid;
uid_t euid, ruid, suid;
if (setgid(1) == -1) perror("setgid");
if (initgroups("www", 1) == -1) perror("initgroups");
if (setuid(30) == -1) perror("setuid");
getresgid (&rgid, &egid, &sgid);
getresuid (&ruid, &euid, &suid);
printf("euid = %d, ruid = %d, suid = %d\n", euid, ruid, suid);
printf("egid = %d, rgid = %d, sgid = %d\n", egid, rgid, sgid);
getrlimit(RLIMIT_CORE, &rlp);
printf("Core dump limit is %d (max %d)\n", rlp.rlim_cur, rlp.rlim_max);
causeabort();
}
void causeabort(void)
{
char *p = (char *) 123;
*p = 0;
}
This program outputs:
euid = 30, ruid = 30, suid = 30
egid = 1, rgid = 1, sgid = 1
Core dump limit is 2147483646 (max 2147483647)
Bus error
No dump is produced.
If I comment out the line that does setgid(), the group remains 3 (sys), and I get this:
euid = 30, ruid = 30, suid = 30
egid = 3, rgid = 3, sgid = 3
Core dump limit is 2147483646 (max 2147483647)
Bus error(coredump)
What am I missing?
I am trying to debug a problem in an apache module that is ocassionally leading to a segmentation fault. I have tried using the CoreDumpDirectory directive to dump into a world writable place (/tmp), but still no luck. On further investigation, it looks like the problem may be with HP-UX.
According to the signal(5) (HP-UX 11.11) manual page:
B If following conditions are met, generate a core image file (see core(4)) in the current working directory of the receiving process:
o The effective user ID and the real user ID of the receiving process are equal.
o The effective group ID and the real group ID of the receiving process are equal.
o A regular file named core does not exist and can be created, or exists and is writable.
When the USER and GROUP directives are used, apache uses setgid() and setuid() to morph itself into the specified user. Even though this sets all of the effective, real and saved user and group IDs, it seems to prevent core dumps from the process.
I can demonstrate this using the following simple program. Note that I run this as root. User www is defined in /etc/passwd as uid=30, group=1 (other). I run the program from /tmp to ensure world writability and delete any core file from /tmp beforehand.
#include
#include
#include
void causeabort(void);
int main(int argc, char **argv)
{
struct rlimit rlp;
gid_t egid, rgid, sgid;
uid_t euid, ruid, suid;
if (setgid(1) == -1) perror("setgid");
if (initgroups("www", 1) == -1) perror("initgroups");
if (setuid(30) == -1) perror("setuid");
getresgid (&rgid, &egid, &sgid);
getresuid (&ruid, &euid, &suid);
printf("euid = %d, ruid = %d, suid = %d\n", euid, ruid, suid);
printf("egid = %d, rgid = %d, sgid = %d\n", egid, rgid, sgid);
getrlimit(RLIMIT_CORE, &rlp);
printf("Core dump limit is %d (max %d)\n", rlp.rlim_cur, rlp.rlim_max);
causeabort();
}
void causeabort(void)
{
char *p = (char *) 123;
*p = 0;
}
This program outputs:
euid = 30, ruid = 30, suid = 30
egid = 1, rgid = 1, sgid = 1
Core dump limit is 2147483646 (max 2147483647)
Bus error
No dump is produced.
If I comment out the line that does setgid(), the group remains 3 (sys), and I get this:
euid = 30, ruid = 30, suid = 30
egid = 3, rgid = 3, sgid = 3
Core dump limit is 2147483646 (max 2147483647)
Bus error(coredump)
What am I missing?
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2007 05:46 PM
06-05-2007 05:46 PM
Re: Can't get core dump from apache
So, am I just out of luck here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2007 07:11 PM
06-05-2007 07:11 PM
Re: Can't get core dump from apache
This works fine on 11.31 but fails on 11.23. I get:
# a.out
euid = 30, ruid = 30, suid = 30
egid = 1, rgid = 1, sgid = 1
Core dump limit is 2147483646 (max 2147483647)
Memory fault(coredump)
# a.out
euid = 30, ruid = 30, suid = 30
egid = 1, rgid = 1, sgid = 1
Core dump limit is 2147483646 (max 2147483647)
Memory fault(coredump)
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP