Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 151669 Details for
Bug 234069
ia64: validate mmap attributes (WB, UC, etc)
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
fail mmaps that span incompatible attributes
ia64-mmap-validation (text/plain), 2.59 KB, created by
Bjorn Helgaas
on 2007-04-04 15:30:13 UTC
(
hide
)
Description:
fail mmaps that span incompatible attributes
Filename:
MIME Type:
Creator:
Bjorn Helgaas
Created:
2007-04-04 15:30:13 UTC
Size:
2.59 KB
patch
obsolete
>ia64: fail mmaps that span areas with incompatible attributes > >Example memory map (from HP sx1000 with VGA enabled): > 0x00000 - 0x9FFFF supports only WB (cacheable) access > 0xA0000 - 0xBFFFF supports only UC (uncacheable) access > 0xC0000 - 0xFFFFF supports only WB (cacheable) access > >Some versions of X map the entire 0x00000-0xFFFFF area at once. With the >example above, this mmap must fail because there's no memory attribute that's >safe for the entire area. > >Prior to this patch, we performed the mmap with a UC mapping. When X >accessed the WB memory at 0xC0000, it caused an MCA. The crash can happen >when mapping 0xC0000 from either /dev/mem or a /sys/.../legacy_mem file. > >Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> > >Index: linux-2.6.18.ia64/arch/ia64/kernel/efi.c >=================================================================== >--- linux-2.6.18.ia64.orig/arch/ia64/kernel/efi.c 2007-03-23 05:18:28.000000000 -0600 >+++ linux-2.6.18.ia64/arch/ia64/kernel/efi.c 2007-03-23 06:32:28.000000000 -0600 >@@ -660,6 +660,29 @@ > return NULL; > } > >+static int >+efi_memmap_intersects (unsigned long phys_addr, unsigned long size) >+{ >+ void *efi_map_start, *efi_map_end, *p; >+ efi_memory_desc_t *md; >+ u64 efi_desc_size; >+ unsigned long end; >+ >+ efi_map_start = __va(ia64_boot_param->efi_memmap); >+ efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size; >+ efi_desc_size = ia64_boot_param->efi_memdesc_size; >+ >+ end = phys_addr + size; >+ >+ for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) { >+ md = p; >+ >+ if (md->phys_addr < end && efi_md_end(md) > phys_addr) >+ return 1; >+ } >+ return 0; >+} >+ > u32 > efi_mem_type (unsigned long phys_addr) > { >@@ -766,11 +789,28 @@ > int > valid_mmap_phys_addr_range (unsigned long pfn, unsigned long size) > { >+ unsigned long phys_addr = pfn << PAGE_SHIFT; >+ u64 attr; >+ >+ attr = efi_mem_attribute(phys_addr, size); >+ > /* >- * MMIO regions are often missing from the EFI memory map. >- * We must allow mmap of them for programs like X, so we >- * currently can't do any useful validation. >+ * /dev/mem mmap uses normal user pages, so we don't need the entire >+ * granule, but the entire region we're mapping must support the same >+ * attribute. > */ >+ if (attr & EFI_MEMORY_WB || attr & EFI_MEMORY_UC) >+ return 1; >+ >+ /* >+ * Intel firmware doesn't tell us about all the MMIO regions, so >+ * in general we have to allow mmap requests. But if EFI *does* >+ * tell us about anything inside this region, we should deny it. >+ * The user can always map a smaller region to avoid the overlap. >+ */ >+ if (efi_memmap_intersects(phys_addr, size)) >+ return 0; >+ > return 1; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 234069
:
151665
|
151666
|
151667
|
151668
| 151669