profile
viewpoint
Luqman Aden luqmana @Microsoft Seattle, Washington http://luqman.ca/

luqmana/rust-opencl 167

OpenCL bindings for Rust.

luqmana/rust-psp-hello 75

Simple Hello World in Rust to run on a PSP.

luqmana/rhythmbox-plugins 52

Porting various Rhythmbox plugins to work with the new plugin api.

luqmana/gdax-client 31

Rust client library for Coinbase Exchange (GDAX).

luqmana/rray 8

Raytracer written in rust.

luqmana/mcchat 7

Fake client to get chat messages from minecraft (out-of-date).

luqmana/Pronto 7

Links freedesktop notifications to iOS app prowl.

luqmana/RemoteJoyPlus 5

Based on the original RemoteJoy by TyRaNiD with more stuff!

luqmana/llvm 2

Temporary fork of LLVM for Rust

luqmana/NowPlayingFile 1

A Rhythmbox plugin which simply outputs the currently playing track's information to a file. Based off of NowPlayingXML by kflorence. Updated to work with new plugin api.

issue commentrust-lang/rust

LTO triggers apparent miscompilation on Windows 10 x64

Here's the reduced IR of the minimal rust code here: https://github.com/rust-lang/rust/issues/74498#issuecomment-660722030, a bit simplified and with some renaming

target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc19.26.28806"

define i32 @main() unnamed_addr {
entry:
  %proc_heap = tail call i8* @GetProcessHeap()
  %vec_ptr0 = tail call i8* @HeapAlloc(i8* %proc_heap, i32 0, i64 8)
  br label %loop_hdr
loop_hdr:                                         ; preds = %loop_write, %entry
  %vec_ptr1 = phi i8* [ %vec_ptr0, %entry ], [ %vec_ptr2, %loop_write ]
  %vec_cap1 = phi i64 [ 8, %entry ], [ %new_vec_cap1, %loop_write ]
  %vec_len1 = phi i64 [ 0, %entry ], [ %new_vec_len1, %loop_write ]
  %val = phi i8 [ 0, %entry ], [ %1, %loop_write ]
  %0 = icmp eq i8 %val, 255
  %1 = add nuw i8 %val, 1
  %2 = sub i64 %vec_cap1, %vec_len1
  %3 = icmp ult i64 %2, 2
  br i1 %3, label %check_realloc, label %pre_loop_write
check_realloc:                   ; preds = %loop_hdr
  %len_plus_two_checked = tail call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %vec_len1, i64 2)
  %checked_res = extractvalue { i64, i1 } %len_plus_two_checked, 1
  br i1 %checked_res, label %exit, label %realloc
realloc:                         ; preds = %check_realloc
  %len_plus_two = extractvalue { i64, i1 } %len_plus_two_checked, 0
  %cap_times_two = shl i64 %vec_cap1, 1
  %4 = icmp ugt i64 %cap_times_two, %len_plus_two
  %new_cap = select i1 %4, i64 %cap_times_two, i64 %len_plus_two
  %new_vec_ptr = tail call i8* @HeapReAlloc(i8* %proc_heap, i32 0, i8* %vec_ptr1, i64 %new_cap)
  br label %loop_write
pre_loop_write:                                             ; preds = %loop_hdr
  %new_vec_len2 = add i64 %vec_len1, 2
  br label %loop_write
loop_write:                                       ; preds = %realloc, %pre_loop_write
  %new_vec_len1 = phi i64 [ %new_vec_len2, %pre_loop_write ], [ %len_plus_two, %realloc ]
  %vec_ptr2 = phi i8* [ %vec_ptr1, %pre_loop_write ], [ %new_vec_ptr, %realloc ]
  %new_vec_cap1 = phi i64 [ %vec_cap1, %pre_loop_write ], [ %new_cap, %realloc ]
  %vec_store_slot1 = getelementptr inbounds i8, i8* %vec_ptr2, i64 %vec_len1
  store i8 %val, i8* %vec_store_slot1, align 1
  %vec_store_slot2 = getelementptr inbounds i8, i8* %vec_store_slot1, i64 1
  store i8 %val, i8* %vec_store_slot2, align 1
  br i1 %0, label %exit, label %loop_hdr
exit:                                             ; preds = %loop_write, %check_realloc
  %exit_code = phi i32 [ 0, %loop_write ], [ 1, %check_realloc ]
  ret i32 %exit_code
}
declare { i64, i1 } @llvm.uadd.with.overflow.i64(i64, i64)
declare i8* @GetProcessHeap() unnamed_addr
declare i8* @HeapAlloc(i8*, i32, i64) unnamed_addr
declare i8* @HeapReAlloc(i8*, i32, i8*, i64) unnamed_addr

Running this through clang -O (I tried v 10.0.0), the resulting binary will continue to allocate memory in an infinite loop.

Running it through opt -loop-reduce will return a slightly different IR:

loop_hdr:
[...]
  %0 = add nuw i8 %val, 1
[...]
loop_write:
[...]
  %4 = icmp eq i8 %0, 0
  br i1 %4, label %exit, label %loop_hdr

This is the same issue @comex mentioned above. LLVM should be clearing the no wrap flag on the add there after transforming to a post-increment check but it doesn't. Then later it just gets rid of the exit condition altogether since it believes that the add will never wrap, it can't possibly be equal to 0.

But that doesn't explain why the flag doesn't seem to work post 1.44, looking at the IR (with -cvp-dont-add-nowrap-flags=true):

1.44.1:

%_5.0.i.i.i = add i8 %iter.sroa.0.060, 1

1.45+:

%7 = add nuw i8 %iter.sroa.0.063, 1

So in 1.45+ we're not relying on LLVM's CVP to determine that the add has no unsigned wrap but some other mechanism. But after looking through print-after-all for a bit I'm pretty sure this new line (https://github.com/rust-lang/rust/blob/master/src/libcore/iter/range.rs#L507) in Range::next is the reason:

let n = unsafe { Step::forward_unchecked(self.start.clone(), 1) };

That boils down to an unchecked_add which in LLVM becomes LLVMBuildNUWAdd in this case.

Since that code was introduced in https://github.com/rust-lang/rust/pull/69659 that lines up with the behaviour we see in 1.45+.

AlyoshaVasilieva

comment created time in 11 days

issue commentrust-lang/rust

LTO triggers apparent miscompilation on Windows 10 x64

Thanks @comex, that's a lot simpler than the repro I ended up getting down to and it also demonstrates it's not windows specific.

AlyoshaVasilieva

comment created time in 14 days

issue commentrust-lang/rust

LTO triggers apparent miscompilation on Windows 10 x64

Another datapoint: adding -C llvm-args=-cvp-dont-add-nowrap-flags makes it work.

That flag changed from default true to false about a year ago which kinda lines up with the repro chart above (minus 1.43.1). There was an LLVM bug about that causing some miscompilations last I checked.

cc @nikic who I believe tried to fix it.

AlyoshaVasilieva

comment created time in 15 days

delete branch luqmana/windows-itpro-docs

delete branch : vpnprofilexml-updates

delete time in 21 days

PR opened MicrosoftDocs/windows-itpro-docs

VPNProfile XSD: Add missing elements.

Update some missing elements in the VPNProfile XSD.

+9 -3

0 comment

1 changed file

pr created time in 21 days

push eventluqmana/windows-itpro-docs

Luqman Aden

commit sha 3248954b9fa956d2aa4beebe01089e6a8e3d67fd

VPNProfile XSD: Add missing elements.

view details

push time in 21 days

push eventluqmana/windows-itpro-docs

Tina Burden

commit sha e300ab6f5604e2d20d104aa8fa0753068bb4bb97

pencil edit

view details

Dani Halfin

commit sha ef4d801f4ae366e6f137ba848d49abde91884b89

pushing out a toc fix

view details

Dani Halfin

commit sha 624d465c86a81147813c79d68e7a1bbd4fe5bc98

fixing video

view details

Dani Halfin

commit sha 1e97ea36a07bcb0d08911640ce7158db19150c29

Merge pull request #3073 from MicrosoftDocs/dh-new-alerts Fixing toc issue

view details

Joey Caparas

commit sha d30468e8787fd0ae7c2362eec8ddf50850bade07

update images

view details

Tina Burden

commit sha 3b16fdb6fad39ca36ce27893f04b46e821c36271

Merge pull request #3072 from MicrosoftDocs/master Publish 6/15/2020 10:30 AM PT

view details

Tina Burden

commit sha cd1ac9a03159fb9b1d49bb64b889ed82ad559ba7

Merge pull request #3069 from MicrosoftDocs/allow-block updating blacklist/whitelist to allow/block

view details

jcaparas

commit sha 9d97406b08085f233ef3dcff75e82ad9281af253

Merge pull request #6961 from EfiKliger/patch-3 Update manage-indicators.md

view details

jcaparas

commit sha f572b62361ad71f94a893985daf04bb1096bf204

Merge pull request #6964 from amirsc3/patch-26 Update configure-endpoints-vdi.md

view details

jcaparas

commit sha aad89e808da004de3015efd9c6cf395d34913a4f

Merge pull request #6955 from illfated/mdatp-onboarding-issues MDATP/Onboarding issues: Localization adaptations

view details

Tina Burden

commit sha b33a4c67402c13ab7137f69b04fe1455a6007870

Merge pull request #3068 from DanPandre/patch-4 Fix Local settings descriptions to match user experience

view details

Tina Burden

commit sha f928ff5503fe7604b0bb3e06de032e7c5d2eca73

Merge pull request #3075 from MicrosoftDocs/repo_sync_working_branch Confirm merge from repo_sync_working_branch to master to sync with https://github.com/MicrosoftDocs/windows-itpro-docs (branch public)

view details

Denise Vangel-MSFT

commit sha 9b8e461b286b34b027cde4c0f43f3c79d46a4b3b

Update symantec-to-microsoft-defender-atp-migration.md

view details

Beth Levin

commit sha fef5a5d530e7f3921abdc021cf37450b74b8df5b

Merge branch 'master' into tvm-event-insights

view details

J Whitmarsh

commit sha 129e7a8b4fa444e6d88655506bb99cdd9d1a4861

Update index.yml

view details

J Whitmarsh

commit sha 5e9dfae7a20ca80a137812a5112fa212b79c5a3d

Update index.yml

view details

dbyrdaquent

commit sha 6b1b552219097ddfd8597bba867902b7f5e4d680

Update configure-extension-file-exclusions-microsoft-defender-antivirus.md Added system environmental variables table.

view details

Jaime Ondrusek

commit sha b69c1524f86ca8383f4a43d46b8cfd31dbe5311b

Merge pull request #2931 from MicrosoftDocs/tmlyon-patch-3 Update manage-windows-mixed-reality.md

view details

ManikaDhiman

commit sha e1a9b3c376ddc52d3f03644409a34d8968386cd6

More screenshot updates

view details

dbyrdaquent

commit sha 6b66720ba7af22549278dbc7ef43930b64cf56fd

Update configure-extension-file-exclusions-microsoft-defender-antivirus.md Updated MpCmdRun coding.

view details

push time in 21 days

create barnchluqmana/windows-itpro-docs

branch : vpnprofilexml-updates

created branch time in 21 days

fork luqmana/windows-itpro-docs

This is used for contributions to the Windows 10 content for IT professionals on docs.microsoft.com.

fork in 21 days

pull request commentmicrosoft/vscode

Register mimetype for *.code-workspace

Was there anything else needed to merge this?

luqmana

comment created time in a month

issue commentrust-lang/rust

Incorrect compilation / STATUS_ACCESS_VIOLATION when linking with lld with target-cpu set

I filed a bug: https://bugs.llvm.org/show_bug.cgi?id=46473

Systemcluster

comment created time in a month

issue commentrust-lang/rust

Incorrect compilation / STATUS_ACCESS_VIOLATION when linking with lld with target-cpu set

Looks like it's reading a value from TLS and adding an offset to use as a pointer that is not 32-byte aligned (0x000002104d54ced0):

00007ffd`9ac9dfdb 8b0517321700         mov     eax, dword ptr [structopt_derive_afd65372c61b620b!_tls_index (00007ffd`9ae111f8)]
00007ffd`9ac9dfe1 65488b0c2558000000   mov     rcx, qword ptr gs:[58h]
00007ffd`9ac9dfea 488b0cc1             mov     rcx, qword ptr [rcx+rax*8]
00007ffd`9ac9dfee c5fc288120000000     vmovaps ymm0, ymmword ptr [rcx+20h] ds:00000210`4d54ced0=00
00007ffd`9ac9dff6 4883b92000000000     cmp     qword ptr [rcx+20h], 0
00007ffd`9ac9dffe c5fc280d5a051100     vmovaps ymm1, ymmword ptr [structopt_derive_afd65372c61b620b!_ymm (00007ffd`9adae560)]
00007ffd`9ac9e006 488b8130000000       mov     rax, qword ptr [rcx+30h]

This is happening in the proc_macro_error::dummy::set_dummy call which tries to read/write a thread local:

thread_local! {
    static DUMMY_IMPL: RefCell<Option<TokenStream>> = RefCell::new(None);
}

LLVM seems to believe it should be 32 byte aligned, but as far as I can tell when ntdll is allocating the TLS slots they're 16 byte aligned

@_ZN16proc_macro_error5dummy10DUMMY_IMPL7__getit5__KEY17h4a7e8c80e38ac6e5E = internal thread_local global <{ [64 x i8] }> zeroinitializer, align 32

Sounds like a similar issue to https://github.com/rust-lang/rust/issues/44056

When built with lld-link there's no alignment specified for the TLS section in the DLL:

Dump of file structopt_derive-afd65372c61b620b.dll

File Type: DLL

  Section contains the following TLS directory:

    0000000180229000 Start of raw data
    0000000180229148 End of raw data
    00000001801E11F8 Address of index
    000000018019C3B0 Address of callbacks
                   0 Size of zero fill
            00000000 Characteristics
                       (no align specified)

But using the default msvc linker instead results in the correct alignment:

Dump of file structopt_derive-afd65372c61b620b.dll

File Type: DLL

  Section contains the following TLS directory:

    000000018019D960 Start of raw data
    000000018019DAA8 End of raw data
    00000001801E2278 Address of index
    000000018017D248 Address of callbacks
                   0 Size of zero fill
            00600000 Characteristics
                       32 byte align

Seems like an LLD bug?

Systemcluster

comment created time in a month

fork luqmana/rust-x86

Rust library to use x86 (amd64) specific functionality and registers.

https://docs.rs/x86

fork in 3 months

more