From owner-p4-projects@FreeBSD.ORG Thu Nov 15 23:05:01 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 94861373; Thu, 15 Nov 2012 23:05:01 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4A1E0371 for ; Thu, 15 Nov 2012 23:05:01 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 30BB88FC14 for ; Thu, 15 Nov 2012 23:05:01 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.5/8.14.5) with ESMTP id qAFN51mI079906 for ; Thu, 15 Nov 2012 23:05:01 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.5/8.14.5/Submit) id qAFN50SA079903 for perforce@freebsd.org; Thu, 15 Nov 2012 23:05:00 GMT (envelope-from brooks@freebsd.org) Date: Thu, 15 Nov 2012 23:05:00 GMT Message-Id: <201211152305.qAFN50SA079903@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis Subject: PERFORCE change 219801 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Nov 2012 23:05:01 -0000 http://p4web.freebsd.org/@@219801?ac=10 Change 219801 by brooks@brooks_zenith on 2012/11/15 23:04:08 Address a couple low-hanging UI nits reported by rwatson: * put black box around the configuration dialog. * Allow swiping to the next or previous slide from the Exploit Mitigated dialog. This is something of a hack. Affected files ... .. //depot/projects/ctsrd/cheribsd/src/ctsrd/cheripoint/cheripoint.c#8 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/ctsrd/cheripoint/cheripoint.c#8 (text+ko) ==== @@ -266,6 +266,10 @@ textbuf, f_width * CD_RES_COLS, f_height); fb_post_region(dbuf, d_x, d_y, d_width, d_height); + /* XXX: should composite into a somewhat larger buffer */ + fb_rectangle(black, CD_BORDER_WIDTH, + d_x - CD_BORDER_WIDTH, d_y - CD_BORDER_WIDTH, + d_width + (CD_BORDER_WIDTH * 2), d_height + (CD_BORDER_WIDTH * 2)); for(;;) { ts = ts_poll(); @@ -413,15 +417,17 @@ static int render_slide(int dfd, int slidenum, const char *slide) { - int pfd; + int error, pfd; int f_width, f_height; uint sv1, sv2; size_t olen; char sntext[8]; - uint32_t *snimage, *save; + uint32_t *snimage; uint32_t r, header_height; struct iboxstate *is; + error = 0; + printf("rendering slide %s\n", slide); fb_fill_region(white, 0, 0, fb_width, fb_height); @@ -524,37 +530,15 @@ is->height < slide_height ? is->height : slide_height); switch (sb) { case SB_CAPSICUM: - if (is->error == 99) { - save = malloc(sizeof(uint32_t) * fb_width * fb_height); - if (save != NULL) - fb_save(save); - fb_dialog(FBDT_PINCH2CLOSE, black, white, black, - "Exploit Mitigated", - "Capsicum prevented an exploit\n" - "from gaining control!"); - if (save != NULL) { - fb_post(save); - free(save); - } - } + if (is->error == 99) + error = 99; break; case SB_CHERI: olen = sizeof(sv2); sysctlbyname("security.cheri.syscall_violations", &sv2, &olen, NULL, 0); - if (sv1 != sv2) { - save = malloc(sizeof(uint32_t) * fb_width * fb_height); - if (save != NULL) - fb_save(save); - fb_dialog(FBDT_PINCH2CLOSE, black, white, black, - "Exploit Mitigated", - "CHERI prevented an exploit\n" - "from gaining control!"); - if (save != NULL) { - fb_post(save); - free(save); - } - } + if (sv1 != sv2) + error = 99; break; default: break; @@ -578,7 +562,7 @@ free(snimage); } - return (0); + return (error); } static void @@ -727,11 +711,12 @@ struct dirent *entry; char *coverpat; char **covers, **slides; - int error; + uint32_t *save; + int error, gesture; int ch, forkflag = 0; int cover, ncovers, maxcovers; int slide, nslides, maxslides; - struct tsstate *ts; + struct tsstate *ts, tshack = {0, 0, 0, 0, 0, 0,}; while ((ch = getopt(argc, argv, "f")) != -1) { switch (ch) { @@ -792,6 +777,7 @@ slide = *slidep; for (;;) { + gesture = 0; if (slide == 0) { asprintf(&coverpat, "*-cover-%d.png", slide_width); for (cover = 0; cover < ncovers; cover++) @@ -801,12 +787,55 @@ if (cover == ncovers) cover = 0; /* Smallest cover due to sort */ render_cover(dirfd(dirp), covers[cover]); - } else - render_slide(dirfd(dirp), slide, slides[slide - 1]); - *slidep = slide; /* Update post success */ + *slidep = slide; /* Update post success */ + } else { + error = render_slide(dirfd(dirp), slide, + slides[slide - 1]); + if (error == 0) + *slidep = slide; /* Update post success */ + else if (error == 99) { + save = malloc(sizeof(uint32_t) * fb_width * + fb_height); + if (save != NULL) + fb_save(save); + switch (sb) { + case SB_CAPSICUM: + gesture = fb_dialog_gestures( + TSGF_ZOOM_OUT | + TSGF_EAST | TSGF_WEST, + black, white, black, + "Exploit Mitigated", + "Capsicum prevented an exploit\n" + "from gaining control!"); + break; + case SB_CHERI: + gesture = fb_dialog_gestures( + TSGF_ZOOM_OUT | + TSGF_EAST | TSGF_WEST, + black, white, black, + "Exploit Mitigated", + "CHERI prevented an exploit\n" + "from gaining control!"); + break; + default: + break; + } + if (gesture == TSGF_ZOOM_OUT) + gesture = 0; + if (save != NULL) { + fb_post(save); + free(save); + } + } + } ts_drain(); nop: - ts = ts_poll(); + if (gesture != 0) { + tshack.ts_gesture = tsgf2tsg(gesture); + ts = &tshack; + gesture = 0; + } else + ts = ts_poll(); #ifdef DEBUG printf("gesture 0x%x\n", ts->ts_gesture); #endif