Does a segment descriptor type represent a segments READ/WRITE/EXECUTE permissions?
by RobotMan from LinuxQuestions.org on (#5N461)
I'm am reading understanding the linux kernel, third edition and I was reading the section about segment descriptors. Page: 70, http://gauss.ececs.uc.edu/Courses/c4...erstanding.pdf of all the fields for the segment descriptor I could not find any permission fields for READING, WRITING, and EXECUTING. I read that from this source, http://www.cs.cmu.edu/~410/doc/segments/segments.html that the READ, WRITE, and EXECUTE segment permissions are derived from the (type) field of the segment descriptor.
Code:"It turns out that while the segment descriptor TYPE field allows us to specify a wide variety of segment permissions, there is no bit pattern which grants both EXEC and READ/WRITE permissions. Thus we need one READ,EXEC segment for code and one READ,WRITE segment for data and stack. So we will need two segment descriptors and two segment selectors, one for %CS and one for %SS, %DS, %ES, %FS, and %GS."So are the READ, WRITE, and EXECUTE permissions derived from the type of the segment? Also is the quote stated above true about why there are separate segments for code and data(even though linux uses a flat memory model so no matter what segment you use it will all resolve to the same linear/virtual address)?
I know that the page table entries are responsible for saying if the page is either READ/WRITE or only READ, but I'm just wondering if the above quote is the reason for the code and data segments being separate(even though linux uses a flat memory model so no matter what segment you use it will all resolve to the same linear/virtual address).
Code:"It turns out that while the segment descriptor TYPE field allows us to specify a wide variety of segment permissions, there is no bit pattern which grants both EXEC and READ/WRITE permissions. Thus we need one READ,EXEC segment for code and one READ,WRITE segment for data and stack. So we will need two segment descriptors and two segment selectors, one for %CS and one for %SS, %DS, %ES, %FS, and %GS."So are the READ, WRITE, and EXECUTE permissions derived from the type of the segment? Also is the quote stated above true about why there are separate segments for code and data(even though linux uses a flat memory model so no matter what segment you use it will all resolve to the same linear/virtual address)?
I know that the page table entries are responsible for saying if the page is either READ/WRITE or only READ, but I'm just wondering if the above quote is the reason for the code and data segments being separate(even though linux uses a flat memory model so no matter what segment you use it will all resolve to the same linear/virtual address).