Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASAN fixes #34389

Merged
merged 2 commits into from
Jan 18, 2020
Merged

ASAN fixes #34389

merged 2 commits into from
Jan 18, 2020

Conversation

maleadt
Copy link
Member

@maleadt maleadt commented Jan 15, 2020

No description provided.

src/julia_internal.h Outdated Show resolved Hide resolved
@Keno
Copy link
Member

Keno commented Jan 15, 2020

I'm confused why the datalayout commit is necessary. All of these have nfields set to zero, so it should never attempt to load any pointer past the end of the declared struct. Which code is doing this reading?

@maleadt
Copy link
Member Author

maleadt commented Jan 15, 2020

nfields set to zero

The number of pointers isn't set to 0, so this adds one:

julia/src/staticdata.c

Lines 873 to 874 in 08ebedc

char *flddesc = (char*)dt->layout;
size_t fldsize = sizeof(jl_datatype_layout_t) + nf * fieldsize + (np << dt->layout->fielddesc_type);

@Keno
Copy link
Member

Keno commented Jan 15, 2020

I think the idea was that if first_ptr is -1, then those trailing bytes aren't allocated.

src/datatype.c Outdated Show resolved Hide resolved
@maleadt
Copy link
Member Author

maleadt commented Jan 15, 2020

I think the idea was that if first_ptr is -1, then those trailing bytes aren't allocated.

Ah, OK. Yeah, that wasn't clear to me at all. I'll have a look at avoiding those reads then.

@maleadt
Copy link
Member Author

maleadt commented Jan 16, 2020

I don't really get the layout code (i.e. the specific semantics of nfields/npointers/first_ptr, @vtjnash?), so I just implemented #34389 (comment).

@maleadt maleadt requested a review from vtjnash January 17, 2020 07:04
@Keno Keno merged commit 372a7a7 into master Jan 18, 2020
@Keno Keno deleted the tb/asan branch January 18, 2020 18:35
@KristofferC KristofferC mentioned this pull request Jan 21, 2020
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants