LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-31-2020, 03:57 AM   #1
chakka.lokesh
Member
 
Registered: Mar 2008
Distribution: Ubuntu
Posts: 270

Rep: Reputation: 33
core not generating for raise(SIGABRT)


I have set

Quote:
ulimit -c unlimited
Following is the sample code I have written :

Code:
#define _GNU_SOURCE

#include<signal.h>
#include<stdlib.h>
#include<stdio.h>
#include<unistd.h>

int main()
{
	raise( SIGABRT );
	if( setresuid( 0, 0, 0 ) == -1 )
	{
		fprintf( stderr, "%s %d\n", __func__, __LINE__ );
		exit(1);
	}
	return 0;
}
Following are the commands I am executing :
Quote:
$ gcc dump.c
$ sudo chown root:root a.out
$ sudo chmod +s a.out
$ ./a.out
$ sudo ./a.out
If I try ./a.out, core is not getting generated. But core is getting generated for sudo ./a.out. Is there a way I can generate the core just by using ./a.out
 
Old 05-31-2020, 04:02 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,856
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
You mean setuid binary doesn't generate core file? That's intentional.
 
Old 05-31-2020, 04:13 AM   #3
chakka.lokesh
Member
 
Registered: Mar 2008
Distribution: Ubuntu
Posts: 270

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by NevemTeve View Post
You mean setuid binary doesn't generate core file?
I want the executable to escalate privileges using setresuid not by using sudo. In addition to that, core should get generated.
 
Old 05-31-2020, 05:31 AM   #4
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,856
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
It's not `sudo` but `setuid` what the reason is.
Try command `sudo chmod u-s a.out`.

Last edited by NevemTeve; 05-31-2020 at 06:45 AM.
 
Old 06-01-2020, 02:08 AM   #5
chakka.lokesh
Member
 
Registered: Mar 2008
Distribution: Ubuntu
Posts: 270

Original Poster
Rep: Reputation: 33
if I do "chmod -s"
setresuid will fail
 
Old 06-01-2020, 04:34 AM   #6
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,856
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Sure.
So now we know that 'Problem Y' has no solution. What is 'Problem X'?
https://en.m.wikipedia.org/wiki/XY_problem

Last edited by NevemTeve; 06-01-2020 at 04:37 AM.
 
Old 06-01-2020, 12:16 PM   #7
chakka.lokesh
Member
 
Registered: Mar 2008
Distribution: Ubuntu
Posts: 270

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by NevemTeve View Post
What is 'Problem X'?
Dear NevemTeve,

I already mentioned the problem in first post. Still I am repeating here.

without doing any changes to code, is there a way to generate core with out using sudo.
 
Old 06-01-2020, 02:40 PM   #8
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,856
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
No.
But you should know that I know it isn't the 'actual problem' (aka X), it is just something you think could help in solving the actual problem. (This 'side-problem' is called Y.)
 
Old 06-02-2020, 01:14 AM   #9
chakka.lokesh
Member
 
Registered: Mar 2008
Distribution: Ubuntu
Posts: 270

Original Poster
Rep: Reputation: 33
My customer wants to type only one word. He don't have patience to type two words.

He is pretty much serious in this....!!!!
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
generating k permutations of a series and then generating all possible binary trees from them jamesbon Programming 5 09-27-2018 12:42 AM
KDE sounds causes artsd to crash with SIGABRT 6 x94qvi Linux - Newbie 5 02-10-2011 07:23 PM
aptitude dies with SIGABRT PeteD Linux - Software 9 06-20-2008 10:34 AM
MPlayer raise SIGABRT on -mm Kernel Karimo Slackware 7 05-18-2008 08:49 AM
Soundserver (artsd) crash (SIGABRT) jaykayjamiroquai Slackware 2 07-22-2006 06:12 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration