On Fri, May 15, 2020 at 12:14:00PM +0100, Szabolcs Nagy wrote: > The 05/15/2020 11:38, Catalin Marinas wrote: > > On Thu, May 14, 2020 at 12:37:22PM +0100, Catalin Marinas wrote: > > > We have two options with suboptions: > > > > > > 1. prctl() gets an exclude mask with 0xffff illegal even though the > > > hardware accepts it: > > > a) default exclude mask 0, allowing all tags to be generated by IRG > > > b) default exclude mask of 0xfffe so that only tag 0 is generated > > > > > > 2. prctl() gets an include mask with 0 illegal: > > > a) default include mask is 0xffff, allowing all tags to be generated > > > b) default include mask 0f 0x0001 so that only tag 0 is generated > > > > > > We currently have (2) with mask 0 but could be changed to (2.b). If we > > > are to follow the hardware description (which makes more sense to me but > > > I don't write the C library), (1.a) is the most appropriate. > > > > Thinking some more about this, as we are to expose the GCR_EL1.Excl via > > a ptrace interface as a regset, it makes more sense to move back to an > > exclude mask here with default 0. That would be option 1.a above. > > i think the libc has to do a prctl call to set > mte up and at that point it will use whatever > arguments necessary, so 1.a should work (just > like the other options). > > likely libc will disable 0 for irg and possibly > one or two other fixed colors (which will have > specific use). > > the difference i see between 1 vs 2 is forward > compatibility if the architecture changes (e.g. > adding more tag bits) but then likely new prctl > flag will be needed for handling that so it's > probably not an issue. Thanks Szabolcs. While we are at this, no-one so far asked for the GCR_EL1.RRND to be exposed to user (and this implies RGSR_EL1.SEED). Since RRND=1 guarantees a distribution "no worse" than that of RRND=0, I thought there isn't much point in exposing this configuration to the user. The only advantage of RRND=0 I see is that the kernel can change the seed randomly but, with only 4 bits per tag, it really doesn't matter much. Anyway, mentioning it here in case anyone is surprised later about the lack of RRND configurability. -- Catalin