Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sat, 23 Dec 2017 10:45:45 +0100
From: Markus Wichmann <>
Subject: [PATCH] Add comments to i386 assembly source

Hello everyone,

all the other arch's (I cared to look at) have well-commented or rather
clear assembly sources. Even where it wasn't really needed (PPC's
set_thread_area() would be clear enough without comments, as it's only
two instructions, neither of which complex).

But then there's i386. Without comments, and pulling off some very black
magic, I thought it would be worth commenting the files at least in the
threads directory.

While commenting the files, I noticed something: GS can refer to either
the GDT or the LDT, depending on whether the set_thread_area() syscall
failed or not. If GS refers to the LDT, then the offset portion of it
is 0, so the __clone() function will push an index of 0 on stack. Is
Linux smart enough to notice this, or will the clone() syscall then fail
with EINVAL? It's not documented, but set_thread_area() will fail with
EINVAL if index is out of bounds, and 0 is not a valid value (reason
being that the GDT index 0 is never valid; it's actually the null
selector and causes a GPF if referenced, or, in case of CS, if loaded).

Anyway, enjoy the patch.


View attachment "0001-Add-comments-to-i386-threading-assembly-files.patch" of type "text/x-diff" (4031 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.