## Multi-level paging where the inner level page tables are split into pages with entries occupying half the page size

A processor uses $$36$$ bit physical address and $$32$$ bit virtual addresses, with a page frame size of $$4$$ Kbytes. Each page table entry is of size $$4$$ bytes. A three level page table is used for virtual to physical address translation, where the virtual address is used as follows:

• Bits $$30-31$$ are used to index into the first level page table.
• Bits $$21-29$$ are used to index into the 2nd level page table.
• Bits $$12-20$$ are used to index into the 3rd level page table.
• Bits $$0-11$$ are used as offset within the page.

The number of bits required for addressing the next level page table(or page frame) in the page table entry of the first, second and third level page tables are respectively

(a) $$\text{20,20,20}$$

(b) $$\text{24,24,24}$$

(c) $$\text{24,24,20}$$

(d) $$\text{25,25,24}$$

I got the answer as (b) as in each page table we are after all required to point to a frame number in the main memory for the base address.

But in this site here it says that the answer is (d) and the logic which they use of working in chunks of $$2^{11} B$$ I feel ruins or does not go in with the entire concept of paging. Why the system shall suddenly start storing data in main memory in chucks other than the granularity defined by the page size of frame size. I do not get it.

## ModSecurity won’t apply rules – no error log entries [migrated]

I have a fresh installation of CentOS 8. I installed Apache 2.4.37 from the repo. Then installed the latest ModSecurity:

dnf install mod_security -y 

Checked the installation

dnf info mod_security 

Result:

Name         : mod_security Version      : 2.9.2 

The required Apache modules are available / loaded:

apachectl -M | grep security -> security2_module (shared) apachectl -M | grep unique -> unique_id_module (shared) 

Installed the core rule set from the repo:

dnf install mod_security_crs 

which automatically links the rules into the apache folder

/etc/httpd/modsecurity.d/activated_rules 

Rules have been checked / are at place.

The main config file

/etc/httpd/conf.d/mod_security.conf 

includes necessary further config files, including the rules conf files themselves:

IncludeOptional /etc/httpd/modsecurity.d/crs-setup.conf IncludeOptional /etc/httpd/modsecurity.d/activated_rules/*.conf IncludeOptional /etc/httpd/modsecurity.d/local_rules/*.conf 

(paths have been double-checked) and activates the rules engine:

SecRuleEngine On 

The rules config file modsecurity.d/crs-setup.conf (which is included in mod_security.conf, see above) provides

SecDefaultAction "phase:1,log,auditlog,deny,status:403" SecDefaultAction "phase:2,log,auditlog,deny,status:403" 

Apache httpd.conf calls ModSecurity:

SecStatusEngine On 

A restart (apachectl restart) shows that ModSecurity was loaded successfully:

ModSecurity: StatusEngine call successfully sent. <-- including LUA etc. 

Tests with manipulated URLs like a script insert:

/?q=%22%3E%3Cscript%3Ealert(1)%3C/script%3E%27 

show no reaction whatsoever on ModSecurity’s side. No entries at all in ModSecuritie’s audit and debug log files (debug level was set to 3), no errors in Apache’s log files.

## Is minimising the total number of one entries in binary matrices $CA$ and $C^TB$ NP-HARD?

Given a two rectangular binary matrices $$A$$ and $$B$$ with dimensions $$c\times a$$ and $$c \times b$$ respectively, does there exist an invertible binary matrix C with dimensions $$c \times c$$ such that the total number of 1 entries in $$CA$$ and $$C^TB$$ is below a target threshold $$t$$?

Here we are working in $$GF(2)$$, where multiplication and addition are AND and XOR respectively.

What is the hardness of this problem? Are there approximation algorithms to this problem?

We know this problem is in $$NP$$, as a valid $$C$$ can be used as a certificate. Also, we know how to find $$C$$ when there exists the a solution for $$t = a+b$$, by using Gaussian Elimination.

## Cowrie (Honeypot) to not store passwords for certain username entries [closed]

I have a honeypot setup on port 22 (using "cowrie"). I need certain usernames to be logged without passwords. So if someone logs in with the username "jack" and the password "passw0rd", it will only not log the password while if someone were to login with "harvey" and the password "password" it will log the harvey’s username and password.

Server (please complete the following information):  OS: NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)"  Python: Python 2.7.5 

## How to find the size of gaps between entries in an array so that the first and last element of the array is filled and the gaps are all of equal size?

I have an array a of n entries. I need to place a token on the first and last position of that array, so a[0] = 1 and a[n-1] = 1.

I now want to place additional tokens into that array with a distance inbetween each index i where a[i] = 1 that is greater than 2 (so placing a token on every index is invalid as well as alternating using and not using an entry is invalid). Phrazed differently: I want that sum(a) < n/2 . The gap inbetween each token should be the same, so say with an array of size 16,

a[0] = 1, a[3] = 1, a[6] = 1, a[9] = 1, a[12] = 1, a[15] = 1

would be a solution with a gap size of 2 (distance of 3).

How do I find all gap sizes that are possible to fill said array with the given constraints?

Imagine a street inbetween two crossroads where a lamppost should be placed on each crossroad and then additional lampposts should be placed equidistant to each other and for some reason only natural number distances are allowed.

(The actual problem I want to solve is where to place Sea Lanterns in my Minecraft Project so do not disregard this problem as an assignment question I want a solution for.)

## Complexity of finding choice of entries of matrices

Suppose I have a matrix with entries either $$x$$ or $$y$$, where the number of rows = number of columns = $$n$$. If I want to select/circle $$n$$ entries such that for each row, only exactly one is circled, for each column, also exactly one is circled, and such that all entries circled are only $$x$$ (if such a circling of entries exists), what complexity class does this belong to? Thanks!

## When are the stateful table entries for the stateful firewall created?

We know the TCP 3-way handshake:

C->SYN->S C<-SYN-ACK<-S C->ACK->S 

we also know stateful firewall. When a stateful filter entry(source ip, source port, dest ip, dest port) create? after the 3-way handshake finish or just the first 2 step of it finish?

## Select all entries where range of two DATETIME fields includes given date

I’m looking for a way to get all entries from my reservations table to be shown in a calendar.

Now I know that I will have to iterate over all days of the current week and run a database query to select all reservations with dt_from >= start_of_the_week / start_of_the_day and dt_to <= end_of_the_week / end_of_the_day.

But that only gives me the reservations that start or end within the week / respectively within the given day.

What I am trying to figure out is: How do I get the reservations which started earlier and/or end after the current day or week?

I have some kind of the following table design

+----+-------------------+---------------------+---------------------+ | ID | NAME | DT_FROM | DT_TO | +----+-------------------+---------------------+---------------------+ | 1 | Jeff Atwood | 2020-01-06 09:00:00 | 2020-01-16 09:00:00 | | 2 | Terry Jones | 2020-01-30 09:00:00 | 2020-02-16 09:00:00 | | 3 | Brian of Nazareth | 2020-02-06 09:00:00 | 2020-03-16 09:00:00 | +----+-------------------+---------------------+---------------------+

I have been stuck with this for a while now and would appreciate a push into the right direction.

Thank you 🙂

## Indexing only for most recent entries

Consider the following table:

|-----------------------------------------------------| | raffle                                              | |----|---------|----------|-----|---------------------| | id | shuffle |  user_id | ... |           notify_at | |----|---------|----------|-----|---------------------| | 1  | 4D6G8Z1 |      542 | ... | 2019-12-01 14:00:00 | | 2  | 64G264D |        6 | ... | 2019-12-28 14:00:00 | | 3  | 4IPF93D |       58 | ... | 2020-01-01 14:00:00 | | 4  | D25LF03 |       58 | ... | 2020-01-14 14:00:00 | | 5  | G04LDWE |      684 | ... | 2020-03-02 13:00:00 | 

In this table, most requests are not done to the id column, but to the user_id and created_at, which is a 64-bit timestamp (no 2038 Bug):

SELECT * FROM [raffle] WHERE [user_id] = ? and [created_at] = ? 

The table grows by the minute, but that is not the problem, but rather, the records for the notify_at in the current month are most accessed than the rest. In 10.000.000 records, an index of the user_id and notify_at sums 160MB, which only 1% of these are heavily accessed.

Is there a way to optimize an index (or any other strategy) to make retrieval of the records for the current month snapier?