Hi guys, I've been thinking about this for a while now. Should we allow debugfs files be world-readable? Many of these files expose addresses to kernel data. For example dwc3 dumps out the TRB ring of every endpoint: # cat dwc3.37.auto/ep1in/trb_ring buffer_addr,size,type,ioc,isp_imi,csp,chn,lst,hwo 0000000000000000,0,UNKNOWN,0,0,0,0,0,0 ED 0000000000000000,0,UNKNOWN,0,0,0,0,0,0 0000000000000000,0,UNKNOWN,0,0,0,0,0,0 0000000000000000,0,UNKNOWN,0,0,0,0,0,0 0000000000000000,0,UNKNOWN,0,0,0,0,0,0 [...] The first field there will be populated with actual addresses once a gadget driver is loaded and enumerated. Similarly, xhci exposes its own TRB ring which will show DMA addresses of every TRB: static void xhci_ring_dump_segment(struct seq_file *s, struct xhci_segment *seg) { int i; dma_addr_t dma; union xhci_trb *trb; for (i = 0; i < TRBS_PER_SEGMENT; i++) { trb = &seg->trbs[i]; dma = seg->dma + i * sizeof(*trb); seq_printf(s, "%pad: %s\n", &dma, xhci_decode_trb(trb->generic.field[0], trb->generic.field[1], trb->generic.field[2], trb->generic.field[3])); } } x86/pat_memtype_list also has more addresses. But that's readable only by root. So, should we change xhci and dwc3 so that files exposing addresses are readable by root only? Or do we just convert these files to print with %pK? What do you think is the best approach here? -- balbi
Attachment:
signature.asc
Description: PGP signature