Linux-man Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] modify_ldt.2, set_thread_area.2: Fix type of base_addr
@ 2019-12-04 20:30 Andy Lutomirski
  2019-12-14  4:54 ` Michael Kerrisk (man-pages)
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Lutomirski @ 2019-12-04 20:30 UTC (permalink / raw)
  To: mtk.manpages; +Cc: linux-man, Metzger, Markus T, Andy Lutomirski

Historically (before Linux 2.6.23), base_addr was unsigned long for
32-bit code and unsigned int for 64-bit code.  In other words, it
was always a 32-bit value.  When the ldt.h header files were
unified, the type became unsigned int on all systems.  Update
modify_ldt.2 and set_thread_area.2 accordingly.

Indeed, on x86, the GDT and LDT specify 32-bit bases for code and
data segments, and this has nothing to do with the kernel.

Reported-by: "Metzger, Markus T" <markus.t.metzger@intel.com>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
 man2/modify_ldt.2      | 2 +-
 man2/set_thread_area.2 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/man2/modify_ldt.2 b/man2/modify_ldt.2
index 0db6efea47ad..ae979ed41a7d 100644
--- a/man2/modify_ldt.2
+++ b/man2/modify_ldt.2
@@ -79,7 +79,7 @@ structure is defined in \fI<asm/ldt.h>\fP as:
 .EX
 struct user_desc {
     unsigned int  entry_number;
-    unsigned long base_addr;
+    unsigned int  base_addr;
     unsigned int  limit;
     unsigned int  seg_32bit:1;
     unsigned int  contents:2;
diff --git a/man2/set_thread_area.2 b/man2/set_thread_area.2
index b2f0882ed9ad..3b6b22efd9aa 100644
--- a/man2/set_thread_area.2
+++ b/man2/set_thread_area.2
@@ -67,7 +67,7 @@ to a structure of the following type:
 .EX
 struct user_desc {
     unsigned int  entry_number;
-    unsigned long base_addr;
+    unsigned int  base_addr;
     unsigned int  limit;
     unsigned int  seg_32bit:1;
     unsigned int  contents:2;
-- 
2.23.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] modify_ldt.2, set_thread_area.2: Fix type of base_addr
  2019-12-04 20:30 [PATCH] modify_ldt.2, set_thread_area.2: Fix type of base_addr Andy Lutomirski
@ 2019-12-14  4:54 ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Kerrisk (man-pages) @ 2019-12-14  4:54 UTC (permalink / raw)
  To: Andy Lutomirski; +Cc: linux-man, Metzger, Markus T

Hello Andy,

On 12/4/19 9:30 PM, Andy Lutomirski wrote:
> Historically (before Linux 2.6.23), base_addr was unsigned long for
> 32-bit code and unsigned int for 64-bit code.  In other words, it
> was always a 32-bit value.  When the ldt.h header files were
> unified, the type became unsigned int on all systems.  Update
> modify_ldt.2 and set_thread_area.2 accordingly.
> 
> Indeed, on x86, the GDT and LDT specify 32-bit bases for code and
> data segments, and this has nothing to do with the kernel.

Thanks. Patch applied.

Cheers,

Michael

> Reported-by: "Metzger, Markus T" <markus.t.metzger@intel.com>
> Signed-off-by: Andy Lutomirski <luto@kernel.org>
> ---
>   man2/modify_ldt.2      | 2 +-
>   man2/set_thread_area.2 | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/man2/modify_ldt.2 b/man2/modify_ldt.2
> index 0db6efea47ad..ae979ed41a7d 100644
> --- a/man2/modify_ldt.2
> +++ b/man2/modify_ldt.2
> @@ -79,7 +79,7 @@ structure is defined in \fI<asm/ldt.h>\fP as:
>   .EX
>   struct user_desc {
>       unsigned int  entry_number;
> -    unsigned long base_addr;
> +    unsigned int  base_addr;
>       unsigned int  limit;
>       unsigned int  seg_32bit:1;
>       unsigned int  contents:2;
> diff --git a/man2/set_thread_area.2 b/man2/set_thread_area.2
> index b2f0882ed9ad..3b6b22efd9aa 100644
> --- a/man2/set_thread_area.2
> +++ b/man2/set_thread_area.2
> @@ -67,7 +67,7 @@ to a structure of the following type:
>   .EX
>   struct user_desc {
>       unsigned int  entry_number;
> -    unsigned long base_addr;
> +    unsigned int  base_addr;
>       unsigned int  limit;
>       unsigned int  seg_32bit:1;
>       unsigned int  contents:2;
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-04 20:30 [PATCH] modify_ldt.2, set_thread_area.2: Fix type of base_addr Andy Lutomirski
2019-12-14  4:54 ` Michael Kerrisk (man-pages)

Linux-man Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-man/0 linux-man/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-man linux-man/ https://lore.kernel.org/linux-man \
		linux-man@vger.kernel.org
	public-inbox-index linux-man

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-man


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git